Add back 1051 handling of RepairParts not listed in config

This commit is contained in:
ebaydayz
2017-01-06 12:36:08 -05:00
parent c5deead4fd
commit 3a7744d18d
4 changed files with 31 additions and 6 deletions

View File

@@ -126,4 +126,10 @@ class RepairParts : AllVehicles
class HitHull {
part = "PartGeneric";
};
class HitLTrack {
part = "PartGeneric";
};
class HitRTrack {
part = "PartGeneric";
};
};

View File

@@ -1,4 +1,4 @@
private ["_part","_cancel","_color","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints","_damagePercent","_configVeh"];
private ["_part","_cancel","_color","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints","_damagePercent","_configVeh","_hitpoint"];
_vehicle = _this select 3;
{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
@@ -7,6 +7,7 @@ dayz_myCursorTarget = _vehicle;
_hitpoints = _vehicle call vehicle_getHitpoints;
{
_hitpoint = _x;
_damage = [_vehicle,_x] call object_getHit;
_cmpt = toArray (_x);
@@ -17,7 +18,16 @@ _hitpoints = _vehicle call vehicle_getHitpoints;
_configVeh = configFile >> "cfgVehicles" >> "RepairParts" >> _x;
_part = getText(_configVeh >> "part");
if (_part == "") then { _part = "PartGeneric"; };
if (_part == "") then {
_part = "PartGeneric";
// Handle parts not listed in RepairParts config.
// Additional vehicle addons may be loaded with non-standard hitpoint names.
{
if ([(_x select 0),_hitpoint] call fnc_inString) then {
_part = format["Part%1",(_x select 1)];
};
} forEach [["Engine","Engine"],["HRotor","VRotor"],["Fuel","Fueltank"],["Wheel","Wheel"],["Glass","Glass"]];
};
// get every damaged part no matter how tiny damage is!
_damagePercent = str(round(_damage * 100))+"% Damage";

View File

@@ -1,4 +1,4 @@
private ["_part","_color","_vehicle","_PlayerNear","_hitpoints","_isATV","_is6WheelType","_HasNoGlassKind",
private ["_part","_color","_vehicle","_PlayerNear","_hitpoints","_isATV","_is6WheelType","_HasNoGlassKind","_hitpoint",
"_6WheelTypeArray","_NoGlassArray","_NoExtraWheelsArray","_RemovedPartsArray","_damage","_cmpt","_configVeh","_damagePercent","_string","_handle","_cancel","_type"];
_vehicle = _this select 3;
@@ -40,6 +40,7 @@ if (_is6WheelType) then {
};
{
_hitpoint = _x;
_damage = [_vehicle,_x] call object_getHit;
if !(_x in _RemovedPartsArray) then {
@@ -52,7 +53,16 @@ if (_is6WheelType) then {
_configVeh = configFile >> "cfgVehicles" >> "RepairParts" >> _x;
_part = getText(_configVeh >> "part");
if (_part == "") then { _part = "PartGeneric"; };
if (_part == "") then {
_part = "PartGeneric";
// Handle parts not listed in RepairParts config.
// Additional vehicle addons may be loaded with non-standard hitpoint names.
{
if ([(_x select 0),_hitpoint] call fnc_inString) then {
_part = format["Part%1",(_x select 1)];
};
} forEach [["Engine","Engine"],["HRotor","VRotor"],["Fuel","Fueltank"],["Wheel","Wheel"],["Glass","Glass"]];
};
//get every damaged part no matter how tiny damage is!
_damagePercent = str(round(_damage * 100))+"% Damage";