watchtowerkit.c 2.3 KB

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