Dayz  1.11.153731
Dayz Code Explorer by Zeroy
HandcuffsLocked.c
Go to the documentation of this file.
2 {
4  {
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  player.OnRestrainStart();
45  }
46  }
47  }
48  }
49 
50  if ( GetGame().IsServer() )
51  {
52  if ( newLoc.GetType() != InventoryLocationType.HANDS )
53  {
54  if (oldLoc.GetParent())
55  {
56  PlayerBase old_p = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
57  if (old_p)
58  {
59  MiscGameplayFunctions.TransformRestrainItem(this, null, old_p, old_p);
60  return;
61  }
62  }
63 
64  Delete();
65  }
66  }
67  }
68 
69  override void SetActions()
70  {
71  super.SetActions();
72 
74  }
75 }
76 
77 class HandcuffsLocked extends RestrainingToolLocked
78 {
79 }
80 
81 class RopeLocked extends RestrainingToolLocked
82 {
83 }
84 
85 class DuctTapeLocked extends RestrainingToolLocked
86 {
87 }
88 
89 class MetalWireLocked extends RestrainingToolLocked
90 {
91 }
92 
93 class BarbedWireLocked extends RestrainingToolLocked
94 {
95 }
ItemBase
Definition: InventoryItem.c:445
GetGame
proto native CGame GetGame()
ItemBase::EEItemLocationChanged
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Definition: HandcuffsLocked.c:12
AddAction
void AddAction(typename actionName)
Definition: AdvancedCommunication.c:86
GetHierarchyRootPlayer
proto native Man GetHierarchyRootPlayer()
Returns root of current hierarchy cast to Man.
Delete
void Delete()
Delete this object in next frame.
Definition: EntityAI.c:437
InventoryLocation
InventoryLocation.
Definition: InventoryLocation.c:27
ActionUnrestrainSelf
Definition: ActionUnrestrainSelf.c:46
PlayerBase
Definition: PlayerBaseClient.c:1
ItemBase::SetActions
override void SetActions()
Definition: HandcuffsLocked.c:69
MiscGameplayFunctions
Definition: MiscGameplayFunctions.c:201
InventoryLocationType
InventoryLocationType
types of Inventory Location
Definition: InventoryLocation.c:3
RestrainingToolLocked
Head RestrainingToolLocked
MiscGameplayFunctions::TransformRestrainItem
static void TransformRestrainItem(EntityAI current_item, EntityAI tool, PlayerBase player_source, PlayerBase player_target, bool destroy=false)
Definition: MiscGameplayFunctions.c:635
ItemBase::~RestrainingToolLocked
void ~RestrainingToolLocked()
Definition: HandcuffsLocked.c:3