DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
FenceKit.c
Go to the documentation of this file.
1class FenceKit 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
19 override void OnPlacementComplete( Man player, vector position = "0 0 0", vector orientation = "0 0 0" )
20 {
21 super.OnPlacementComplete( player, position, orientation );
22
23 if ( GetGame().IsServer() )
24 {
25 //Create fence
26
27 Fence fence = Fence.Cast( GetGame().CreateObjectEx( "Fence", GetPosition(), ECE_PLACE_ON_SURFACE ) );
28 fence.SetPosition( position );
29 fence.SetOrientation( orientation );
30
31 //make the kit invisible, so it can be destroyed from deploy UA when action ends
32 HideAllSelections();
33
34 SetIsDeploySound( true );
35 }
36 }
37
38 override bool DoPlacingHeightCheck()
39 {
40 return true;
41 }
42
43 override float HeightCheckOverride()
44 {
45 return 2.54;
46 }
47
48 override void DisassembleKit(ItemBase item)
49 {
50 if (!IsHologram())
51 {
52 ItemBase stick = ItemBase.Cast(GetGame().CreateObjectEx("WoodenStick",GetPosition(),ECE_PLACE_ON_SURFACE));
53 MiscGameplayFunctions.TransferItemProperties(this, stick);
54 stick.SetQuantity(2);
55 Rope rope = Rope.Cast(item);
56 CreateRope(rope);
57 }
58 }
59
60 //Debug menu Spawn Ground Special
61 override void OnDebugSpawn()
62 {
63 SpawnEntityOnGroundPos("Shovel", GetPosition());
64 SpawnEntityOnGroundPos("Hammer", GetPosition());
65 SpawnEntityOnGroundPos("Hammer", GetPosition());
66 SpawnEntityOnGroundPos("Pliers", GetPosition());
67
68 SpawnEntityOnGroundPos("WoodenLog", GetPosition());
69 SpawnEntityOnGroundPos("WoodenLog", GetPosition());
70 SpawnEntityOnGroundPos("Nail", GetPosition());
71 SpawnEntityOnGroundPos("CamoNet", GetPosition());
72 SpawnEntityOnGroundPos("BarbedWire", GetPosition());
73 SpawnEntityOnGroundPos("BarbedWire", GetPosition());
74 SpawnEntityOnGroundPos("MetalWire", GetPosition());
75 SpawnEntityOnGroundPos("CombinationLock", GetPosition());
76 SpawnEntityOnGroundPos("WoodenPlank", GetPosition());
77 SpawnEntityOnGroundPos("WoodenPlank", GetPosition());
78 SpawnEntityOnGroundPos("WoodenPlank", GetPosition());
79 SpawnEntityOnGroundPos("WoodenPlank", GetPosition());
80 }
81}
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 FenceKit.c:61
override void DisassembleKit(ItemBase item)
Definition FenceKit.c:48
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Definition FenceKit.c:19
override bool DoPlacingHeightCheck()
Definition FenceKit.c:38
override float HeightCheckOverride()
Definition FenceKit.c:43
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Definition FenceKit.c:3
proto native CGame GetGame()