fencekit.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. }
  27. }
  28. override bool DoPlacingHeightCheck()
  29. {
  30. return true;
  31. }
  32. override float HeightCheckOverride()
  33. {
  34. return 2.54;
  35. }
  36. override void DisassembleKit(ItemBase item)
  37. {
  38. if (!IsHologram())
  39. {
  40. ItemBase stick = ItemBase.Cast(GetGame().CreateObjectEx("WoodenStick",GetPosition(),ECE_PLACE_ON_SURFACE));
  41. MiscGameplayFunctions.TransferItemProperties(this, stick);
  42. stick.SetQuantity(2);
  43. Rope rope = Rope.Cast(item);
  44. CreateRope(rope);
  45. }
  46. }
  47. //Debug menu Spawn Ground Special
  48. override void OnDebugSpawn()
  49. {
  50. SpawnEntityOnGroundPos("Shovel", GetPosition());
  51. SpawnEntityOnGroundPos("Hammer", GetPosition());
  52. SpawnEntityOnGroundPos("Hammer", GetPosition());
  53. SpawnEntityOnGroundPos("Pliers", GetPosition());
  54. SpawnEntityOnGroundPos("WoodenLog", GetPosition());
  55. SpawnEntityOnGroundPos("WoodenLog", GetPosition());
  56. SpawnEntityOnGroundPos("Nail", GetPosition());
  57. SpawnEntityOnGroundPos("CamoNet", GetPosition());
  58. SpawnEntityOnGroundPos("BarbedWire", GetPosition());
  59. SpawnEntityOnGroundPos("BarbedWire", GetPosition());
  60. SpawnEntityOnGroundPos("MetalWire", GetPosition());
  61. SpawnEntityOnGroundPos("CombinationLock", GetPosition());
  62. SpawnEntityOnGroundPos("WoodenPlank", GetPosition());
  63. SpawnEntityOnGroundPos("WoodenPlank", GetPosition());
  64. SpawnEntityOnGroundPos("WoodenPlank", GetPosition());
  65. SpawnEntityOnGroundPos("WoodenPlank", GetPosition());
  66. }
  67. }