DayZ 1.24
Loading...
Searching...
No Matches
ActionRepairTentPart.c
Go to the documentation of this file.
1class RepairTentPartActionReciveData : ActionReciveData
2{
4}
5
7{
9}
10
18
20{
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 //m_CurrentDamageZone = "";
55 Object targetObject = target.GetObject();
56 Object targetParent = target.GetParent();
57 if (!targetParent || !targetParent.IsInherited(TentBase))
58 return false;
59
61 {
65 targetObject.GetActionComponentNameList(target.GetComponentIndex(), selections, "view");
67 if (m_LastValidType != targetObject.Type() || m_LastValidComponentIndex != target.GetComponentIndex() || m_CurrentDamageZone == "" || m_CurrentDamageZone == "Body")
68 {
69 string damageZone = "";
70
71 for (int s = 0; s < selections.Count(); s++)
72 {
73 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
74 {
75 //Print("#" + s + " damageZone: " + damageZone);
76 if (tent.GetHealthLevel("" + damageZone) == GameConstants.STATE_RUINED)
77 {
79 m_LastValidComponentIndex = target.GetComponentIndex();
80 break;
81 }
82 else
83 continue;
84 }
85 }
86 if (damageZone != "" && m_CurrentDamageZone != "Body") //This may seem like a duplicate but is required to work properly
87 {
89 m_LastValidComponentIndex = target.GetComponentIndex();
90 }
91 }
92
93 if (m_CurrentDamageZone != "" && m_CurrentDamageZone != "Body" && tent.GetHealthLevel("" + damageZone) == GameConstants.STATE_RUINED)
94 return true;
95 }
96
97 return false;
98 }
99
101 {
102 Object targetParent = action_data.m_Target.GetParent();
103 ItemBase usedItem = action_data.m_MainItem;
104
105 string damageZone = RepairTentPartActionData.Cast(action_data).m_DamageZone;
106 if (!GetGame().IsMultiplayer())
108
109 if (targetParent && targetParent.IsInherited(TentBase) && damageZone != "")
110 {
112 float m_RepairedLevel = usedItem.GetHealthLevel();
113
114 tent.SetAllowDamage(true);
115 targetParent.SetHealth01("" + damageZone, "", targetParent.GetHealthLevelValue(m_RepairedLevel));
116 tent.ProcessInvulnerabilityCheck(tent.GetInvulnerabilityTypeString());
117
118 if (usedItem.GetQuantity() > 1)
119 {
120 //Not really clean, but will do for now
121 int val = usedItem.GetQuantity();
122 val--;
123 usedItem.SetQuantity(val);
124 }
125 else
126 usedItem.Delete();
127 }
128 }
129
135
137 {
138 super.WriteToContext(ctx, action_data);
140
142 {
144 ctx.Write(repair_action_data.m_DamageZone);
145 }
146 }
147
149 {
152 super.ReadFromContext(ctx, action_recive_data);
154
155 if (HasTarget())
156 {
157 string zone;
158 if (!ctx.Read(zone))
159 return false;
160
161 recive_data_repair.m_DamageZoneRecived = zone;
162 }
163 return true;
164 }
165
173};
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 WriteToContext(ParamsWriteContext ctx, ActionData action_data)
override void CreateConditionComponents()
override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
override ActionData CreateActionData()
override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
override void OnFinishProgressServer(ActionData action_data)
override bool IsUsingProxies()
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 DEFAULT
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 int STATE_RUINED
Definition constants.c:757