Toggle for salvaging from locked vehicles (#1757)

* Toggle for salvaging from locked vehicles

This adds the ability to remove salvaging from locked vehicles which
helps avoid griefing
Fixes a spelling mistake for a localization string
Makes it possible to salvage 0% damaged items again, this was disabled
as per
3292d84b85
I've had this running on my server for a year or so with no issues (not
that it doesn't affect it, i've just never seen it)

* Toggle salvagable locked vehicles changers

@ebaydayz fixed
This commit is contained in:
oiad
2016-09-09 09:32:27 +12:00
committed by ebaydayz
parent 4731780f5a
commit 51f85acb9e
5 changed files with 21 additions and 15 deletions

View File

@@ -35,9 +35,8 @@ _hitpoints = _vehicle call vehicle_getHitpoints;
} forEach _hitpoints;
if (count _hitpoints > 0 ) then {
//ArmA OA String
if (count _hitpoints > 0) then {
_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;
};
};

View File

@@ -1,9 +1,7 @@
private ["_part","_color","_vehicle","_PlayerNear","_hitpoints","_isATV","_is6WheelType","_HasNoGlassKind",
"_6WheelTypeArray","_NoGlassArray","_NoExtraWheelsArray","_RemovedPartsArray","_damage","_cmpt","_configVeh","_damagePercent","_string","_handle","_cancel","_type","_isBicycle"];
"_6WheelTypeArray","_NoGlassArray","_NoExtraWheelsArray","_RemovedPartsArray","_damage","_cmpt","_configVeh","_damagePercent","_string","_handle","_cancel","_type"];
_vehicle = _this select 3;
_isBicycle = _vehicle isKindOf "Bicycle";
if (_isBicycle) exitWith {}; // No salvage for now. Bicycle wheels should not give full size tires. Also model does not update to show removed wheels.
{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
_PlayerNear = {isPlayer _x} count ((getPosATL _vehicle) nearEntities ["CAManBase", 10]) > 1;
@@ -16,7 +14,7 @@ _type = typeOf _vehicle;
_isATV = _type in ["ATV_US_EP1","ATV_CZ_EP1"];
_is6WheelType = false;
{if (_type isKindOf _x) exitWith {_is6WheelType = true;};} count ["Kamaz_Base","MTVR","Ural_Base","Ural_Base_withTurret","V3S_Base"];
_HasNoGlassKind = (_vehicle isKindOf "Motorcycle") or _isBicycle;
_HasNoGlassKind = (_vehicle isKindOf "Motorcycle");
_6WheelTypeArray = ["HitLMWheel","HitRMWheel"];
_NoGlassArray = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitLGlass","HitRGlass"];
@@ -31,7 +29,7 @@ if (_vehicle isKindOf "tractor") then {
_hitpoints = _hitpoints - ["motor","HitLFWheel","HitRFWheel","HitLBWheel","HitRBWheel","HitLF2Wheel","HitRF2Wheel","HitLMWheel","HitRMWheel"];
};
if (_isBicycle or (_vehicle isKindOf "Motocycle")) then {
if (_vehicle isKindOf "Motocycle") then {
_hitpoints = _hitpoints - ["HitEngine","HitFuel"];
};
@@ -71,8 +69,7 @@ if (_is6WheelType) then {
} forEach _hitpoints;
if (count _hitpoints > 0 ) then {
//ArmA OA String
_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;
};
};

View File

@@ -552,10 +552,19 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
if (_isVehicle && {!_isMan} && {dayz_myCursorTarget != _cursorTarget} && {_hasToolbox} && {damage _cursorTarget < 1} && {_typeOfCursorTarget != "M240Nest_DZ"}) then {
if (s_player_repair_crtl < 0) then {
dayz_myCursorTarget = _cursorTarget;
_menu = dayz_myCursorTarget addAction [localize "str_actions_rapairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false];
_menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false];
_menu = dayz_myCursorTarget addAction [localize "str_actions_repairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false];
if (!_isBicycle) then {
if (!DZE_salvageLocked) then {
if (!locked _cursorTarget) then {
_menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false];
s_player_repairActions set [count s_player_repairActions,_menu1];
};
} else {
_menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false];
s_player_repairActions set [count s_player_repairActions,_menu1];
};
};
s_player_repairActions set [count s_player_repairActions,_menu];
s_player_repairActions set [count s_player_repairActions,_menu1];
s_player_repair_crtl = 1;
} else {
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;

View File

@@ -42,6 +42,7 @@ DZE_SafeZonePosArray = []; //Prevent players in safeZones from being killed if t
DZE_GemOccurance = [["ItemTopaz",10], ["ItemObsidian",8], ["ItemSapphire",6], ["ItemAmethyst",4], ["ItemEmerald",3], ["ItemCitrine",2], ["ItemRuby",1]]; //Sets how rare each gem is in the order shown when mining (whole numbers only)
DZE_GodModeBaseExclude = []; //Array of object class names excluded from the god mode bases feature
DZE_groupManagement = false; //Enable or disable group management. Enabled by default
DZE_salvageLocked = false; //Enable or disable salvaging of locked vehicles, useful for stopping griefing on locked vehicles.
// Trader Menu
dayz_sellDistance_vehicle = 10; // Max distance players can sell land vehicles from at traders
@@ -108,4 +109,4 @@ DZE_doorManagementAllowManage_doorAdmins = true;
Variables that are map specific or frequently changed should be included in init.sqf by default
with a corresponding if(isNil)then{}; in variables.sqf.
*/
*/

View File

@@ -653,7 +653,7 @@
<French>Réparer%1 (%2)</French>
<Czech>Opravit%1 (%2)</Czech>
</Key>
<Key ID="str_actions_rapairveh">
<Key ID="str_actions_repairveh">
<English>Repair Vehicle</English>
<Spanish>Reparar Vehículo</Spanish>
<Russian>Отремонтировать транспорт</Russian>