From 64375383f1ec5ca4b04c8cf6bb22a30865691310 Mon Sep 17 00:00:00 2001 From: A Man Date: Wed, 13 May 2020 01:23:23 +0200 Subject: [PATCH] Make shovel and etool equal in dze_requiredItemsCheck --- .../compile/dze_requiredItemsCheck.sqf | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/SQF/dayz_code/compile/dze_requiredItemsCheck.sqf b/SQF/dayz_code/compile/dze_requiredItemsCheck.sqf index 84ea34042..79daf8931 100644 --- a/SQF/dayz_code/compile/dze_requiredItemsCheck.sqf +++ b/SQF/dayz_code/compile/dze_requiredItemsCheck.sqf @@ -1,4 +1,4 @@ -private ["_missingText","_hasrequireditem","_hastoolweapon","_item","_require","_missing","_text","_classname","_hasbuilditem","_items","_melee","_weapons","_weapon"]; +private ["_missingText","_hasrequireditem","_hastoolweapon","_item","_require","_missing","_text","_classname","_hasbuilditem","_items","_melee","_weapons","_weapon","_shovels"]; _item = _this select 0; _require = _this select 1; @@ -7,6 +7,7 @@ _missing = []; _missingText = ""; _hasrequireditem = true; _text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName"); +_shovels = ["ItemShovel","ItemEtool"]; _items = items player; _weapons = weapons player; @@ -14,14 +15,19 @@ _weapons = weapons player; _weapon = _x; _hastoolweapon = _x in _weapons; - if (_x == "ItemKnife") then { - {if (_x in Dayz_Gutting) exitWith {_hastoolweapon = true};} count _items; - }; - if (_x == "ItemMatchbox") then { - {if (_x in DayZ_Ignitors) exitWith {_hastoolweapon = true};} count _items; - }; - if (_x == "ChainSaw") then { - {if (_x in ["ChainSaw","ChainSawB","ChainSawG","ChainSawG","ChainSawR"]) exitWith {_hastoolweapon = true};} count _weapons; + call { + if (_x == "ItemKnife") exitWith { + {if (_x in Dayz_Gutting) exitWith {_hastoolweapon = true};} count _items; + }; + if (_x == "ItemMatchbox") exitWith { + {if (_x in DayZ_Ignitors) exitWith {_hastoolweapon = true};} count _items; + }; + if (_x == "ChainSaw") exitWith { + {if (_x in ["ChainSaw","ChainSawB","ChainSawG","ChainSawG","ChainSawR"]) exitWith {_hastoolweapon = true};} count _weapons; + }; + if (_x == "ItemShovel" || _x == "ItemEtool") exitWith { + {if (_x in _shovels) exitWith {_hastoolweapon = true};} count _items; + }; }; { @@ -32,7 +38,15 @@ _weapons = weapons player; } count ["Crowbar","Hatchet","Sledge"]; if (!_hastoolweapon) then { - _missingText = getText (configFile >> "cfgWeapons" >> _x >> "displayName"); + if (_x in _shovels) then { + private ["_shovel", "_etool"]; + + _shovel = getText (configFile >> "cfgWeapons" >> "ItemShovel" >> "displayName"); + _etool = getText (configFile >> "cfgWeapons" >> "ItemEtool" >> "displayName"); + _missingText = format[localize "STR_CRAFTING_NEEDED_TOOLS_SHOVEL_ETOOL",_shovel,_etool]; + } else { + _missingText = getText (configFile >> "cfgWeapons" >> _x >> "displayName"); + }; _missing set [count _missing, _missingText]; _hasrequireditem = false; }; @@ -43,16 +57,12 @@ _missingText = ""; if (_forEachIndex == 0) then { _missingText = _x; } else { - if (_forEachIndex == ((count _missing) - 1)) then { - _missingText = _missingText + ", " + _x; - } else { - _missingText = _missingText + ", " + _x; - }; + _missingText = _missingText + ", " + _x; }; } forEach _missing; _hasbuilditem = _item in magazines player; -if (!_hasbuilditem && {_text != ""}) exitWith {dayz_actionInProgress = false; format[localize "str_player_31",_text,"build"] call dayz_rollingMessages; false;}; +if (_item != "" && {!_hasbuilditem} && {_text != ""}) exitWith {dayz_actionInProgress = false; format[localize "str_player_31",_text,"build"] call dayz_rollingMessages; false;}; if (!_hasrequireditem) exitWith { dayz_actionInProgress = false; systemChat format[localize "str_epoch_player_137",_missingText];