Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
handcuffslocked.c
Go to the documentation of this file.
1class RestrainingToolLocked extends ItemBase
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 ( g_Game.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 ( g_Game.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
98class HandcuffsLocked extends RestrainingToolLocked
99{
100}
101
102class RopeLocked extends RestrainingToolLocked
103{
104}
105
106class DuctTapeLocked extends RestrainingToolLocked
107{
108}
109
110class MetalWireLocked extends RestrainingToolLocked
111{
112}
113
114class BarbedWireLocked extends RestrainingToolLocked
115{
116}
void AddAction(typename actionName)
InventoryLocation.
proto native EntityAI GetParent()
returns parent of current inventory location
proto native bool IsValid()
verify current set inventory location
proto native int GetType()
returns type of InventoryLocation
void ~RestrainingToolLocked()
override void EEKilled(Object killer)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void SetActions()
DayZGame g_Game
Definition dayzgame.c:3942
InventoryLocationType
types of Inventory Location