Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionrepairtent.c
Go to the documentation of this file.
1
class
RepairTentActionReciveData
: ActionReciveData
2
{
3
string
m_DamageZoneRecived
;
4
}
5
6
class
RepairTentActionData :
ActionData
7
{
8
string
m_DamageZone
;
9
}
10
11
class
ActionRepairTentCB
:
ActionContinuousBaseCB
12
{
13
override
void
CreateActionComponent
()
14
{
15
m_ActionData
.m_ActionComponent =
new
CAContinuousRepeat
(
UATimeSpent
.
BASEBUILDING_REPAIR_FAST
);
16
}
17
};
18
19
class
ActionRepairTent
:
ActionContinuousBase
20
{
21
typename
m_LastValidType
;
//legacy stuff
22
string
m_CurrentDamageZone
=
""
;
23
int
m_LastValidComponentIndex
= -1;
//legacy stuff
24
25
void
ActionRepairTent
()
26
{
27
m_CallbackClass
=
ActionRepairTentCB
;
28
m_SpecialtyWeight
= UASoftSkillsWeight.PRECISE_LOW;
29
30
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONFB_INTERACT;
31
m_FullBody
=
true
;
32
m_StanceMask
=
DayZPlayerConstants
.STANCEMASK_ERECT |
DayZPlayerConstants
.STANCEMASK_CROUCH;
33
m_Text
=
"#repair"
;
34
}
35
36
override
void
CreateConditionComponents
()
37
{
38
m_ConditionItem
=
new
CCINonRuined
;
//?
39
m_ConditionTarget
=
new
CCTCursorParent
(
UAMaxDistances
.
SMALL
);
40
}
41
42
override
bool
IsUsingProxies
()
43
{
44
return
true
;
45
}
46
47
override
bool
HasTarget
()
48
{
49
return
true
;
50
}
51
52
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
53
{
54
Object
targetObject = target.GetObject();
55
Object
targetParent = target.GetParent();
56
if
( !targetParent || !targetParent.IsInherited(
TentBase
) )
57
return
false
;
58
59
if
( player && targetObject && targetParent )
60
{
61
array<string>
selections =
new
array<string>
;
62
PluginRepairing module_repairing;
63
Class
.
CastTo
(module_repairing,
GetPlugin
(PluginRepairing));
64
targetObject.GetActionComponentNameList(target.GetComponentIndex(), selections,
"view"
);
65
TentBase
tent =
TentBase
.Cast( targetParent );
66
67
string
damageZone =
""
;
68
69
for
(
int
s = 0; s < selections.Count(); s++)
70
{
71
if
( DamageSystem.GetDamageZoneFromComponentName(tent, selections[s], damageZone) )
//NOTE: relevant fire geometry and view geometry selection names MUST match in order to get a valid damage zone
72
{
73
//Print("selections[s]: " + selections[s] + " | damageZone: " + damageZone);
74
break
;
75
}
76
}
77
78
if
( damageZone !=
""
)
79
{
80
if
(module_repairing.CanRepair(item,tent,damageZone))
81
{
82
m_CurrentDamageZone
= damageZone;
83
return
true
;
84
}
85
}
86
}
87
return
false
;
88
}
89
90
override
void
OnFinishProgressServer
(
ActionData
action_data )
91
{
92
Object
targetObject = action_data.m_Target.GetObject();
93
Object
targetParent = action_data.m_Target.GetParent();
94
95
string
damageZone = RepairTentActionData.Cast(action_data).m_DamageZone;
96
if
(!
g_Game
.IsMultiplayer())
97
damageZone =
m_CurrentDamageZone
;
98
99
if
( targetParent && targetParent.IsInherited(
TentBase
) && damageZone !=
""
)
100
{
101
TentBase
tent =
TentBase
.Cast( targetParent );
102
PluginRepairing module_repairing;
103
Class
.
CastTo
(module_repairing,
GetPlugin
(PluginRepairing));
104
105
RepairDamageTransfer
(action_data.m_Player,action_data.m_MainItem,tent,
m_SpecialtyWeight
,damageZone);
106
module_repairing.Repair(action_data.m_Player,action_data.m_MainItem,tent,
m_SpecialtyWeight
,damageZone);
107
}
108
}
109
110
override
ActionData
CreateActionData
()
111
{
112
RepairTentActionData action_data =
new
RepairTentActionData;
113
return
action_data;
114
}
115
116
override
void
WriteToContext
(
ParamsWriteContext
ctx,
ActionData
action_data)
117
{
118
super.WriteToContext(ctx, action_data);
119
RepairTentActionData repair_action_data;
120
121
if
(
HasTarget
() &&
Class
.
CastTo
(repair_action_data,action_data) )
122
{
123
repair_action_data.m_DamageZone =
m_CurrentDamageZone
;
124
ctx.
Write
(repair_action_data.m_DamageZone);
125
}
126
}
127
128
override
bool
ReadFromContext
(
ParamsReadContext
ctx, out ActionReciveData action_recive_data )
129
{
130
if
(!action_recive_data)
131
{
132
action_recive_data =
new
RepairTentActionReciveData
;
133
}
134
super.ReadFromContext(ctx, action_recive_data);
135
RepairTentActionReciveData
recive_data_repair =
RepairTentActionReciveData
.Cast(action_recive_data);
136
137
if
(
HasTarget
() )
138
{
139
string
zone;
140
if
( !ctx.
Read
(zone) )
141
return
false
;
142
143
recive_data_repair.
m_DamageZoneRecived
= zone;
144
}
145
return
true
;
146
}
147
148
override
void
HandleReciveData
(ActionReciveData action_recive_data,
ActionData
action_data)
149
{
150
super.HandleReciveData(action_recive_data, action_data);
151
152
RepairTentActionReciveData
recive_data_repair =
RepairTentActionReciveData
.Cast(action_recive_data);
153
RepairTentActionData.Cast(action_data).m_DamageZone = recive_data_repair.
m_DamageZoneRecived
;
154
}
155
156
void
RepairDamageTransfer
(
PlayerBase
player,
ItemBase
repair_kit,
ItemBase
item,
float
specialty_weight,
string
damage_zone =
""
)
//hack; mirrors current config setup, replace with either native DamageSystem methods, or script-side DamageSystem systemic solution
157
{
158
float
transfer_to_global_coef = 0;
159
array<string>
transfer_zones =
new
array<string>
;
160
string
path
=
""
+
CFG_VEHICLESPATH
+
" "
+ item.GetType() +
" DamageSystem DamageZones "
+ damage_zone;
161
PluginRepairing module_repairing;
162
Class
.
CastTo
(module_repairing,
GetPlugin
(PluginRepairing));
163
164
g_Game
.ConfigGetTextArray(
""
+
path
+
" transferToZonesNames"
, transfer_zones);
165
166
for
(
int
i = 0; i < transfer_zones.Count(); i++)
167
{
168
transfer_to_global_coef +=
g_Game
.ConfigGetFloat(
""
+
path
+
" Health transferToGlobalCoef"
);
169
if
(transfer_zones.Get(i) == damage_zone)
170
continue
;
171
172
module_repairing.Repair(player,repair_kit,item,specialty_weight,transfer_zones.Get(i),
false
);
173
}
174
175
//finally, repairs global
176
if
(transfer_to_global_coef > 0)
177
{
178
module_repairing.Repair(player,repair_kit,item,specialty_weight,
""
,
false
);
179
}
180
}
181
};
ActionData
ActionBase ActionData
Definition
actionbase.c:30
m_DamageZone
RepairTentActionReciveData m_DamageZone
ActionTarget
class ActionTargets ActionTarget
ActionBaseCB::m_ActionData
ActionData m_ActionData
Definition
animatedactionbase.c:3
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
ActionRepairTentCB
Definition
actionrepairtent.c:12
ActionRepairTentCB::CreateActionComponent
override void CreateActionComponent()
Definition
actionrepairtent.c:13
ActionRepairTent::OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition
actionrepairtent.c:90
ActionRepairTent::m_LastValidType
m_LastValidType
Definition
actionrepairtent.c:21
ActionRepairTent::ActionRepairTent
void ActionRepairTent()
Definition
actionrepairtent.c:25
ActionRepairTent::CreateActionData
override ActionData CreateActionData()
Definition
actionrepairtent.c:110
ActionRepairTent::CreateConditionComponents
override void CreateConditionComponents()
Definition
actionrepairtent.c:36
ActionRepairTent::m_LastValidComponentIndex
int m_LastValidComponentIndex
Definition
actionrepairtent.c:23
ActionRepairTent::RepairDamageTransfer
void RepairDamageTransfer(PlayerBase player, ItemBase repair_kit, ItemBase item, float specialty_weight, string damage_zone="")
Definition
actionrepairtent.c:156
ActionRepairTent::ReadFromContext
override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
Definition
actionrepairtent.c:128
ActionRepairTent::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionrepairtent.c:52
ActionRepairTent::HasTarget
override bool HasTarget()
Definition
actionrepairtent.c:47
ActionRepairTent::WriteToContext
override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
Definition
actionrepairtent.c:116
ActionRepairTent::IsUsingProxies
override bool IsUsingProxies()
Definition
actionrepairtent.c:42
ActionRepairTent::HandleReciveData
override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
Definition
actionrepairtent.c:148
ActionRepairTent::m_CurrentDamageZone
string m_CurrentDamageZone
Definition
actionrepairtent.c:22
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
AnimatedActionBase::m_CallbackClass
m_CallbackClass
Definition
animatedactionbase.c:145
CAContinuousRepeat
Definition
cacontinuousrepeat.c:2
CCINonRuined
Definition
ccinonruined.c:2
CCTCursorParent
Definition
cctcursorparent.c:2
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
ItemBase
Definition
inventoryitem.c:742
Object
Definition
objecttyped.c:2
PlayerBase
Definition
playerbaseclient.c:2
RepairTentActionReciveData
Definition
actionrepairtent.c:2
RepairTentActionReciveData::m_DamageZoneRecived
string m_DamageZoneRecived
Definition
actionrepairtent.c:3
Serializer::Write
proto bool Write(void value_out)
Serializer::Read
proto bool Read(void value_in)
TentBase
Definition
cartent.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
ParamsReadContext
Serializer ParamsReadContext
Definition
gameplay.c:15
ParamsWriteContext
Serializer ParamsWriteContext
Definition
gameplay.c:16
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
CFG_VEHICLESPATH
const string CFG_VEHICLESPATH
Definition
constants.c:220
path
string path
Definition
optionselectormultistate.c:142
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition
pluginmanager.c:325
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
continuous
actionrepairtent.c
Generated by
1.17.0