Fix undefined color error in salvage_vehicle.sqf

Color was undefined if part damage was in any of these ranges:
0.2501 - 0.2599
0.5001 - 0.5999
0.7501 - 0.7599

Fixes related RPT errors:
Unknown attribute any>Remove
Unknown attribute -
Unknown attribute LFWheel
Unknown attribute (76%
Unknown attribute Damage)</t>
This commit is contained in:
ebaydayz
2016-12-07 18:50:01 -05:00
parent a60c1931ee
commit f92b751ae3
2 changed files with 9 additions and 5 deletions

View File

@@ -9,5 +9,7 @@
[FIXED] Issue where Arma cheats could still be entered under certain conditions without pressing LeftShift at the same time as NumPadMinus. @ebayShopper
[FIXED] Tag friendly still showing after player accepts and related issue with BackpackAntiTheft. #1807 @oiad
[FIXED] Undefined variable dayz_clientPreload error on main menu during intro.sqs. #1810 @ndavalos @ebayShopper
[FIXED] Giving pain killers to another player no longer removes pain from the player giving the pain killers.
[FIXED] Occasional undefined error for text color attribute when salvaging vehicles. @ebayShopper
[INFO] See Documents\CHANGE LOG 1.0.6.txt for the full list of 1.0.5.1 --> 1.0.6 changes.

View File

@@ -56,11 +56,13 @@ if (_is6WheelType) then {
//get every damaged part no matter how tiny damage is!
_damagePercent = str(round(_damage * 100))+"% Damage";
if (_damage < 1 && {_damage > 0}) then { //Tempfix for issue where certain hitpoints on some vehicles do not get damaged and allow infinite removal
if ((_damage >= 0) and (_damage <= 0.25)) then {_color = "color='#00ff00'";}; //green
if ((_damage >= 0.26) and (_damage <= 0.50)) then {_color = "color='#ffff00'";}; //yellow
if ((_damage >= 0.51) and (_damage <= 0.75)) then {_color = "color='#ff8800'";}; //orange
if ((_damage >= 0.76) and (_damage <= 1)) then {_color = "color='#ff0000'";}; //red
if (_damage < 1 && _damage > 0) then { //Tempfix for issue where certain hitpoints on some vehicles do not get damaged and allow infinite removal
_color = switch true do {
case (_damage >= 0 && _damage <= 0.25): {"color='#00ff00'"}; //green
case (_damage > 0.25 && _damage <= 0.50): {"color='#ffff00'"}; //yellow
case (_damage > 0.50 && _damage <= 0.75): {"color='#ff8800'"}; //orange
case (_damage > 0.75 && _damage <= 1): {"color='#ff0000'"}; //red
};
_string = format[localize "str_actions_repair_01",_cmpt,_damagePercent];
_string = format["<t %1>%2</t>",_color,_string]; //Remove - Part
_handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\salvage.sqf",[_vehicle,_part,_x], 0, false, true];