3 string m_DamageZoneRecived;
13 override void CreateActionComponent()
21 typename m_LastValidType;
22 string m_CurrentDamageZone =
"";
23 int m_LastValidComponentIndex = -1;
36 override void CreateConditionComponents()
42 override bool IsUsingProxies()
47 override bool HasTarget()
54 Object targetObject = target.GetObject();
55 Object targetParent = target.GetParent();
56 if ( !targetParent || !targetParent.IsInherited(
TentBase) )
59 if ( player && targetObject && targetParent )
62 PluginRepairing module_repairing;
64 targetObject.GetActionComponentNameList(target.GetComponentIndex(), selections,
"view");
67 string damageZone =
"";
69 for (
int s = 0; s < selections.Count(); s++)
71 if ( DamageSystem.GetDamageZoneFromComponentName(tent, selections[s], damageZone) )
78 if ( damageZone !=
"" )
80 if (module_repairing.CanRepair(item,tent,damageZone))
90 override void OnFinishProgressServer(
ActionData action_data )
92 Object targetObject = action_data.m_Target.GetObject();
93 Object targetParent = action_data.m_Target.GetParent();
95 string damageZone = RepairTentActionData.Cast(action_data).m_DamageZone;
99 if ( targetParent && targetParent.IsInherited(
TentBase) && damageZone !=
"" )
102 PluginRepairing module_repairing;
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);
112 RepairTentActionData action_data =
new RepairTentActionData;
118 super.WriteToContext(ctx, action_data);
119 RepairTentActionData repair_action_data;
121 if( HasTarget() &&
Class.CastTo(repair_action_data,action_data) )
124 ctx.Write(repair_action_data.m_DamageZone);
128 override bool ReadFromContext(
ParamsReadContext ctx, out ActionReciveData action_recive_data )
130 if(!action_recive_data)
134 super.ReadFromContext(ctx, action_recive_data);
140 if ( !ctx.Read(zone) )
143 recive_data_repair.m_DamageZoneRecived = zone;
148 override void HandleReciveData(ActionReciveData action_recive_data,
ActionData action_data)
150 super.HandleReciveData(action_recive_data, action_data);
153 RepairTentActionData.Cast(action_data).m_DamageZone = recive_data_repair.m_DamageZoneRecived;
156 void RepairDamageTransfer(
PlayerBase player,
ItemBase repair_kit,
ItemBase item,
float specialty_weight,
string damage_zone =
"")
158 float transfer_to_global_coef = 0;
160 string path =
"" +
CFG_VEHICLESPATH +
" " + item.GetType() +
" DamageSystem DamageZones " + damage_zone;
161 PluginRepairing module_repairing;
164 GetGame().ConfigGetTextArray(
"" +
path +
" transferToZonesNames", transfer_zones);
166 for (
int i = 0; i < transfer_zones.Count(); i++)
168 transfer_to_global_coef +=
GetGame().ConfigGetFloat(
"" +
path +
" Health transferToGlobalCoef");
169 if (transfer_zones.Get(i) == damage_zone)
172 module_repairing.Repair(player,repair_kit,item,specialty_weight,transfer_zones.Get(i),
false);
176 if (transfer_to_global_coef > 0)
178 module_repairing.Repair(player,repair_kit,item,specialty_weight,
"",
false);