totemkit.c 2.4 KB

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