DayZ 1.24
Loading...
Searching...
No Matches
HandcuffsLocked.c
Go to the documentation of this file.
2{
4 {
5 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6 if (player && player.IsRestrained())
7 player.SetRestrained(false);
8 }
9
11 {
12 super.EEItemLocationChanged(oldLoc, newLoc);
13
14 if (GetGame().IsServer())
15 {
16 if (oldLoc.IsValid() && oldLoc.GetParent())
17 {
18 PlayerBase old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
19 if (old_player && old_player.IsRestrained())
20 old_player.SetRestrained(false);
21 }
22 }
23
24 if (newLoc.IsValid())
25 {
26 if (newLoc.GetParent())
27 {
28 PlayerBase player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
29
30 if (player)
31 {
32 if (newLoc.GetType() == InventoryLocationType.HANDS)
33 {
34 if (!player.IsRestrained())
35 {
36 player.SetRestrained(true);
37 player.OnItemInHandsChanged();
38 }
39
40 if (player.IsControlledPlayer())
41 player.OnRestrainStart();
42 }
43 }
44 }
45 }
46
47 if (GetGame().IsServer())
48 {
49 if (newLoc.GetType() != InventoryLocationType.HANDS)
50 {
51 if (oldLoc.GetParent())
52 {
53 PlayerBase old_p = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
54 if (old_p)
55 {
56 MiscGameplayFunctions.TransformRestrainItem(this, null, old_p, old_p);
57 return;
58 }
59 }
60
61 Delete();
62 }
63 }
64 }
65
66 override void EEKilled(Object killer)
67 {
68 super.EEKilled(killer);
69
71 GetInventory().GetCurrentInventoryLocation(inventoryLocation);
72 if (!inventoryLocation || !inventoryLocation.IsValid())
73 return;
74
75 if (inventoryLocation.GetType() == InventoryLocationType.HANDS)
76 {
78 if (player && player.IsRestrained())
79 {
80 player.SetRestrained(false);
81 MiscGameplayFunctions.TransformRestrainItem(this, null, player, player);
82 }
83 }
84 }
85
86 override void SetActions()
87 {
88 super.SetActions();
89
91 }
92}
93
95{
96}
97
99{
100}
101
103{
104}
105
107{
108}
109
111{
112}
void AddAction(typename actionName)
InventoryLocationType
types of Inventory Location
InventoryLocation.
override void SetActions()
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
void ~RestrainingToolLocked()
override void EEKilled(Object killer)
proto native CGame GetGame()