Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private ["_part","_cancel","_color","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints","_damagePercent","_configVeh","_x"];
- _vehicle = cursorTarget;
- {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
- dayz_myCursorTarget = _vehicle;
- _isInvalid = (cursorTarget isKindOf "Old_bike_TK_INS_EP1" || cursorTarget isKindOf "Old_bike_TK_CIV_EP1");
- if (!_isInvalid) then {
- _hitpoints = _vehicle call vehicle_getHitpoints;
- {
- _damage = [_vehicle,_x] call object_getHit;
- _part = "PartGeneric";
- _cmpt = toArray (_x);
- _cmpt set [0,20];
- _cmpt set [1,toArray ("-") select 0];
- _cmpt set [2,20];
- _cmpt = toString _cmpt;
- _skip = true;
- //restrict what parts can be taken off the vehicle
- if( _skip and _x == "HitLFWheel" ) then {
- _skip = false; _part = "PartWheel";
- };
- if( _skip and _x == "HitRFWheel" ) then{
- _skip = false; _part = "PartWheel";
- };
- if( _skip and _x == "HitLBWheel" ) then {
- _skip = false; _part = "PartWheel";
- };
- if( _skip and _x == "HitRBWheel" ) then {
- _skip = false; _part = "PartWheel";
- };
- if( _skip and _x == "HitGlass1" ) then {
- _skip = false; _part = "PartGlass";
- };
- if( _skip and _x == "HitGlass2" ) then {
- _skip = false; _part = "PartGlass";
- };
- if( _skip and _x == "HitGlass3" ) then {
- _skip = false; _part = "PartGlass";
- };
- if( _skip and _x == "HitGlass4" ) then {
- _skip = false; _part = "PartGlass";
- };
- if( _skip and _x == "HitGlass5" ) then {
- _skip = false; _part = "PartGlass";
- };
- if( _skip and _x == "HitGlass6" ) then {
- _skip = false; _part = "PartGlass";
- };
- if( _skip and _x == "HitHRotor" ) then {
- _skip = false; _part = "PartVRotor";
- };
- if( _skip and _x == "HitEngine" ) then {
- _skip = false; _part = "PartEngine";
- };
- if( _skip and _x == "HitFueltank" ) then {
- _skip = false; _part = "PartFueltank";
- };
- if (!_skip ) then {
- //get every damaged part no matter how tiny damage is!
- _damagePercent = str(round((1 - _damage) * 100))+"%";
- if (_damage < 0.11) then { //allow only parts < 10% damage to be salvaged
- _color = "color='#ffff00'"; //yellow
- _string = format[localize "str_actions_repair_01",_cmpt,_damagePercent];
- _string = format["<t %1>%2</t>",_color,_string,_damage]; //Remove - Part
- _handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\salvage.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
- s_player_repairActions set [count s_player_repairActions,_handle];
- };
- };
- } forEach _hitpoints;
- if (count _hitpoints > 0 ) then {
- _cancel = dayz_myCursorTarget addAction [localize "str_actions_cancel", "\z\addons\dayz_code\actions\salvage_cancel.sqf","salvage", 0, true, false, "",""];
- s_player_repairActions set [count s_player_repairActions,_cancel];
- s_player_repair_crtl = 1;
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement