3 string m_DamageZoneRecived;
13 override void CreateActionComponent()
21 protected typename m_LastValidType;
22 protected string m_CurrentDamageZone;
23 protected int m_LastValidComponentIndex;
38 override void CreateConditionComponents()
46 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
62 string damageZone =
"";
64 car.GetActionComponentNameList(target.GetComponentIndex(), selections);
66 foreach (
string selection : selections)
69 if (car && DamageSystem.GetDamageZoneFromComponentName(car, selection, damageZone))
71 if (damageZone ==
"Engine")
74 int zoneHP = car.GetHealthLevel(damageZone);
81 WoodenPlank plank = WoodenPlank.Cast(item);
85 if ((tarp || plank) && (damageZone !=
"BackWood" && damageZone !=
"BackTarp"))
97 override void OnFinishProgressServer(
ActionData action_data)
99 Object tgObject = action_data.m_Target.GetObject();
101 string damageZone = RepairCarPartActionData.Cast(action_data).m_DamageZone;
102 if (!
GetGame().IsMultiplayer())
105 if (tgObject && damageZone !=
"")
111 float zoneMax = car.GetMaxHealth(damageZone,
"");
112 float randomValue =
Math.RandomFloatInclusive(zoneMax * 0.05, zoneMax * 0.15);
117 car.SetHealth(damageZone,
"", (zoneMax *
GameConstants.DAMAGE_RUINED_VALUE) + randomValue);
120 car.SetHealth(damageZone,
"", (zoneMax *
GameConstants.DAMAGE_BADLY_DAMAGED_VALUE) + randomValue);
123 car.SetHealth(damageZone,
"", (zoneMax *
GameConstants.DAMAGE_DAMAGED_VALUE) + randomValue);
127 if (action_data.m_MainItem.HasQuantity())
129 if (action_data.m_MainItem.GetQuantity() > 1)
131 int qnt = action_data.m_MainItem.GetQuantity();
133 WoodenPlank usedPlank = WoodenPlank.Cast(action_data.m_MainItem);
134 if (usedTarp || usedPlank)
140 qnt -= action_data.m_MainItem.GetQuantityMax() * 0.25;
143 action_data.m_MainItem.SetQuantity(qnt);
147 action_data.m_MainItem.Delete();
156 RepairCarPartActionData actionData =
new RepairCarPartActionData();
162 super.WriteToContext(ctx, action_data);
163 RepairCarPartActionData repairActionData;
168 ctx.Write(repairActionData.m_DamageZone);
172 override bool ReadFromContext(
ParamsReadContext ctx, out ActionReciveData action_recive_data)
174 if (!action_recive_data)
179 super.ReadFromContext(ctx, action_recive_data);
190 recieveDataRepair.m_DamageZoneRecived = zone;
196 override void HandleReciveData(ActionReciveData action_recive_data,
ActionData action_data)
198 super.HandleReciveData(action_recive_data, action_data);
201 RepairCarPartActionData.Cast(action_data).m_DamageZone = recieveDataRepair.m_DamageZoneRecived;