watchtowerkit.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. }
  25. }
  26. override bool DoPlacingHeightCheck()
  27. {
  28. return true;
  29. }
  30. override float HeightCheckOverride()
  31. {
  32. return 2.83;//9.56;
  33. }
  34. override void DisassembleKit(ItemBase item)
  35. {
  36. if (!IsHologram())
  37. {
  38. ItemBase stick = ItemBase.Cast(GetGame().CreateObjectEx("WoodenStick",GetPosition(),ECE_PLACE_ON_SURFACE));
  39. MiscGameplayFunctions.TransferItemProperties(this, stick);
  40. stick.SetQuantity(4);
  41. Rope rope = Rope.Cast(item);
  42. CreateRope(rope);
  43. }
  44. }
  45. //Debug menu Spawn Ground Special
  46. override void OnDebugSpawn()
  47. {
  48. SpawnEntityOnGroundPos("Shovel", GetPosition());
  49. SpawnEntityOnGroundPos("Hammer", GetPosition());
  50. SpawnEntityOnGroundPos("Hammer", GetPosition());
  51. SpawnEntityOnGroundPos("Hammer", GetPosition());
  52. SpawnEntityOnGroundPos("Hammer", GetPosition());
  53. SpawnEntityOnGroundPos("Pliers", GetPosition());
  54. for (int i0 = 0; i0 < 30; i0++)
  55. {
  56. SpawnEntityOnGroundPos("WoodenPlank", GetPosition());
  57. }
  58. for (int i1 = 0; i1 < 10; i1++)
  59. {
  60. SpawnEntityOnGroundPos("WoodenLog", GetPosition());
  61. }
  62. for (int i2 = 0; i2 < 15; i2++)
  63. {
  64. SpawnEntityOnGroundPos("Nail", GetPosition());
  65. }
  66. for (int i3 = 0; i3 < 9; i3++)
  67. {
  68. SpawnEntityOnGroundPos("CamoNet", GetPosition());
  69. }
  70. for (int i4 = 0; i4 < 6; i4++)
  71. {
  72. SpawnEntityOnGroundPos("BarbedWire", GetPosition());
  73. }
  74. }
  75. }