Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionunlockcontainerdoor.c
Go to the documentation of this file.
1
class
ActionUnlockShippingContainer
:
ActionUnlockDoors
2
{
3
//custom condition, wrong key unlock attempt is allowed
4
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
5
{
6
ContainerLockedBase
shipCont;
7
if
(
Class
.
CastTo
(shipCont, target.GetObject()))
8
{
9
int
doorIndex =
TranslateLockSelectionIntoDoorIdx
(target);
10
if
(doorIndex != -1)
11
return
shipCont.IsDoorLocked(doorIndex);
12
}
13
return
false
;
14
}
15
16
override
void
OnFinishProgressServer
(
ActionData
action_data )
17
{
18
ShippingContainerKeys_ColorBase
key =
ShippingContainerKeys_ColorBase
.Cast(action_data.m_MainItem);
19
ContainerLockedBase
shipCont =
ContainerLockedBase
.Cast(action_data.m_Target.GetObject());
20
if
(shipCont && key && ((shipCont.GetLockCompatibilityType(shipCont.GetDoorIndex(action_data.m_Target.GetComponentIndex())) & key.GetKeyCompatibilityType()) == 0))
21
{
22
key.
DestroyKeyServer
();
23
}
24
else
25
{
26
UnlockDoor
(action_data.m_Target);
27
MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem,
APPLIED_DMG
);
28
}
29
}
30
31
override
protected
void
UnlockDoor
(
ActionTarget
target)
32
{
33
Building
building;
34
if
(
Class
.
CastTo
(building, target.GetObject()))
35
{
36
int
doorIndex =
TranslateLockSelectionIntoDoorIdx
(target);
37
if
(doorIndex != -1)
38
{
39
building.
UnlockDoor
(doorIndex,
false
);
40
}
41
}
42
}
43
45
protected
int
TranslateLockSelectionIntoDoorIdx
(
ActionTarget
target)
46
{
47
//side1_lock
48
ContainerLockedBase
shipCont;
49
if
(
Class
.
CastTo
(shipCont, target.GetObject()))
50
{
51
string
selectionName = shipCont.GetActionComponentName( target.GetComponentIndex() );
52
53
if
(selectionName.
Contains
(
"_lock"
))
54
return
(selectionName.
Substring
(4,1).
ToInt
() - 1);
55
}
56
57
return
-1;
58
}
59
};
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionUnlockDoors::APPLIED_DMG
const float APPLIED_DMG
Definition
actionunlockdoors.c:11
ActionUnlockDoors::ActionUnlockDoors
void ActionUnlockDoors()
Definition
actionunlockdoors.c:13
ActionUnlockShippingContainer
Definition
actionunlockcontainerdoor.c:2
ActionUnlockShippingContainer::OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition
actionunlockcontainerdoor.c:16
ActionUnlockShippingContainer::TranslateLockSelectionIntoDoorIdx
int TranslateLockSelectionIntoDoorIdx(ActionTarget target)
Returns door idx.
Definition
actionunlockcontainerdoor.c:45
ActionUnlockShippingContainer::UnlockDoor
void UnlockDoor(ActionTarget target)
Definition
actionunlockcontainerdoor.c:31
ActionUnlockShippingContainer::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionunlockcontainerdoor.c:4
Building
Definition
building.c:11
Building::UnlockDoor
proto native void UnlockDoor(int index, bool animate=true)
Unlocks the door if locked, AJAR animation optional.
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
ContainerLockedBase
Definition
containerlocked.c:2
ItemBase
Definition
inventoryitem.c:742
PlayerBase
Definition
playerbaseclient.c:2
ShippingContainerKeys_ColorBase
Definition
shippingcontainerkeys_colorbase.c:2
ShippingContainerKeys_ColorBase::DestroyKeyServer
void DestroyKeyServer()
Definition
shippingcontainerkeys_colorbase.c:11
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
string::Substring
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
string::ToInt
proto native int ToInt()
Converts string to integer.
string::Contains
bool Contains(string sample)
Returns true if sample is substring of string.
Definition
enstring.c:286
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
continuous
actionunlockcontainerdoor.c
Generated by
1.17.0