From ace75e27d3b3a0b866712a0d4fc799c111755e1e Mon Sep 17 00:00:00 2001 From: Zac Surplice Date: Mon, 23 Sep 2013 01:07:00 +1000 Subject: [PATCH 1/3] Vectoradd function zero divisor fix --- .../compile/{ => BIS_fnc}/fn_selectRandom.sqf | 0 .../compile/BIS_fnc/fn_vectorAdd.sqf | 35 +++++++++++++++++++ SQF/dayz_code/init/compiles.sqf | 3 +- 3 files changed, 37 insertions(+), 1 deletion(-) rename SQF/dayz_code/compile/{ => BIS_fnc}/fn_selectRandom.sqf (100%) create mode 100644 SQF/dayz_code/compile/BIS_fnc/fn_vectorAdd.sqf diff --git a/SQF/dayz_code/compile/fn_selectRandom.sqf b/SQF/dayz_code/compile/BIS_fnc/fn_selectRandom.sqf similarity index 100% rename from SQF/dayz_code/compile/fn_selectRandom.sqf rename to SQF/dayz_code/compile/BIS_fnc/fn_selectRandom.sqf diff --git a/SQF/dayz_code/compile/BIS_fnc/fn_vectorAdd.sqf b/SQF/dayz_code/compile/BIS_fnc/fn_vectorAdd.sqf new file mode 100644 index 000000000..a50bae431 --- /dev/null +++ b/SQF/dayz_code/compile/BIS_fnc/fn_vectorAdd.sqf @@ -0,0 +1,35 @@ +scriptName "Functions\vectors\fn_vectorAdd.sqf"; +/************************************************************ + Vector Add + From VBS1 Core, modified by Vilem (arbitrary no of dimensions dimensions) + + = [,] call BIS_fnc_vectorAdd + +Operand types: +: array +: array +: array + +Returns a vector that is the sum of and . + +************************************************************/ + +private["_p1","_p2","_return","_i"]; + +_p1 = _this select 0; +_p2 = _this select 1; + +if ((count _p1) != (count _p2)) then {textLogFormat ["BIS_FNC Error: vectors not of same size"]}; + +_return = []; +_i = 0; +{ + if(count(_p2) <= _i) then { + _return = _return + [_x + (_p2 select _i)]; + } else { + _return = _return + [_x]; + }; + _i = _i + 1; +} forEach _p1; + +_return \ No newline at end of file diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index f1c818c75..3df4adff9 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -722,7 +722,8 @@ if (!isDedicated) then { progressLoadingScreen 0.8; //Both - BIS_fnc_selectRandom = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selectRandom.sqf"; //Checks which actions for nearby casualty + BIS_fnc_selectRandom = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_selectRandom.sqf"; //Checks which actions for nearby casualty + BIS_fnc_vectorAdd = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_vectorAdd.sqf"; //Checks which actions for nearby casualty fnc_buildWeightedArray = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_buildWeightedArray.sqf"; //Checks which actions for nearby casualty fnc_usec_damageVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerVehicle.sqf"; //Event handler run on damage zombie_initialize = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\zombie_init.sqf"; From 06ed1fc10c206178b97a31d0184cdd3af96ac797 Mon Sep 17 00:00:00 2001 From: Zac Surplice Date: Tue, 24 Sep 2013 21:40:28 +1000 Subject: [PATCH 2/3] No gear menu near locked vehicles --- SQF/dayz_code/Configs/rscTitles.hpp | 2 ++ SQF/dayz_code/actions/player_harvestPlant.sqf | 26 ++++++++++++------- SQF/dayz_code/compile/fn_gearMenuChecks.sqf | 7 +++++ SQF/dayz_code/init/compiles.sqf | 1 + 4 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 SQF/dayz_code/compile/fn_gearMenuChecks.sqf diff --git a/SQF/dayz_code/Configs/rscTitles.hpp b/SQF/dayz_code/Configs/rscTitles.hpp index 8c309bd22..8678a3568 100644 --- a/SQF/dayz_code/Configs/rscTitles.hpp +++ b/SQF/dayz_code/Configs/rscTitles.hpp @@ -875,7 +875,9 @@ class RscDisplayGear { idd = 106; enableDisplay = 1; + onLoad = "_this call fn_gearMenuChecks;[] spawn object_monitorGear; {player removeMagazines _x} forEach MeleeMagazines; call gear_ui_init; if (isNil('IGUI_GEAR_activeFilter')) then { IGUI_GEAR_activeFilter = 0;}; private ['_dummy']; _dummy = [_this,'initDialog'] call compile preprocessFile '\ca\ui\scripts\handleGear.sqf'; _dummy = [_this,'onLoad'] execVM '\ca\ui\scripts\handleGear.sqf'; _dummy;"; onUnload = "call player_gearSync; call dayz_forceSave;"; + class controls { class CA_Filter_Icon: RscPicture diff --git a/SQF/dayz_code/actions/player_harvestPlant.sqf b/SQF/dayz_code/actions/player_harvestPlant.sqf index 7a5a468ea..d76884252 100644 --- a/SQF/dayz_code/actions/player_harvestPlant.sqf +++ b/SQF/dayz_code/actions/player_harvestPlant.sqf @@ -93,18 +93,26 @@ if (count(_findNearestTree) >= 1) then { if (_proceed) then { + _invResult = false; + _i = 0; for "_x" from 1 to _countOut do { - player addMagazine _itemOut; + _invResult = [player,_itemOut] call BIS_fnc_invAdd; + if(_invResult) then { + _i = _i + 1; + }; }; - - // chop down tree - if("" == typeOf _tree) then { - _tree setDamage 1; + + if(_i != 0) then { + // chop down tree + if("" == typeOf _tree) then { + _tree setDamage 1; + }; + //diag_log format["DEBUG TREE DAMAGE: %1", _tree]; + + cutText [format["\n\n%1 of %2 has been successfully added to your inventory.", _i,_itemOut], "PLAIN DOWN"]; + } else { + cutText [format["\n\n%1 of %2 could not be added to your inventory. (not enough room?)", _i,_itemOut], "PLAIN DOWN"]; }; - //diag_log format["DEBUG TREE DAMAGE: %1", _tree]; - - cutText [format["\n\n%1 of %2 has been successfully added to your inventory.", _countOut,_itemOut], "PLAIN DOWN"]; - } else { r_interrupt = false; if (vehicle player == player) then { diff --git a/SQF/dayz_code/compile/fn_gearMenuChecks.sqf b/SQF/dayz_code/compile/fn_gearMenuChecks.sqf new file mode 100644 index 000000000..3841d180c --- /dev/null +++ b/SQF/dayz_code/compile/fn_gearMenuChecks.sqf @@ -0,0 +1,7 @@ +disableSerialization; +_display = (_this select 0); +_close = {locked _x} count (nearestObjects [player, ["AllVehicle"], 10]) > 0; + +if(_close) then { + _display closeDisplay 1; +}; \ No newline at end of file diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index 3df4adff9..809fc1bd6 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -56,6 +56,7 @@ if (!isDedicated) then { player_alertZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_alertZombies.sqf"; player_fireMonitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\fire_monitor.sqf"; player_friendliesCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_friendliesCheck.sqf"; + fn_gearMenuChecks = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_gearMenuChecks.sqf"; //Objects object_roadFlare = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_roadFlare.sqf"; From 515e0d1d56863b38e94517795e67f475f7a41f3c Mon Sep 17 00:00:00 2001 From: Zac Surplice Date: Tue, 24 Sep 2013 21:43:41 +1000 Subject: [PATCH 3/3] little fixes, (typo, distance change) --- SQF/dayz_code/compile/fn_gearMenuChecks.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SQF/dayz_code/compile/fn_gearMenuChecks.sqf b/SQF/dayz_code/compile/fn_gearMenuChecks.sqf index 3841d180c..b96c5d208 100644 --- a/SQF/dayz_code/compile/fn_gearMenuChecks.sqf +++ b/SQF/dayz_code/compile/fn_gearMenuChecks.sqf @@ -1,6 +1,6 @@ disableSerialization; _display = (_this select 0); -_close = {locked _x} count (nearestObjects [player, ["AllVehicle"], 10]) > 0; +_close = {locked _x} count (nearestObjects [player, ["AllVehicles"], 5]) > 0; if(_close) then { _display closeDisplay 1;