fencekit.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. class FenceKit extends KitBase
  2. {
  3. override bool CanReceiveAttachment(EntityAI attachment, int slotId)
  4. {
  5. if ( !super.CanReceiveAttachment(attachment, slotId) )
  6. return false;
  7. ItemBase att = ItemBase.Cast(GetInventory().FindAttachment(slotId));
  8. if (att)
  9. return false;
  10. return true;
  11. }
  12. //================================================================
  13. // ADVANCED PLACEMENT
  14. //================================================================
  15. override void OnPlacementComplete( Man player, vector position = "0 0 0", vector orientation = "0 0 0" )
  16. {
  17. super.OnPlacementComplete( player, position, orientation );
  18. if ( GetGame().IsServer() )
  19. {
  20. //Create fence
  21. Fence fence = Fence.Cast( GetGame().CreateObjectEx( "Fence", GetPosition(), ECE_PLACE_ON_SURFACE ) );
  22. fence.SetPosition( position );
  23. fence.SetOrientation( orientation );
  24. //make the kit invisible, so it can be destroyed from deploy UA when action ends
  25. HideAllSelections();
  26. SetIsDeploySound( true );
  27. }
  28. }
  29. override bool DoPlacingHeightCheck()
  30. {
  31. return true;
  32. }
  33. override float HeightCheckOverride()
  34. {
  35. return 2.54;
  36. }
  37. override void DisassembleKit(ItemBase item)
  38. {
  39. if (!IsHologram())
  40. {
  41. ItemBase stick = ItemBase.Cast(GetGame().CreateObjectEx("WoodenStick",GetPosition(),ECE_PLACE_ON_SURFACE));
  42. MiscGameplayFunctions.TransferItemProperties(this, stick);
  43. stick.SetQuantity(2);
  44. Rope rope = Rope.Cast(item);
  45. CreateRope(rope);
  46. }
  47. }
  48. //Debug menu Spawn Ground Special
  49. override void OnDebugSpawn()
  50. {
  51. SpawnEntityOnGroundPos("Shovel", GetPosition());
  52. SpawnEntityOnGroundPos("Hammer", GetPosition());
  53. SpawnEntityOnGroundPos("Hammer", GetPosition());
  54. SpawnEntityOnGroundPos("Pliers", GetPosition());
  55. SpawnEntityOnGroundPos("WoodenLog", GetPosition());
  56. SpawnEntityOnGroundPos("WoodenLog", GetPosition());
  57. SpawnEntityOnGroundPos("Nail", GetPosition());
  58. SpawnEntityOnGroundPos("CamoNet", GetPosition());
  59. SpawnEntityOnGroundPos("BarbedWire", GetPosition());
  60. SpawnEntityOnGroundPos("BarbedWire", GetPosition());
  61. SpawnEntityOnGroundPos("MetalWire", GetPosition());
  62. SpawnEntityOnGroundPos("CombinationLock", GetPosition());
  63. SpawnEntityOnGroundPos("WoodenPlank", GetPosition());
  64. SpawnEntityOnGroundPos("WoodenPlank", GetPosition());
  65. SpawnEntityOnGroundPos("WoodenPlank", GetPosition());
  66. SpawnEntityOnGroundPos("WoodenPlank", GetPosition());
  67. }
  68. }