shelterkit.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. class ShelterKit 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 shelter site
  21. ShelterSite site = ShelterSite.Cast( GetGame().CreateObjectEx( "ShelterSite", GetPosition(), ECE_PLACE_ON_SURFACE ) );
  22. site.SetPosition( position );
  23. site.SetOrientation( orientation );
  24. //make the kit invisible, so it can be destroyed from deploy UA when action ends
  25. HideAllSelections();
  26. SetIsDeploySound( true );
  27. }
  28. }
  29. override bool DoPlacingHeightCheck()
  30. {
  31. return true;
  32. }
  33. override float HeightCheckOverride()
  34. {
  35. return 1.6;
  36. }
  37. override string GetDeploySoundset()
  38. {
  39. return "Shelter_Site_Build_Start_SoundSet";
  40. }
  41. override string GetLoopDeploySoundset()
  42. {
  43. return "Shelter_Site_Build_Loop_SoundSet";
  44. }
  45. override string GetDeployFinishSoundset()
  46. {
  47. return "Shelter_Site_Build_Finish_SoundSet";
  48. }
  49. override void DisassembleKit(ItemBase item)
  50. {
  51. if (!IsHologram())
  52. {
  53. ItemBase stick = ItemBase.Cast(GetGame().CreateObjectEx("WoodenStick",GetPosition(),ECE_PLACE_ON_SURFACE));
  54. MiscGameplayFunctions.TransferItemProperties(this, stick);
  55. stick.SetQuantity(4);
  56. Rope rope = Rope.Cast(item);
  57. CreateRope(rope);
  58. }
  59. }
  60. //Debug menu Spawn Ground Special
  61. override void OnDebugSpawn()
  62. {
  63. SpawnEntityOnGroundPos("Shovel", GetPosition());
  64. SpawnEntityOnGroundPos("Hammer", GetPosition());
  65. SpawnEntityOnGroundPos("Pliers", GetPosition());
  66. for (int i0 = 0; i0 < 4; ++i0)
  67. {
  68. SpawnEntityOnGroundPos("LongWoodenStick", GetPosition());
  69. }
  70. for (int i1 = 0; i1 < 8; ++i1)
  71. {
  72. SpawnEntityOnGroundPos("TannedLeather", GetPosition());
  73. }
  74. for (int i2 = 0; i2 < 4; ++i2)
  75. {
  76. SpawnEntityOnGroundPos("Fabric", GetPosition());
  77. }
  78. for (int i3 = 0; i3 < 50; ++i3)
  79. {
  80. SpawnEntityOnGroundPos("WoodenStick", GetPosition());
  81. }
  82. }
  83. }