DayZ 1.24
Loading...
Searching...
No Matches
ActionRepairTent.c
Go to the documentation of this file.
1class RepairTentActionReciveData : ActionReciveData
2{
4}
5
7{
9}
10
18
20{
21 typename m_LastValidType; //legacy stuff
23 int m_LastValidComponentIndex = -1; //legacy stuff
24
26 {
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
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
60 {
64 targetObject.GetActionComponentNameList(target.GetComponentIndex(), selections, "view");
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 {
83 return true;
84 }
85 }
86 }
87 return false;
88 }
89
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 (!GetGame().IsMultiplayer())
98
99 if (targetParent && targetParent.IsInherited(TentBase) && damageZone != "")
100 {
104
107 }
108 }
109
115
117 {
118 super.WriteToContext(ctx, action_data);
120
122 {
124 ctx.Write(repair_action_data.m_DamageZone);
125 }
126 }
127
129 {
132 super.ReadFromContext(ctx, action_recive_data);
134
135 if (HasTarget())
136 {
137 string zone;
138 if (!ctx.Read(zone))
139 return false;
140
141 recive_data_repair.m_DamageZoneRecived = zone;
142 }
143 return true;
144 }
145
153
154 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
155 {
156 float transfer_to_global_coef = 0;
158 string path = "" + CFG_VEHICLESPATH + " " + item.GetType() + " DamageSystem DamageZones " + damage_zone;
161
162 GetGame().ConfigGetTextArray("" + path + " transferToZonesNames", transfer_zones);
163
164 for (int i = 0; i < transfer_zones.Count(); i++)
165 {
166 transfer_to_global_coef += GetGame().ConfigGetFloat("" + path + " Health transferToGlobalCoef");
167 if (transfer_zones.Get(i) == damage_zone)
168 continue;
169
171 }
172
173 //finally, repairs global
176 }
177};
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
RepairCarChassisActionReciveData m_DamageZone
PluginBase GetPlugin(typename plugin_type)
ActionData m_ActionData
ref CABase m_ActionComponent
Definition ActionBase.c:30
override void CreateActionComponent()
override void OnFinishProgressServer(ActionData action_data)
override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
override ActionData CreateActionData()
override void CreateConditionComponents()
void RepairDamageTransfer(PlayerBase player, ItemBase repair_kit, ItemBase item, float specialty_weight, string damage_zone="")
override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
override bool HasTarget()
override bool IsUsingProxies()
override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Super root of all classes in Enforce script.
Definition EnScript.c:11
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
const float SMALL
const float BASEBUILDING_REPAIR_FAST
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const string CFG_VEHICLESPATH
Definition constants.c:209