Use faster switch in repair and salvage

7496ef5d5c (commitcomment-20292237)
This commit is contained in:
ebaydayz
2016-12-25 17:51:32 -05:00
parent 1d0a1bf9a2
commit b962bd50b9
2 changed files with 8 additions and 8 deletions

View File

@@ -23,10 +23,10 @@ _hitpoints = _vehicle call vehicle_getHitpoints;
_damagePercent = str(round(_damage * 100))+"% Damage";
if (_damage > 0) then {
_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
case (_damage <= 0.25): {"color='#00ff00'"}; //green
case (_damage <= 0.50): {"color='#ffff00'"}; //yellow
case (_damage <= 0.75): {"color='#ff8800'"}; //orange
default {"color='#ff0000'"}; //red
};
_cmpt = format[localize "str_actions_medical_09",_cmpt,_damagePercent];

View File

@@ -58,10 +58,10 @@ if (_is6WheelType) then {
_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
_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
case (_damage <= 0.25): {"color='#00ff00'"}; //green
case (_damage <= 0.50): {"color='#ffff00'"}; //yellow
case (_damage <= 0.75): {"color='#ff8800'"}; //orange
default {"color='#ff0000'"}; //red
};
_string = format[localize "str_actions_repair_01",_cmpt,_damagePercent];
_string = format["<t %1>%2</t>",_color,_string]; //Remove - Part