DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ShelterKit.c
Go to the documentation of this file.
1class ShelterKit extends KitBase
2{
3 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
4 {
5 if ( !super.CanReceiveAttachment(attachment, slotId) )
6 return false;
7
8 ItemBase att = ItemBase.Cast(GetInventory().FindAttachment(slotId));
9 if (att)
10 return false;
11
12 return true;
13 }
14
15 //================================================================
16 // ADVANCED PLACEMENT
17 //================================================================
18 override void OnPlacementComplete( Man player, vector position = "0 0 0", vector orientation = "0 0 0" )
19 {
20 super.OnPlacementComplete( player, position, orientation );
21
22 if ( GetGame().IsServer() )
23 {
24 //Create shelter site
25 ShelterSite site = ShelterSite.Cast( GetGame().CreateObjectEx( "ShelterSite", GetPosition(), ECE_PLACE_ON_SURFACE ) );
26 site.SetPosition( position );
27 site.SetOrientation( orientation );
28
29 //make the kit invisible, so it can be destroyed from deploy UA when action ends
30 HideAllSelections();
31
32 SetIsDeploySound( true );
33 }
34 }
35
36 override bool DoPlacingHeightCheck()
37 {
38 return true;
39 }
40
41 override float HeightCheckOverride()
42 {
43 return 1.6;
44 }
45
46 override string GetDeploySoundset()
47 {
48 return "Shelter_Site_Build_Start_SoundSet";
49 }
50
51 override string GetLoopDeploySoundset()
52 {
53 return "Shelter_Site_Build_Loop_SoundSet";
54 }
55
56 override string GetDeployFinishSoundset()
57 {
58 return "Shelter_Site_Build_Finish_SoundSet";
59 }
60
61 override void DisassembleKit(ItemBase item)
62 {
63 if (!IsHologram())
64 {
65 ItemBase stick = ItemBase.Cast(GetGame().CreateObjectEx("WoodenStick",GetPosition(),ECE_PLACE_ON_SURFACE));
66 MiscGameplayFunctions.TransferItemProperties(this, stick);
67 stick.SetQuantity(4);
68 Rope rope = Rope.Cast(item);
69 CreateRope(rope);
70 }
71 }
72
73 //Debug menu Spawn Ground Special
74 override void OnDebugSpawn()
75 {
76 SpawnEntityOnGroundPos("Shovel", GetPosition());
77 SpawnEntityOnGroundPos("Hammer", GetPosition());
78 SpawnEntityOnGroundPos("Pliers", GetPosition());
79
80 for (int i0 = 0; i0 < 4; ++i0)
81 {
82 SpawnEntityOnGroundPos("LongWoodenStick", GetPosition());
83 }
84
85 for (int i1 = 0; i1 < 8; ++i1)
86 {
87 SpawnEntityOnGroundPos("TannedLeather", GetPosition());
88 }
89
90 for (int i2 = 0; i2 < 4; ++i2)
91 {
92 SpawnEntityOnGroundPos("Fabric", GetPosition());
93 }
94
95 for (int i3 = 0; i3 < 50; ++i3)
96 {
97 SpawnEntityOnGroundPos("WoodenStick", GetPosition());
98 }
99 }
100}
const int ECE_PLACE_ON_SURFACE
override bool IsHologram()
Definition ItemBase.c:5556
void SetIsDeploySound(bool is_deploy_sound)
Definition ItemBase.c:8910
class JsonUndergroundAreaTriggerData GetPosition
override void OnDebugSpawn()
Definition ShelterKit.c:74
override void DisassembleKit(ItemBase item)
Definition ShelterKit.c:61
override string GetDeploySoundset()
Definition ShelterKit.c:46
override string GetLoopDeploySoundset()
Definition ShelterKit.c:51
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Definition ShelterKit.c:18
override bool DoPlacingHeightCheck()
Definition ShelterKit.c:36
override string GetDeployFinishSoundset()
Definition ShelterKit.c:56
override float HeightCheckOverride()
Definition ShelterKit.c:41
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Definition ShelterKit.c:3
proto native CGame GetGame()