From 916f1733eb8058dd6f41240330def96625bcc015 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Thu, 13 Oct 2016 20:26:07 -0400 Subject: [PATCH] Add back melee ammo after removal for BIS_fnc_inv Vanilla commit: https://github.com/DayZMod/DayZ/commit/516d1d538c99becacda91c16e617d3df0a8ffc71 --- SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp | 8 ++++---- SQF/dayz_code/actions/object_pickup.sqf | 4 ++-- SQF/dayz_code/actions/player_Constructionitem.sqf | 4 ++-- SQF/dayz_code/actions/player_buildingDowngrade.sqf | 3 ++- SQF/dayz_code/actions/player_craftItemVanilla.sqf | 3 ++- SQF/dayz_code/actions/player_craftitemGUI.sqf | 3 ++- SQF/dayz_code/actions/player_harvestPlant.sqf | 3 ++- SQF/dayz_code/actions/player_removeAttachment.sqf | 4 +++- SQF/dayz_code/actions/player_tearClothes.sqf | 5 +++-- SQF/dayz_code/actions/salvage.sqf | 3 ++- SQF/dayz_code/compile/epoch_generateKey.sqf | 4 ++-- SQF/dayz_code/compile/fn_addDuplicateTool.sqf | 3 ++- SQF/dayz_code/system/player_monitor.fsm | 1 - 13 files changed, 28 insertions(+), 20 deletions(-) diff --git a/SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp b/SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp index cde641e04..d37c769d2 100644 --- a/SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp +++ b/SQF/dayz_code/Configs/RscDisplay/RscDisplayGear.hpp @@ -4,8 +4,8 @@ class RscDisplayGear enableDisplay = 1; movingEnable = 0; - //onLoad = "[] spawn object_monitorGear; {player removeMagazines _x} count MeleeMagazines; call gear_ui_init; call ui_gear_sound; if (isNil('IGUI_GEAR_activeFilter')) then { IGUI_GEAR_activeFilter = 0;}; [_this,'onLoad'] execVM '\z\addons\dayz_code\system\handleGear.sqf'";/* diag_log 'RscDisplayGear : : onLoad'; */ - //onUnload = "{player removeMagazines _x} count MeleeMagazines; call player_forceSave; call dayz_meleeMagazineCheck;"; /* diag_log 'RscDisplayGear : : onunLoad'; */ + //onLoad = "[] spawn object_monitorGear; false call dz_fn_meleeMagazines; call gear_ui_init; call ui_gear_sound; if (isNil('IGUI_GEAR_activeFilter')) then { IGUI_GEAR_activeFilter = 0;}; [_this,'onLoad'] execVM '\z\addons\dayz_code\system\handleGear.sqf'";/* diag_log 'RscDisplayGear : : onLoad'; */ + //onUnload = "false call dz_fn_meleeMagazines; call player_forceSave; call dayz_meleeMagazineCheck;"; /* diag_log 'RscDisplayGear : : onunLoad'; */ onLoad = "setMousePosition [0.5, 0.5];_this call fn_gearMenuChecks; false call dz_fn_meleeMagazines; [] spawn object_monitorGear; call gear_ui_init; call ui_gear_sound; if (isNil 'IGUI_GEAR_activeFilter') then {IGUI_GEAR_activeFilter = 0}; [_this, 'onLoad'] execVM '\z\addons\dayz_code\system\handleGear.sqf'"; onUnload = "true call dz_fn_meleeMagazines; call player_selectWeapon; call player_forceSave;"; onMouseMoving = "[] call gear_ui_hide;"; @@ -316,7 +316,7 @@ class RscDisplayGear x = -2; style = 2048; onSetFocus = "[_this,'onFocus'] execVM '\z\addons\dayz_code\system\handleGear.sqf'"; - onButtonClick = "{player removeMagazines _x} count MeleeMagazines; [_this,'onLBListSelChanged'] execVM '\z\addons\dayz_code\system\handleGear.sqf'"; + onButtonClick = "false call dz_fn_meleeMagazines; [_this,'onLBListSelChanged'] execVM '\z\addons\dayz_code\system\handleGear.sqf'"; text = "<"; }; @@ -351,7 +351,7 @@ class RscDisplayGear idc = 147; x = -2; onSetFocus = "[_this,""onFocus""] execVM '\z\addons\dayz_code\system\handleGear.sqf'"; - onButtonClick = "{player removeMagazines _x} count MeleeMagazines; [_this,""onLBListSelChanged""] execVM '\z\addons\dayz_code\system\handleGear.sqf'"; + onButtonClick = "false call dz_fn_meleeMagazines; [_this,""onLBListSelChanged""] execVM '\z\addons\dayz_code\system\handleGear.sqf'"; text = ">"; }; }; diff --git a/SQF/dayz_code/actions/object_pickup.sqf b/SQF/dayz_code/actions/object_pickup.sqf index c30f57fdd..6f2dcf291 100644 --- a/SQF/dayz_code/actions/object_pickup.sqf +++ b/SQF/dayz_code/actions/object_pickup.sqf @@ -69,9 +69,9 @@ if (_classname isKindOf "Bag_Base_EP1") exitWith { _config = (configFile >> _type >> _classname); //Remove melee magazines (BIS_fnc_invAdd fix) -{player removeMagazines _x} count MeleeMagazines; - +false call dz_fn_meleeMagazines; _isOk = [player,_config] call BIS_fnc_invAdd; +true call dz_fn_meleeMagazines; if (_isOk) then { deleteVehicle _holder; diff --git a/SQF/dayz_code/actions/player_Constructionitem.sqf b/SQF/dayz_code/actions/player_Constructionitem.sqf index 398353fa4..c377a27da 100644 --- a/SQF/dayz_code/actions/player_Constructionitem.sqf +++ b/SQF/dayz_code/actions/player_Constructionitem.sqf @@ -52,7 +52,7 @@ _hasInput = true; if (_hasInput) then { //Remove melee magazines (BIS_fnc_invAdd and BIS_fnc_invSlotsEmpty fix) - {player removeMagazines _x} count MeleeMagazines; + false call dz_fn_meleeMagazines; _freeSlots = [player] call BIS_fnc_invSlotsEmpty; { _item = _x select 0; @@ -66,7 +66,7 @@ if (_hasInput) then { }; }; } forEach _input; - + true call dz_fn_meleeMagazines; _availabeSpace = true; //uiSleep 1; diff --git a/SQF/dayz_code/actions/player_buildingDowngrade.sqf b/SQF/dayz_code/actions/player_buildingDowngrade.sqf index b4b0d68a5..a4fb4fdbe 100644 --- a/SQF/dayz_code/actions/player_buildingDowngrade.sqf +++ b/SQF/dayz_code/actions/player_buildingDowngrade.sqf @@ -50,7 +50,7 @@ if ((count _upgrade) > 0) then { _i = 0; _addedItems = []; //Remove melee magazines (BIS_fnc_invAdd fix) - {player removeMagazines _x} count MeleeMagazines; + false call dz_fn_meleeMagazines; { _itemOut = _x select 0; @@ -70,6 +70,7 @@ if ((count _upgrade) > 0) then { if (_abortInvAdd) exitWith {}; } count _refund; + true call dz_fn_meleeMagazines; // all parts added proceed if(_i != 0) then { diff --git a/SQF/dayz_code/actions/player_craftItemVanilla.sqf b/SQF/dayz_code/actions/player_craftItemVanilla.sqf index 92f0ca007..4a77f42eb 100644 --- a/SQF/dayz_code/actions/player_craftItemVanilla.sqf +++ b/SQF/dayz_code/actions/player_craftItemVanilla.sqf @@ -89,7 +89,7 @@ if(!r_drag_sqf and !r_player_unconscious and !_onLadder) then { if (_hasInput) then { //Remove melee magazines (BIS_fnc_invAdd and BIS_fnc_invSlotsEmpty fix) - {player removeMagazines _x} count MeleeMagazines; + false call dz_fn_meleeMagazines; _freeSlots = [player] call BIS_fnc_invSlotsEmpty; { _item = _x select 0; @@ -122,6 +122,7 @@ if(!r_drag_sqf and !r_player_unconscious and !_onLadder) then { }; } forEach _output; //uiSleep 1; + true call dz_fn_meleeMagazines; if (_availabeSpace) then { //player playActionNow "PutDown"; diff --git a/SQF/dayz_code/actions/player_craftitemGUI.sqf b/SQF/dayz_code/actions/player_craftitemGUI.sqf index ab7b8ded7..2f2f2233a 100644 --- a/SQF/dayz_code/actions/player_craftitemGUI.sqf +++ b/SQF/dayz_code/actions/player_craftitemGUI.sqf @@ -77,7 +77,7 @@ if (count _nearByPile > 0) then { if (_hasInput) then { //Remove melee magazines (BIS_fnc_invAdd and BIS_fnc_invSlotsEmpty fix) - {player removeMagazines _x} count MeleeMagazines; + false call dz_fn_meleeMagazines; _freeSlots = [player] call BIS_fnc_invSlotsEmpty; { _item = _x select 0; @@ -109,6 +109,7 @@ if (count _nearByPile > 0) then { }; }; } forEach _output; + true call dz_fn_meleeMagazines; //uiSleep 1; if (_availabeSpace) then { diff --git a/SQF/dayz_code/actions/player_harvestPlant.sqf b/SQF/dayz_code/actions/player_harvestPlant.sqf index c82d4ace6..7aba6f321 100644 --- a/SQF/dayz_code/actions/player_harvestPlant.sqf +++ b/SQF/dayz_code/actions/player_harvestPlant.sqf @@ -94,7 +94,7 @@ if (count(_findNearestTree) >= 1) then { if (_proceed) then { //Remove melee magazines (BIS_fnc_invAdd fix) - {player removeMagazines _x} count MeleeMagazines; + false call dz_fn_meleeMagazines; _invResult = false; _i = 0; for "_x" from 1 to _countOut do { @@ -103,6 +103,7 @@ if (count(_findNearestTree) >= 1) then { _i = _i + 1; }; }; + true call dz_fn_meleeMagazines; _text = getText (configFile >> "CfgMagazines" >> _itemOut >> "displayName"); diff --git a/SQF/dayz_code/actions/player_removeAttachment.sqf b/SQF/dayz_code/actions/player_removeAttachment.sqf index 0760c64cb..c3e66c761 100644 --- a/SQF/dayz_code/actions/player_removeAttachment.sqf +++ b/SQF/dayz_code/actions/player_removeAttachment.sqf @@ -27,12 +27,14 @@ _newWeapon = _this select 2; //check that player has enough room in inventory //Remove melee magazines (BIS_fnc_invAdd and BIS_fnc_invSlotsEmpty fix) -{player removeMagazines _x} count MeleeMagazines; +false call dz_fn_meleeMagazines; if ((([player] call BIS_fnc_invSlotsEmpty) select 4) < 1) exitWith { closeDialog 0; (localize "str_player_24") call dayz_rollingMessages; + true call dz_fn_meleeMagazines; }; +true call dz_fn_meleeMagazines; //check that player has the weapon if (!(player hasWeapon _weapon)) exitWith diff --git a/SQF/dayz_code/actions/player_tearClothes.sqf b/SQF/dayz_code/actions/player_tearClothes.sqf index 50d21614c..f5a2698ca 100644 --- a/SQF/dayz_code/actions/player_tearClothes.sqf +++ b/SQF/dayz_code/actions/player_tearClothes.sqf @@ -33,7 +33,7 @@ switch (_rounded) do { }; //Remove melee magazines (BIS_fnc_invAdd fix) -{player removeMagazines _x} count MeleeMagazines; +false call dz_fn_meleeMagazines; _i = 0; while {_i < _rounded} do { _i = _i + 1; @@ -58,4 +58,5 @@ while {_i < _rounded} do { }; _pile addMagazineCargoGlobal [_itemtocreate,1]; }; -}; \ No newline at end of file +}; +true call dz_fn_meleeMagazines; \ No newline at end of file diff --git a/SQF/dayz_code/actions/salvage.sqf b/SQF/dayz_code/actions/salvage.sqf index 1dd50c055..cdbe3cb8a 100644 --- a/SQF/dayz_code/actions/salvage.sqf +++ b/SQF/dayz_code/actions/salvage.sqf @@ -45,7 +45,7 @@ if (_hasToolbox) then { if (_finished) then { //Remove melee magazines (BIS_fnc_invAdd fix) - {player removeMagazines _x} count MeleeMagazines; + false call dz_fn_meleeMagazines; _damage = [_vehicle,_hitpoint] call object_getHit; if (_damage < 1 && {_damage > 0}) then { //Tempfix for issue where certain hitpoints on some vehicles do not get damaged and allow infinite removal _BreakableParts = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitLGlass","HitRGlass","HitEngine","HitFuel","HitHRotor"]; @@ -80,6 +80,7 @@ if (_hasToolbox) then { localize "str_player_24" call dayz_rollingMessages; }; }; + true call dz_fn_meleeMagazines; } else { r_interrupt = false; if (vehicle player == player) then { diff --git a/SQF/dayz_code/compile/epoch_generateKey.sqf b/SQF/dayz_code/compile/epoch_generateKey.sqf index 6a02fdca3..d25595d70 100644 --- a/SQF/dayz_code/compile/epoch_generateKey.sqf +++ b/SQF/dayz_code/compile/epoch_generateKey.sqf @@ -21,7 +21,7 @@ _keySelected = format["ItemKey%1%2",_keyColor,_keyNumber]; _isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected); //Remove melee magazines (BIS_fnc_invAdd fix) -{player removeMagazines _x} count MeleeMagazines; +false call dz_fn_meleeMagazines; _isOk = [player,_keySelected] call BIS_fnc_invAdd; - +true call dz_fn_meleeMagazines; [(_isOk && _isKeyOK),_keySelected] \ No newline at end of file diff --git a/SQF/dayz_code/compile/fn_addDuplicateTool.sqf b/SQF/dayz_code/compile/fn_addDuplicateTool.sqf index ab305c368..342cc388e 100644 --- a/SQF/dayz_code/compile/fn_addDuplicateTool.sqf +++ b/SQF/dayz_code/compile/fn_addDuplicateTool.sqf @@ -35,10 +35,11 @@ if (_this in items player) then { }; } else { //Remove melee magazines (BIS_fnc_invAdd fix) - {player removeMagazines _x} count MeleeMagazines; + false call dz_fn_meleeMagazines; if !([player,_this] call BIS_fnc_invAdd) then { systemChat localize "str_epoch_player_107"; _this call _dropOnFloor; }; + true call dz_fn_meleeMagazines; }; \ No newline at end of file diff --git a/SQF/dayz_code/system/player_monitor.fsm b/SQF/dayz_code/system/player_monitor.fsm index 85cb8e204..9a6ba942d 100644 --- a/SQF/dayz_code/system/player_monitor.fsm +++ b/SQF/dayz_code/system/player_monitor.fsm @@ -1061,7 +1061,6 @@ class FSM "player disableConversation true;" \n "" \n "eh_player_killed = player addeventhandler [""FiredNear"",{_this call player_weaponFiredNear;} ];" \n - "//player addEventHandler ['Respawn', player_death];" \n "" \n "//_state = player getVariable[""state"",[]];" \n "_currentWpn = """";" \n