Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
handcuffslocked.c
Go to the documentation of this file.
2 {
4  {
5  PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6  if ( player && player.IsRestrained() )
7  {
8  player.SetRestrained(false);
9  }
10  }
11 
12  override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
13  {
14  super.EEItemLocationChanged(oldLoc, newLoc);
15 
16  if ( GetGame().IsServer() )
17  {
18  if ( oldLoc.IsValid() && oldLoc.GetParent() )
19  {
20  PlayerBase old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
21  if (old_player && old_player.IsRestrained())
22  {
23  old_player.SetRestrained(false);
24  }
25  }
26  }
27 
28  if ( newLoc.IsValid() )
29  {
30  if (newLoc.GetParent())
31  {
32  PlayerBase player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
33 
34  if ( player )
35  {
36  if ( newLoc.GetType() == InventoryLocationType.HANDS )
37  {
38  if ( !player.IsRestrained() )
39  {
40  player.SetRestrained(true);
41  player.OnItemInHandsChanged();
42  }
43 
44  if (player.IsControlledPlayer())
45  player.OnRestrainStart();
46  }
47  }
48  }
49  }
50 
51  if ( GetGame().IsServer() )
52  {
53  if ( newLoc.GetType() != InventoryLocationType.HANDS )
54  {
55  if (oldLoc.GetParent())
56  {
57  PlayerBase old_p = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
58  if (old_p)
59  {
60  MiscGameplayFunctions.TransformRestrainItem(this, null, old_p, old_p);
61  return;
62  }
63  }
64 
65  Delete();
66  }
67  }
68  }
69 
70  override void EEKilled(Object killer)
71  {
72  super.EEKilled(killer);
73 
74  InventoryLocation inventoryLocation = new InventoryLocation();
75  GetInventory().GetCurrentInventoryLocation(inventoryLocation);
76  if (!inventoryLocation || !inventoryLocation.IsValid())
77  return;
78 
79  if (inventoryLocation.GetType() == InventoryLocationType.HANDS)
80  {
81  PlayerBase player = PlayerBase.Cast(inventoryLocation.GetParent());
82  if (player && player.IsRestrained())
83  {
84  player.SetRestrained(false);
85  MiscGameplayFunctions.TransformRestrainItem(this, null, player, player);
86  }
87  }
88  }
89 
90  override void SetActions()
91  {
92  super.SetActions();
93 
95  }
96 }
97 
98 class HandcuffsLocked extends RestrainingToolLocked
99 {
100 }
101 
102 class RopeLocked extends RestrainingToolLocked
103 {
104 }
105 
106 class DuctTapeLocked extends RestrainingToolLocked
107 {
108 }
109 
110 class MetalWireLocked extends RestrainingToolLocked
111 {
112 }
113 
114 class BarbedWireLocked extends RestrainingToolLocked
115 {
116 }
ItemBase
Definition: inventoryitem.c:730
GetGame
proto native CGame GetGame()
EEItemLocationChanged
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Definition: remotedetonator.c:72
InventoryLocation
InventoryLocation.
Definition: inventorylocation.c:27
ActionUnrestrainSelf
Definition: actionunrestrainself.c:48
PlayerBase
Definition: playerbaseclient.c:1
InventoryLocationType
InventoryLocationType
types of Inventory Location
Definition: inventorylocation.c:3
AddAction
void AddAction(typename actionName)
Definition: advancedcommunication.c:86
Object
Definition: objecttyped.c:1
EEKilled
override void EEKilled(Object killer)
Definition: remotedetonator.c:242
SetActions
void SetActions()
Definition: advancedcommunication.c:79
RestrainingToolLocked
Head RestrainingToolLocked