Fix light fire and build fireplace over water #1866

Fixes #1866
This commit is contained in:
ebaydayz
2017-01-11 15:25:29 -05:00
parent b9d8b5798c
commit f25f5e96a6
10 changed files with 62 additions and 46 deletions

View File

@@ -1,4 +1,4 @@
private ["_missingText","_hasrequireditem","_hastoolweapon","_item","_require","_missing","_text","_classname","_hasbuilditem"];
private ["_missingText","_hasrequireditem","_hastoolweapon","_item","_require","_missing","_text","_classname","_hasbuilditem","_items","_melee","_weapons","_weapon"];
_item = _this select 0;
_require = _this select 1;
@@ -7,16 +7,34 @@ _missing = [];
_missingText = "";
_hasrequireditem = true;
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_items = items player;
_weapons = weapons player;
{
_hastoolweapon = _x in weapons player;
_weapon = _x;
_hastoolweapon = _x in _weapons;
if (_x == "ItemKnife") then {
{if (_x in Dayz_Gutting) exitWith {_hastoolweapon = true};} forEach _items;
};
if (_x == "ItemMatchbox") then {
{if (_x in DayZ_Ignitors) exitWith {_hastoolweapon = true};} forEach _items;
};
{
_melee = format ["Melee%1",_x];
if (_weapon == format["Item%1",_x] && {(_melee in _weapons) or (dayz_onBack == _melee)}) then {
_hastoolweapon = true;
};
} forEach ["Crowbar","Hatchet","Sledge"];
if (!_hastoolweapon) then {
_missingText = getText (configFile >> "cfgWeapons" >> _x >> "displayName");
_missing set [count _missing, _missingText];
_hasrequireditem = false;
};
} forEach _require;
_missingText = "";
_missingText = "";
{
if (_forEachIndex == 0) then {
_missingText = _x;
@@ -30,7 +48,7 @@ _missingText = "";
} forEach _missing;
_hasbuilditem = _item in magazines player;
if (!_hasbuilditem) exitWith {dayz_actionInProgress = false; format[localize "str_player_31",_text,"build"] call dayz_rollingMessages; false;};
if (!_hasbuilditem && _text != "") exitWith {dayz_actionInProgress = false; format[localize "str_player_31",_text,"build"] call dayz_rollingMessages; false;};
if (!_hasrequireditem) exitWith {dayz_actionInProgress = false; format[localize "str_epoch_player_137",_missingText] call dayz_rollingMessages; false;};
//When calling this function in another script use a silent exitWith, unless you have something special to say. i.e. if (!_hasrequireditem) exitWith{};