Fix reversed wheel naming for multiple trucks and apcs when repair and salvage

Many trucks had the wrong name for LB and LM (RB, RM) wheels. Also for LF2 and LB. Those wheel names are reversed.
This commit is contained in:
A Man
2022-06-05 11:32:55 +02:00
parent b0723714c5
commit f18154ad91
3 changed files with 93 additions and 17 deletions

View File

@@ -1,13 +1,33 @@
private ["_part","_cancel","_color","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints","_damagePercent","_configVeh","_hitpoint","_hits"];
_vehicle = _this select 3;
local _vehicle = _this select 3;
dayz_myCursorTarget = _vehicle;
{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
_hitpoints = _vehicle call vehicle_getHitpoints;
local _hitpoints = _vehicle call vehicle_getHitpoints;
if (count _hitpoints < 1) exitwith {};
local _hitpoint = "";
local _damage = 0;
local _hits = [];
local _configVeh = "";
local _part = "";
local _damagePercent = "";
local _color = "";
local _cmpt = "";
local _string = "";
local _handle = 0;
local _isV3S = _vehicle isKindOf "V3S_Base";
local _isTatra = (_vehicle isKindOf "T810_DZE_Base_ACR" || _vehicle isKindOf "T810_Turrets_Base_ACR");
local _isMTVR = _vehicle isKindOf "MTVR";
local _wheelSwitchTruck = (_isV3S || _isTatra || _isMTVR);
local _isBTR60 = _vehicle isKindOf "BTR60_TK_EP1";
local _isBTR90 = _vehicle isKindOf "BTR90_Base";
local _isLAV25 = _vehicle isKindOf "LAV25_Base";
local _isRM70 = _vehicle isKindOf "RM70_ACR";
local _wheelSwitchAPC = (_isBTR60 || _isBTR90 || _isLAV25 || _isRM70);
{
_hitpoint = _x;
_hits = [_vehicle,_hitpoint] call object_getHit;
@@ -19,6 +39,25 @@ if (count _hitpoints < 1) exitwith {};
_cmpt set [2,20];
_cmpt = toString _cmpt;
call {
if (_wheelSwitchTruck) exitwith {
call {
if (['LMWheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - LBWheel";};
if (['LBWheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - LMWheel";};
if (['RMWheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - RBWheel";};
if (['RBWheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - RMWheel";};
};
};
if (_wheelSwitchAPC) exitwith {
call {
if (['LF2Wheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - LBWheel";};
if (['LBWheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - LF2Wheel";};
if (['RF2Wheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - RBWheel";};
if (['RBWheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - RF2Wheel";};
};
};
};
_configVeh = configFile >> "cfgVehicles" >> "RepairParts" >> _hitpoint;
_part = getText(_configVeh >> "part");
if (_part == "") then {
@@ -48,10 +87,9 @@ if (count _hitpoints < 1) exitwith {};
_handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\repair.sqf",[_vehicle,_part,_hitpoint], 0, false, true];
s_player_repairActions set [count s_player_repairActions,_handle];
};
} count _hitpoints;
// Localized in A2OA\Expansion\dta\languagecore
_cancel = dayz_myCursorTarget addAction [localize "str_action_cancel_action", "\z\addons\dayz_code\actions\repair_cancel.sqf","repair", 0, true, false];
local _cancel = dayz_myCursorTarget addAction [localize "str_action_cancel_action", "\z\addons\dayz_code\actions\repair_cancel.sqf","repair", 0, true, false];
s_player_repairActions set [count s_player_repairActions,_cancel];
s_player_repair_crtl = 1;

View File

@@ -1,19 +1,37 @@
private ["_hits","_part","_color","_vehicle","_PlayerNear","_hitpoints","_hitpoint",
"_RemovedPartsArray","_damage","_cmpt","_configVeh","_damagePercent","_string","_handle","_cancel","_type"];
_vehicle = _this select 3;
local _vehicle = _this select 3;
dayz_myCursorTarget = _vehicle;
{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
_PlayerNear = {isPlayer _x} count ((getPosATL _vehicle) nearEntities ["CAManBase", 12]) > 1;
local _PlayerNear = {isPlayer _x} count ((getPosATL _vehicle) nearEntities ["CAManBase", 12]) > 1;
if (_PlayerNear) exitWith {dayz_myCursorTarget = objNull; localize "str_pickup_limit_5" call dayz_rollingMessages;};
_hitpoints = _vehicle call vehicle_getHitpoints;
local _hitpoints = _vehicle call vehicle_getHitpoints;
if (count _hitpoints < 1) exitwith {};
_type = typeOf _vehicle;
_RemovedPartsArray = ["motor","HitLF2Wheel","HitRF2Wheel","HitBody","HitMissiles","HitHull","HitVRotor","HitFuel","HitEngine"];
local _hitpoint = "";
local _damage = 0;
local _hits = [];
local _configVeh = "";
local _part = "";
local _damagePercent = "";
local _color = "";
local _cmpt = "";
local _string = "";
local _handle = 0;
local _isV3S = _vehicle isKindOf "V3S_Base";
local _isTatra = (_vehicle isKindOf "T810_DZE_Base_ACR" || _vehicle isKindOf "T810_Turrets_Base_ACR");
local _isMTVR = _vehicle isKindOf "MTVR";
local _wheelSwitchTruck = (_isV3S || _isTatra || _isMTVR);
local _isBTR60 = _vehicle isKindOf "BTR60_TK_EP1";
local _isBTR90 = _vehicle isKindOf "BTR90_Base";
local _isLAV25 = _vehicle isKindOf "LAV25_Base";
local _isRM70 = _vehicle isKindOf "RM70_ACR";
local _wheelSwitchAPC = (_isBTR60 || _isBTR90 || _isLAV25 || _isRM70);
local _RemovedPartsArray = ["motor","HitBody","HitMissiles","HitHull","HitVRotor","HitFuel","HitEngine"];
{
_hitpoint = _x;
@@ -26,6 +44,26 @@ _RemovedPartsArray = ["motor","HitLF2Wheel","HitRF2Wheel","HitBody","HitMissiles
_cmpt set [1,toArray ("-") select 0];
_cmpt set [2,20];
_cmpt = toString _cmpt;
call {
if (_wheelSwitchTruck) exitwith {
call {
if (['LMWheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - LBWheel";};
if (['LBWheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - LMWheel";};
if (['RMWheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - RBWheel";};
if (['RBWheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - RMWheel";};
};
};
if (_wheelSwitchAPC) exitwith {
call {
if (['LF2Wheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - LBWheel";};
if (['LBWheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - LF2Wheel";};
if (['RF2Wheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - RBWheel";};
if (['RBWheel',_cmpt] call fnc_inString) exitwith {_cmpt = " - RF2Wheel";};
};
};
};
_configVeh = configFile >> "cfgVehicles" >> "RepairParts" >> _hitpoint;
_part = getText(_configVeh >> "part");
if (_part == "") then {
@@ -57,7 +95,7 @@ _RemovedPartsArray = ["motor","HitLF2Wheel","HitRF2Wheel","HitBody","HitMissiles
} count _hitpoints;
if (count _hitpoints > 0 ) then {
_cancel = dayz_myCursorTarget addAction [localize "str_action_cancel_action", "\z\addons\dayz_code\actions\repair_cancel.sqf","repair", 0, true, false];
local _cancel = dayz_myCursorTarget addAction [localize "str_action_cancel_action", "\z\addons\dayz_code\actions\repair_cancel.sqf","repair", 0, true, false];
s_player_repairActions set [count s_player_repairActions,_cancel];
s_player_repair_crtl = 1;
};
};

File diff suppressed because one or more lines are too long