totemkit.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. }
  39. }
  40. override void DisassembleKit(ItemBase item)
  41. {
  42. if (!IsHologram())
  43. {
  44. ItemBase stick = ItemBase.Cast(GetGame().CreateObjectEx("WoodenStick",GetPosition(),ECE_PLACE_ON_SURFACE));
  45. MiscGameplayFunctions.TransferItemProperties(this, stick);
  46. stick.SetQuantity(3);
  47. Rope rope = Rope.Cast(item);
  48. CreateRope(rope);
  49. }
  50. }
  51. //================================================================
  52. // DEBUG
  53. //================================================================
  54. //Debug menu Spawn Ground Special
  55. override void OnDebugSpawn()
  56. {
  57. SpawnEntityOnGroundPos("SledgeHammer", GetPosition());
  58. SpawnEntityOnGroundPos("Hammer", GetPosition());
  59. SpawnEntityOnGroundPos("Shovel", GetPosition());
  60. Nail nails = Nail.Cast(SpawnEntityOnGroundPos("Nail", GetPosition()));
  61. nails.SetQuantity(60);
  62. SpawnEntityOnGroundPos("Rope", GetPosition());
  63. SpawnEntityOnGroundPos("MetalWire", GetPosition());
  64. SpawnEntityOnGroundPos("Flag_DayZ", GetPosition());
  65. for (int i0 = 0; i0 < 32; i0++)
  66. {
  67. SpawnEntityOnGroundPos("Stone", GetPosition());
  68. }
  69. for (int i1 = 0; i1 < 10; i1++)
  70. {
  71. SpawnEntityOnGroundPos("WoodenLog", GetPosition());
  72. }
  73. }
  74. }