mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-24 09:29:21 +03:00
Update Repair and Salvage
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
private ["_array","_vehicle","_part","_hitpoint","_type","_nameType","_namePart","_damage","_selection","_dis","_sfx","_hitpoints","_allFixed","_finished"];
|
||||
|
||||
private ["_id","_hits","_array","_vehicle","_part","_hitpoint","_type","_nameType","_namePart","_damage","_selection","_dis","_sfx","_finished"];
|
||||
|
||||
_id = _this select 2;
|
||||
_array = _this select 3;
|
||||
@@ -9,7 +10,6 @@ _part = _array select 1;
|
||||
_hitpoint = _array select 2;
|
||||
_type = typeOf _vehicle;
|
||||
|
||||
|
||||
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
|
||||
dayz_myCursorTarget = objNull;
|
||||
|
||||
@@ -19,14 +19,14 @@ dayz_myCursorTarget = objNull;
|
||||
_nameType = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
|
||||
_namePart = getText(configFile >> "cfgMagazines" >> _part >> "displayName");
|
||||
|
||||
if ("ItemToolbox" in items player && (_part in magazines player)) then {
|
||||
if ("ItemToolbox" in items player && {_part in magazines player}) then {
|
||||
_dis=20;
|
||||
_sfx = "repair";
|
||||
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
|
||||
[player,_dis,true,(getPosATL player)] call player_alertZombies;
|
||||
|
||||
|
||||
_finished = ["Medic",1] call fn_loopAction;
|
||||
|
||||
|
||||
// Check again to make sure player did not drop item
|
||||
if (!_finished or !(_part in magazines player)) exitWith {};
|
||||
player removeMagazine _part;
|
||||
@@ -54,4 +54,4 @@ if ("ItemToolbox" in items player && (_part in magazines player)) then {
|
||||
} else {
|
||||
format[localize "str_player_03",_namePart] call dayz_rollingMessages;
|
||||
};
|
||||
dayz_actionInProgress = false;
|
||||
dayz_actionInProgress = false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
private ["_part","_cancel","_color","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints","_damagePercent","_configVeh","_hitpoint"];
|
||||
private ["_part","_cancel","_color","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints","_damagePercent","_configVeh","_hitpoint","_hits"];
|
||||
|
||||
_vehicle = _this select 3;
|
||||
{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
|
||||
@@ -8,16 +8,16 @@ _hitpoints = _vehicle call vehicle_getHitpoints;
|
||||
|
||||
{
|
||||
_hitpoint = _x;
|
||||
_hits = [_vehicle,_x] call object_getHit;
|
||||
_hits = [_vehicle,_hitpoint] call object_getHit;
|
||||
_damage = _hits select 0;
|
||||
|
||||
_cmpt = toArray (_x);
|
||||
_cmpt = toArray (_hitpoint);
|
||||
_cmpt set [0,20];
|
||||
_cmpt set [1,toArray ("-") select 0];
|
||||
_cmpt set [2,20];
|
||||
_cmpt = toString _cmpt;
|
||||
|
||||
_configVeh = configFile >> "cfgVehicles" >> "RepairParts" >> _x;
|
||||
_configVeh = configFile >> "cfgVehicles" >> "RepairParts" >> _hitpoint;
|
||||
_part = getText(_configVeh >> "part");
|
||||
if (_part == "") then {
|
||||
_part = "PartGeneric";
|
||||
@@ -27,27 +27,27 @@ _hitpoints = _vehicle call vehicle_getHitpoints;
|
||||
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"]];
|
||||
} count [["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";
|
||||
if (_damage > 0) then {
|
||||
_color = switch true do {
|
||||
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
|
||||
_color = call {
|
||||
if (_damage <= 0.25) exitwith {"color='#00ff00'"}; //green
|
||||
if (_damage <= 0.50) exitwith {"color='#ffff00'"}; //yellow
|
||||
if (_damage <= 0.75) exitwith {"color='#ff8800'"}; //orange
|
||||
"color='#ff0000'" //red
|
||||
};
|
||||
|
||||
|
||||
_cmpt = format[localize "str_actions_medical_09",_cmpt,_damagePercent];
|
||||
|
||||
_string = format["<t %1>%2</t>",_color,_cmpt]; //Repair - Part
|
||||
_handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\repair.sqf",[_vehicle,_part,_x], 0, false, true];
|
||||
_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];
|
||||
};
|
||||
|
||||
} forEach _hitpoints;
|
||||
} count _hitpoints;
|
||||
|
||||
if (count _hitpoints > 0) then {
|
||||
// Localized in A2OA\Expansion\dta\languagecore
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
private ["_array","_vehicle","_part","_hitpoint","_type","_isOK","_brokenPart","_finished","_hasToolbox","_nameType","_namePart","_damage","_BreakableParts","_selection","_wpn","_classname","_ismelee"];
|
||||
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
private ["_array","_vehicle","_part","_hitpoint","_type","_isOK","_brokenPart","_finished","_hasToolbox","_nameType","_namePart","_damage","_BreakableParts","_selection","_wpn","_hits","_ismelee"];
|
||||
|
||||
_array = _this select 3;
|
||||
_vehicle = _array select 0;
|
||||
_part = _array select 1;
|
||||
_hitpoint = _array select 2;
|
||||
_type = typeOf _vehicle;
|
||||
_type = typeOf _vehicle;
|
||||
_isOK = false;
|
||||
_brokenPart = false;
|
||||
_hasToolbox = "ItemToolbox" in items player;
|
||||
@@ -21,7 +21,7 @@ s_player_repair_crtl = 1;
|
||||
|
||||
if (_hasToolbox) then {
|
||||
if ([_vehicle] call DZE_SafeZonePosCheck) exitWith {(localize "str_salvage_safezone") call dayz_rollingMessages;};
|
||||
|
||||
|
||||
[player,"repair",0,false] call dayz_zombieSpeak;
|
||||
[player,50,true,(getPosATL player)] call player_alertZombies;
|
||||
|
||||
@@ -43,11 +43,11 @@ if (_hasToolbox) then {
|
||||
_isOK = [player,_part] call BIS_fnc_invAdd;
|
||||
_brokenPart = false;
|
||||
};
|
||||
} else {
|
||||
} else {
|
||||
_isOK = [player,_part] call BIS_fnc_invAdd;
|
||||
_brokenPart = false;
|
||||
};
|
||||
|
||||
|
||||
if (_isOK) then {
|
||||
_selection = _hits select 1;
|
||||
/*if ((_hitpoint == "HitEngine") or (_hitpoint == "HitFuel")) then {
|
||||
@@ -80,7 +80,6 @@ dayz_actionInProgress = false;
|
||||
|
||||
//adding melee mags back if needed
|
||||
_wpn = primaryWeapon player;
|
||||
//diag_log format["Classname: %1, WPN: %2", _classname,_wpn];
|
||||
_ismelee = (getNumber (configFile >> "CfgWeapons" >> _wpn >> "melee") == 1);
|
||||
if (_ismelee) then {
|
||||
call dayz_meleeMagazineCheck;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private ["_part","_color","_vehicle","_PlayerNear","_hitpoints","_isATV","_is6WheelType","_HasNoGlassKind","_hitpoint",
|
||||
"_6WheelTypeArray","_NoGlassArray","_NoExtraWheelsArray","_RemovedPartsArray","_damage","_cmpt","_configVeh","_damagePercent","_string","_handle","_cancel","_type"];
|
||||
private ["_isMotorcycle","_hits","_part","_color","_vehicle","_PlayerNear","_hitpoints","_is6WheelType","_hitpoint",
|
||||
"_6WheelTypeArray","_NoGlassArray","_RemovedPartsArray","_damage","_cmpt","_configVeh","_damagePercent","_string","_handle","_cancel","_type"];
|
||||
|
||||
_vehicle = _this select 3;
|
||||
{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
|
||||
@@ -11,47 +11,47 @@ dayz_myCursorTarget = _vehicle;
|
||||
_hitpoints = _vehicle call vehicle_getHitpoints;
|
||||
|
||||
_type = typeOf _vehicle;
|
||||
_isATV = _type in ["ATV_US_EP1","ATV_CZ_EP1"];
|
||||
_isMotorcycle = _vehicle isKindOf "Motorcycle";
|
||||
_is6WheelType = false;
|
||||
{if (_type isKindOf _x) exitWith {_is6WheelType = true;};} count ["Kamaz_Base","MTVR","Ural_Base","Ural_Base_withTurret","V3S_Base"];
|
||||
_HasNoGlassKind = (_vehicle isKindOf "Motorcycle");
|
||||
|
||||
{
|
||||
if (_type isKindOf _x) exitWith {
|
||||
_is6WheelType = true;
|
||||
};
|
||||
} count ["Kamaz_Base","MTVR","Ural_Base","Ural_Base_withTurret","V3S_Base","T810_DZE_Base_ACR"];
|
||||
|
||||
_6WheelTypeArray = ["HitLMWheel","HitRMWheel"];
|
||||
_NoGlassArray = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitLGlass","HitRGlass"];
|
||||
_NoExtraWheelsArray = ["wheel_1_4_steering","wheel_2_4_steering","wheel_1_3_steering","wheel_2_3_steering"];
|
||||
_RemovedPartsArray = ["motor","HitLF2Wheel","HitRF2Wheel","HitBody","HitMissiles","HitHull","HitVRotor","HitFuel","HitEngine"];
|
||||
|
||||
if (_isATV or _HasNoGlassKind) then {
|
||||
_hitpoints = _hitpoints - _NoGlassArray;
|
||||
};
|
||||
if (!_is6WheelType) then {
|
||||
if ((_vehicle isKindOf "ATV_Base_EP1") || {_isMotorcycle}) then {
|
||||
_hitpoints = _hitpoints - _NoGlassArray;
|
||||
|
||||
if (_vehicle isKindOf "tractor") then {
|
||||
_hitpoints = _hitpoints - ["motor","HitLFWheel","HitRFWheel","HitLBWheel","HitRBWheel","HitLF2Wheel","HitRF2Wheel","HitLMWheel","HitRMWheel"];
|
||||
};
|
||||
if (_isMotorcycle) then {
|
||||
_hitpoints = _hitpoints - ["HitEngine","HitFuel"];
|
||||
};
|
||||
};
|
||||
|
||||
if (_vehicle isKindOf "Motocycle") then {
|
||||
_hitpoints = _hitpoints - ["HitEngine","HitFuel"];
|
||||
};
|
||||
if (_vehicle isKindOf "tractor") then {
|
||||
_hitpoints = _hitpoints - ["motor","HitLFWheel","HitRFWheel","HitLBWheel","HitRBWheel","HitLF2Wheel","HitRF2Wheel","HitLMWheel","HitRMWheel"];
|
||||
};
|
||||
|
||||
if (_is6WheelType) then {
|
||||
_hitpoints = _hitpoints + _6WheelTypeArray;
|
||||
} else {
|
||||
_hitpoints = _hitpoints - _6WheelTypeArray;
|
||||
};
|
||||
|
||||
{
|
||||
_hitpoint = _x;
|
||||
_hits = [_vehicle,_x] call object_getHit;
|
||||
_hits = [_vehicle,_hitpoint] call object_getHit;
|
||||
_damage = _hits select 0;
|
||||
if !(_x in _RemovedPartsArray) then {
|
||||
if !(_hitpoint in _RemovedPartsArray) then {
|
||||
//if (_x in ["HitFuel","HitEngine"] && _damage >= 0.89) then {_damage = 1;};
|
||||
_cmpt = toArray (_x);
|
||||
_cmpt = toArray (_hitpoint);
|
||||
_cmpt set [0,20];
|
||||
_cmpt set [1,toArray ("-") select 0];
|
||||
_cmpt set [2,20];
|
||||
_cmpt = toString _cmpt;
|
||||
|
||||
_configVeh = configFile >> "cfgVehicles" >> "RepairParts" >> _x;
|
||||
_configVeh = configFile >> "cfgVehicles" >> "RepairParts" >> _hitpoint;
|
||||
_part = getText(_configVeh >> "part");
|
||||
if (_part == "") then {
|
||||
_part = "PartGeneric";
|
||||
@@ -61,29 +61,29 @@ if (_is6WheelType) then {
|
||||
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"]];
|
||||
} count [["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";
|
||||
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.25): {"color='#00ff00'"}; //green
|
||||
case (_damage <= 0.50): {"color='#ffff00'"}; //yellow
|
||||
case (_damage <= 0.75): {"color='#ff8800'"}; //orange
|
||||
default {"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 = call {
|
||||
if (_damage <= 0.25) exitWith {"color='#00ff00'"}; //green
|
||||
if (_damage <= 0.50) exitWith {"color='#ffff00'"}; //yellow
|
||||
if (_damage <= 0.75) exitWith {"color='#ff8800'"}; //orange
|
||||
"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];
|
||||
_handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\salvage.sqf",[_vehicle,_part,_hitpoint], 0, false, true];
|
||||
s_player_repairActions set [count s_player_repairActions,_handle];
|
||||
};
|
||||
};
|
||||
} forEach _hitpoints;
|
||||
} count _hitpoints;
|
||||
|
||||
if (count _hitpoints > 0 ) then {
|
||||
// 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];
|
||||
s_player_repairActions set [count s_player_repairActions,_cancel];
|
||||
s_player_repair_crtl = 1;
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user