Hatchback and Mountainbike repair fix

This commit is contained in:
He-Man 2018-05-14 20:00:29 +02:00
parent ae3fec8426
commit c85516337d
4 changed files with 59 additions and 23 deletions

View File

@ -25,11 +25,11 @@ if (_veh iskindof "ebike_epoch") then {
}; };
_wheelcounter = 0; _wheelcounter = 0;
{ {
_HitPointName = tolower _x; _x params ["_searchedhit","_limit1","_limit2"];
_Hit = (getAllHitPointsDamage _veh) select 2 select _foreachindex; _searchedhit = tolower _searchedhit;
{ {
_x params ["_searchedhit","_limit1","_limit2"]; _HitPointName = tolower _x;
_searchedhit = tolower _searchedhit; _Hit = (getAllHitPointsDamage _veh) select 2 select _foreachindex;
if (_searchedhit isequalto _HitPointName) then { if (_searchedhit isequalto _HitPointName) then {
_wheel = ["wheel",_searchedhit] call bis_fnc_instring; _wheel = ["wheel",_searchedhit] call bis_fnc_instring;
if (_wheel) then { if (_wheel) then {
@ -59,8 +59,8 @@ _wheelcounter = 0;
}; };
}; };
}; };
} foreach _VehicleRepairs; } foreach ((getAllHitPointsDamage _veh) select 0);
} foreach ((getAllHitPointsDamage _veh) select 0); } foreach _VehicleRepairs;
_repairarrays = []; _repairarrays = [];
{ {

View File

@ -32,7 +32,7 @@ EPOCH_Vehicle_MaintainLock = true;
switch _do do { switch _do do {
case 'repair': { case 'repair': {
_reqiredMat = ""; _reqiredMat = "NONE";
_searchname = _hitpointname; _searchname = _hitpointname;
if (["glass",_hitpointname] call Bis_fnc_instring) then { if (["glass",_hitpointname] call Bis_fnc_instring) then {
_searchname = "glass"; _searchname = "glass";
@ -44,14 +44,16 @@ switch _do do {
_reqiredMat = _repairmat; _reqiredMat = _repairmat;
}; };
} foreach _VehicleRepairs; } foreach _VehicleRepairs;
if (_reqiredMat isequalto "") exitwith { if (_reqiredMat isequalto "NONE") exitwith {
['Error - Can not find required Material',5] call Epoch_message; ['Error - Can not find required Material',5] call Epoch_message;
}; };
if !(_reqiredMat in (magazines player)) exitwith { if (!(_reqiredMat in (magazines player)) && !(_reqiredMat isequalto "")) exitwith {
_line = format ['You need %1 to repair',_reqiredMat call EPOCH_itemDisplayName]; _line = format ['You need %1 to repair',_reqiredMat call EPOCH_itemDisplayName];
[_line,5] call Epoch_message; [_line,5] call Epoch_message;
}; };
player removemagazine _reqiredMat; if !(_reqiredMat isequalto "") then {
player removemagazine _reqiredMat;
};
if (_hitpointname isequalto "glass") then { if (_hitpointname isequalto "glass") then {
{ {
if (["glass",tolower _x] call Bis_fnc_instring) then { if (["glass",tolower _x] call Bis_fnc_instring) then {
@ -64,7 +66,7 @@ switch _do do {
}; };
}; };
case 'replace': { case 'replace': {
_reqiredMat = ""; _reqiredMat = "NONE";
_searchname = _hitpointname; _searchname = _hitpointname;
if (["glass", _hitpointname] call Bis_fnc_instring) then { if (["glass", _hitpointname] call Bis_fnc_instring) then {
_searchname = "glass"; _searchname = "glass";
@ -76,14 +78,16 @@ switch _do do {
_reqiredMat = _replacemat; _reqiredMat = _replacemat;
}; };
} foreach _VehicleRepairs; } foreach _VehicleRepairs;
if (_reqiredMat isequalto "") exitwith { if (_reqiredMat isequalto "NONE") exitwith {
['Error - Can not find required Material',5] call Epoch_message; ['Error - Can not find required Material',5] call Epoch_message;
}; };
if !(_reqiredMat in (magazines player)) exitwith { if (!(_reqiredMat in (magazines player)) && !(_reqiredMat isequalto "")) exitwith {
_line = format ['You need %1 to repair',_reqiredMat call EPOCH_itemDisplayName]; _line = format ['You need %1 to repair',_reqiredMat call EPOCH_itemDisplayName];
[_line,5] call Epoch_message; [_line,5] call Epoch_message;
}; };
player removemagazine _reqiredMat; if !(_reqiredMat isequalto "") then {
player removemagazine _reqiredMat;
};
if (_hitpointname isequalto "glass") then { if (_hitpointname isequalto "glass") then {
{ {
if (["glass",tolower _x] call Bis_fnc_instring) then { if (["glass",tolower _x] call Bis_fnc_instring) then {

View File

@ -270,6 +270,20 @@ class VehMaintanance
icon = "x\addons\a3_epoch_code\Data\UI\buttons\Replace_SLG.paa"; icon = "x\addons\a3_epoch_code\Data\UI\buttons\Replace_SLG.paa";
tooltip = "Replace Winch"; tooltip = "Replace Winch";
}; };
class RepairTireBike1
{
condition = "'hitfwheel' in (EPOCH_VehicleRepairs select 0)";
action = "[dyna_cursorTarget,'repair','hitfwheel'] spawn EPOCH_client_VehicleMaintananceDo";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\Repair_Wheel.paa";
tooltip = "Repair 1st Wheel";
};
class RepairTireBike2
{
condition = "'hitbwheel' in (EPOCH_VehicleRepairs select 0)";
action = "[dyna_cursorTarget,'repair','hitbwheel'] spawn EPOCH_client_VehicleMaintananceDo";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\Repair_Wheel.paa";
tooltip = "Repair 2nd Wheel";
};
class RepairTire1 class RepairTire1
{ {
condition = "'hitlfwheel' in (EPOCH_VehicleRepairs select 0)"; condition = "'hitlfwheel' in (EPOCH_VehicleRepairs select 0)";
@ -326,6 +340,20 @@ class VehMaintanance
icon = "x\addons\a3_epoch_code\Data\UI\buttons\Repair_Wheel.paa"; icon = "x\addons\a3_epoch_code\Data\UI\buttons\Repair_Wheel.paa";
tooltip = "Repair 4th Right Wheel"; tooltip = "Repair 4th Right Wheel";
}; };
class ReplaceTireBike1
{
condition = "'hitfwheel' in (EPOCH_VehicleRepairs select 2)";
action = "[dyna_cursorTarget,'replace','hitfwheel'] spawn EPOCH_client_VehicleMaintananceDo";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\Replace_Wheel.paa";
tooltip = "Replace 1st Wheel";
};
class ReplaceTireBike2
{
condition = "'hitbwheel' in (EPOCH_VehicleRepairs select 2)";
action = "[dyna_cursorTarget,'replace','hitbwheel'] spawn EPOCH_client_VehicleMaintananceDo";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\Replace_Wheel.paa";
tooltip = "Replace 2nd Wheel";
};
class ReplaceTire1 class ReplaceTire1
{ {
condition = "'hitlfwheel' in (EPOCH_VehicleRepairs select 2)"; condition = "'hitlfwheel' in (EPOCH_VehicleRepairs select 2)";

View File

@ -243,21 +243,25 @@ class CfgEpochClient
VehicleRepairs[] = { // {Hitpoint, dmg to repair, dmg to replace, mat to repair, mat to replace} VehicleRepairs[] = { // {Hitpoint, dmg to repair, dmg to replace, mat to repair, mat to replace}
{"HitHull",0.33,0.66,"ItemScraps","ItemCorrugated"}, {"HitHull",0.33,0.66,"ItemScraps","ItemCorrugated"},
{"HitBody",0.33,1,"ItemScraps","ItemCorrugated"}, {"HitBody",0.33,1,"ItemScraps","ItemCorrugated"},
{"HitLFWheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitLF2Wheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitLMWheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitLBWheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitRFWheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitRF2Wheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitRMWheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitRBWheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitEngine",0.33,0.91,"EngineParts","EngineBlock"}, {"HitEngine",0.33,0.91,"EngineParts","EngineBlock"},
{"glass",0.33,1,"ItemGlass","ItemGlass"}, {"glass",0.33,1,"ItemGlass","ItemGlass"},
{"HitFuel",0.1,0.66,"ItemDuctTape","FuelTank"}, {"HitFuel",0.1,0.66,"ItemDuctTape","FuelTank"},
{"HitHRotor",0.33,1,"ItemCorrugated","ItemRotor"}, {"HitHRotor",0.33,1,"ItemCorrugated","ItemRotor"},
{"HitVRotor",0.33,1,"ItemCorrugated","ItemRotor"}, {"HitVRotor",0.33,1,"ItemCorrugated","ItemRotor"},
{"HitWinch",0.33,0.91,"ItemCables","ItemCables"}, {"HitWinch",0.33,0.91,"ItemCables","ItemCables"},
{"HitAvionics",0.33,0.91,"CircuitParts","CircuitParts"} {"HitAvionics",0.33,0.91,"CircuitParts","CircuitParts"},
// Wheels - Do not change the order (front to back wheels) here!
{"HitLFWheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitRFWheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitLF2Wheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitRF2Wheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitLMWheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitRMWheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitLBWheel",0.33,1,"VehicleRepair","SpareTire"},
{"HitRBWheel",0.33,1,"VehicleRepair","SpareTire"},
// Mountainbike wheels
{"HitFWheel",0.33,0.91,"",""},
{"HitBWheel",0.33,0.91,"",""}
}; };
// include configs // include configs