Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionlockattachment.c
Go to the documentation of this file.
1
//Transfer locktypes from BasicDefines.hpp here. This is mostly for readability
2
//NONE must be 0 as it is actively used below
3
enum
eLockTypes
4
{
5
NONE
= 0,
6
LOCK_SCREW
= 1,
7
LOCK_BOLT
= 2,
8
LOCK_NUT
= 3,
9
LOCK_WIRE
= 4
10
}
11
12
class
ActionLockAttachmentCB :
ActionContinuousBaseCB
13
{
14
override
void
CreateActionComponent
()
15
{
16
m_ActionData.m_ActionComponent =
new
CAContinuousTime
(
UATimeSpent
.
BASEBUILDING_REPAIR_FAST
);
17
}
18
};
19
20
class
ActionLockAttachment
:
ActionContinuousBase
21
{
22
private
const
string
LOCK_VERSION
=
"#widget_lock"
;
23
private
const
string
UNLOCK_VERSION
=
"#widget_unlock"
;
24
private
string
m_Name
=
LOCK_VERSION
;
25
26
void
ActionLockAttachment
()
27
{
28
m_CallbackClass
= ActionLockAttachmentCB;
29
m_SpecialtyWeight
= UASoftSkillsWeight.PRECISE_LOW;
30
31
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONFB_INTERACT;
32
m_StanceMask
=
DayZPlayerConstants
.STANCEMASK_ERECT;
33
m_FullBody
=
true
;
34
}
35
36
override
void
OnActionInfoUpdate
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
37
{
38
ItemBase
target_IB =
ItemBase
.Cast(target.GetObject());
39
if
( target_IB.IsLockedInSlot() )
40
m_Text
=
UNLOCK_VERSION
;
41
else
if
( target_IB.IsAlive() )
42
m_Text
=
LOCK_VERSION
;
43
else
44
m_Text
=
""
;
45
}
46
47
override
void
CreateConditionComponents
()
48
{
49
m_ConditionItem
=
new
CCINonRuined
;
50
m_ConditionTarget
=
new
CCTCursorNoRuinCheck
(
UAMaxDistances
.
SMALL
);
51
}
52
53
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
54
{
55
if
( !target )
56
return
false
;
57
58
EntityAI
parent_EAI =
EntityAI
.Cast(target.GetParent());
59
ItemBase
target_IB =
ItemBase
.Cast(target.GetObject());
60
61
array<int>
compLock = item.m_CompatibleLocks;
62
int
targetType =
eLockTypes
.NONE;
63
64
if
( target_IB && parent_EAI )
65
{
66
//CAR DOOR HANDLING
67
//I don't really like this, but sometimes specifics have to be handled in generics
68
CarDoor
targetDoor =
CarDoor
.Cast(target_IB);
69
if
( targetDoor )
70
{
71
InventoryLocation
loc =
new
InventoryLocation
();
72
bool
isPresent = targetDoor.GetInventory().GetCurrentInventoryLocation( loc );
73
74
if
( !isPresent || loc.
GetSlot
() == -1 )
75
return
false
;
76
77
string
slotName
=
InventorySlots
.
GetSlotName
( loc.
GetSlot
() );
78
if
(
slotName
&&
CarScript
.Cast( parent_EAI ).
GetCarDoorsState
(
slotName
) !=
CarDoorState
.DOORS_OPEN )
79
return
false
;
80
}
81
//END OF CAR DOOR SPECIFICS
82
83
84
if
( target_IB.IsLockedInSlot() )
85
m_Name
=
UNLOCK_VERSION
;
86
else
if
( target_IB.IsAlive() )
87
m_Name
=
LOCK_VERSION
;
88
else
if
( !target_IB.IsLockedInSlot() )
89
return
false
;
90
91
targetType = target_IB.GetLockType();
92
93
for
(
int
i = 0; i < compLock.Count(); i++)
94
{
95
if
( targetType == compLock[i] && targetType !=
eLockTypes
.NONE)
96
{
97
return
true
;
98
}
99
}
100
}
101
return
false
;
102
}
103
104
override
void
OnStartAnimationLoop
(
ActionData
action_data )
105
{
106
super.OnStartAnimationLoop( action_data );
107
108
if
( !
g_Game
.IsMultiplayer() ||
g_Game
.IsServer() )
109
{
110
ItemBase
target_IB =
ItemBase
.Cast( action_data.m_Target.GetObject() );
111
Param2<bool, string>
play =
new
Param2<bool, string>
(
true
, action_data.m_MainItem.GetLockSoundSet() );
112
g_Game
.RPCSingleParam( target_IB,
ERPCs
.RPC_SOUND_LOCK_ATTACH, play,
true
);
113
}
114
}
115
116
override
void
OnEnd
(
ActionData
action_data )
117
{
118
if
( !
g_Game
.IsMultiplayer() ||
g_Game
.IsServer() )
119
{
120
ItemBase
target_IB =
ItemBase
.Cast( action_data.m_Target.GetObject() );
121
Param2<bool, string>
play =
new
Param2<bool, string>
(
false
, action_data.m_MainItem.GetLockSoundSet() );
122
g_Game
.RPCSingleParam( target_IB,
ERPCs
.RPC_SOUND_LOCK_ATTACH, play,
true
);
123
}
124
}
125
126
override
void
OnEndAnimationLoop
(
ActionData
action_data )
127
{
128
super.OnEndAnimationLoop( action_data );
129
130
if
( !
g_Game
.IsMultiplayer() ||
g_Game
.IsServer() )
131
{
132
ItemBase
target_IB =
ItemBase
.Cast( action_data.m_Target.GetObject() );
133
Param2<bool, string>
play =
new
Param2<bool, string>
(
false
, action_data.m_MainItem.GetLockSoundSet() );
134
g_Game
.RPCSingleParam( target_IB,
ERPCs
.RPC_SOUND_LOCK_ATTACH, play,
true
);
135
}
136
}
137
138
override
void
OnFinishProgressServer
(
ActionData
action_data )
139
{
140
ItemBase
target_IB =
ItemBase
.Cast(action_data.m_Target.GetObject());
141
142
MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, 5);
143
144
if
(target_IB.IsLockedInSlot())
145
{
146
target_IB.UnlockFromParent();
147
return
;
148
}
149
150
target_IB.LockToParent();
151
}
152
}
ActionData
ActionBase ActionData
Definition
actionbase.c:30
LOCK_SCREW
LOCK_SCREW
Definition
actionlockattachment.c:16
LOCK_NUT
LOCK_NUT
Definition
actionlockattachment.c:18
LOCK_BOLT
LOCK_BOLT
Definition
actionlockattachment.c:17
eLockTypes
eLockTypes
Definition
actionlockattachment.c:4
LOCK_WIRE
LOCK_WIRE
Definition
actionlockattachment.c:19
ActionTarget
class ActionTargets ActionTarget
CarDoorState
CarDoorState
Definition
carscript.c:2
slotName
PlayerSpawnPreset slotName
ActionBaseCB::CreateActionComponent
void CreateActionComponent()
Definition
animatedactionbase.c:61
ActionBase::m_FullBody
bool m_FullBody
Definition
actionbase.c:67
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionBase::m_ConditionItem
ref CCIBase m_ConditionItem
Definition
actionbase.c:70
ActionBase::m_SpecialtyWeight
float m_SpecialtyWeight
Definition
actionbase.c:83
ActionBase::m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition
actionbase.c:71
ActionBase::m_StanceMask
int m_StanceMask
Definition
actionbase.c:68
ActionContinuousBaseCB
Definition
actioncontinuousbase.c:2
ActionContinuousBase::ActionContinuousBase
void ActionContinuousBase()
Definition
actioncontinuousbase.c:124
ActionLockAttachment::OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition
actionlockattachment.c:138
ActionLockAttachment::OnActionInfoUpdate
override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionlockattachment.c:36
ActionLockAttachment::OnStartAnimationLoop
override void OnStartAnimationLoop(ActionData action_data)
Definition
actionlockattachment.c:104
ActionLockAttachment::m_Name
string m_Name
Definition
actionlockattachment.c:24
ActionLockAttachment::ActionLockAttachment
void ActionLockAttachment()
Definition
actionlockattachment.c:26
ActionLockAttachment::CreateConditionComponents
override void CreateConditionComponents()
Definition
actionlockattachment.c:47
ActionLockAttachment::OnEndAnimationLoop
override void OnEndAnimationLoop(ActionData action_data)
Definition
actionlockattachment.c:126
ActionLockAttachment::OnEnd
override void OnEnd(ActionData action_data)
Definition
actionlockattachment.c:116
ActionLockAttachment::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionlockattachment.c:53
ActionLockAttachment::LOCK_VERSION
const string LOCK_VERSION
Definition
actionlockattachment.c:22
ActionLockAttachment::UNLOCK_VERSION
const string UNLOCK_VERSION
Definition
actionlockattachment.c:23
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
AnimatedActionBase::m_CallbackClass
m_CallbackClass
Definition
animatedactionbase.c:145
CAContinuousTime
Definition
cacontinuoustime.c:2
CCINonRuined
Definition
ccinonruined.c:2
CCTCursorNoRuinCheck
Definition
cctcursornoruincheck.c:2
CarDoor
Definition
inventoryitem.c:507
CarScript
Definition
civiliansedan.c:2
CarScript::GetCarDoorsState
override int GetCarDoorsState(string slotType)
Definition
civiliansedan.c:173
EntityAI
Definition
inventoryitem.c:2
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
InventoryLocation::GetSlot
proto native int GetSlot()
returns slot id if current type is Attachment
InventorySlots
provides access to slot configuration
Definition
inventoryslots.c:6
InventorySlots::GetSlotName
static proto native owned string GetSlotName(int id)
ItemBase
Definition
inventoryitem.c:742
Param2
Definition
ppeconstants.c:68
PlayerBase
Definition
playerbaseclient.c:2
UAMaxDistances
Definition
actionconstants.c:110
UAMaxDistances::SMALL
const float SMALL
Definition
actionconstants.c:111
UATimeSpent
Definition
actionconstants.c:28
UATimeSpent::BASEBUILDING_REPAIR_FAST
const float BASEBUILDING_REPAIR_FAST
Definition
actionconstants.c:67
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
ERPCs
ERPCs
Definition
erpcs.c:2
NONE
@ NONE
body is not in simulation, nor in collision world
Definition
simulationstate.c:15
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
continuous
actionlockattachment.c
Generated by
1.17.0