From 88a5aa10a6ca362b5c86258a5239eac152ef82be Mon Sep 17 00:00:00 2001 From: Zac Surplice Date: Mon, 28 Oct 2013 16:29:05 +1100 Subject: [PATCH 1/3] player_build optimisations --- SQF/dayz_code/actions/player_build.sqf | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/SQF/dayz_code/actions/player_build.sqf b/SQF/dayz_code/actions/player_build.sqf index a896d4ebd..29c8a9999 100644 --- a/SQF/dayz_code/actions/player_build.sqf +++ b/SQF/dayz_code/actions/player_build.sqf @@ -193,8 +193,7 @@ if (_hasrequireditem) then { cutText ["Planning construction: PgUp = raise, PgDn = lower, Q or E = flip 180, and Space-Bar to build.", "PLAIN DOWN"]; _previewCounter = 60; - _objHupDiff = 0; - _objHdwnDiff = 0; + _objHDiff = 0; while {_isOk} do { @@ -261,35 +260,29 @@ if (_hasrequireditem) then { if(_zheightdirection == "up") then { _position set [2,((_position select 2)+0.1)]; - _objHupDiff = _objHupDiff + 0.1; - _objHdwnDiff = _objHdwnDiff - 0.1; + _objHDiff = _objHDiff + 0.1; }; if(_zheightdirection == "down") then { _position set [2,((_position select 2)-0.1)]; - _objHdwnDiff = _objHdwnDiff + 0.1; - _objHupDiff = _objHupDiff - 0.1; + _objHDiff = _objHDiff - 0.1; }; if(_zheightdirection == "up_alt") then { _position set [2,((_position select 2)+1)]; _objHupDiff = _objHupDiff + 1; - _objHdwnDiff = _objHdwnDiff - 1; }; if(_zheightdirection == "down_alt") then { _position set [2,((_position select 2)-1)]; - _objHdwnDiff = _objHdwnDiff + 1; - _objHupDiff = _objHupDiff - 1; + _objHDiff = _objHDiff - 1; }; if(_zheightdirection == "up_ctrl") then { _position set [2,((_position select 2)+0.01)]; _objHupDiff = _objHupDiff + 0.01; - _objHdwnDiff = _objHdwnDiff - 0.01; }; if(_zheightdirection == "down_ctrl") then { _position set [2,((_position select 2)-0.01)]; - _objHdwnDiff = _objHdwnDiff + 0.01; - _objHupDiff = _objHupDiff - 0.01; + _objHDiff = _objHDiff - 0.01; }; _object setDir (getDir _object); @@ -302,7 +295,7 @@ if (_hasrequireditem) then { }; - sleep 1; + sleep 0.1; _location2 = getPosATL player; @@ -323,7 +316,7 @@ if (_hasrequireditem) then { deleteVehicle _object; }; - cutText [format["%1",_previewCounter], "PLAIN DOWN"]; + [format["Time left to build: %1",(ceil(_previewCounter))],0,0.8,0.1,0,0,8] spawn BIS_fnc_dynamicText; if(_previewCounter <= 0) exitWith { _isOk = false; @@ -333,9 +326,9 @@ if (_hasrequireditem) then { deleteVehicle _object; }; - _previewCounter = _previewCounter - 1; + _previewCounter = _previewCounter - 0.1; - if((_objHdwnDiff > 5) or (_objHupDiff > 5)) exitWith { + if(abs(_objHDiff) > 5) exitWith { _isOk = false; _cancel = true; _reason = "Cannot move up or down more than 5 meters"; From 6fdcede322527e826aeb62914a02d05cb8875e5f Mon Sep 17 00:00:00 2001 From: Zac Surplice Date: Mon, 28 Oct 2013 16:37:19 +1100 Subject: [PATCH 2/3] player_build.sqf enhancements --- SQF/dayz_code/actions/player_build.sqf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SQF/dayz_code/actions/player_build.sqf b/SQF/dayz_code/actions/player_build.sqf index 29c8a9999..1d0e3010a 100644 --- a/SQF/dayz_code/actions/player_build.sqf +++ b/SQF/dayz_code/actions/player_build.sqf @@ -295,7 +295,7 @@ if (_hasrequireditem) then { }; - sleep 0.1; + sleep 0.5; _location2 = getPosATL player; @@ -311,12 +311,12 @@ if (_hasrequireditem) then { if(_location1 distance _location2 > 5) exitWith { _isOk = false; _cancel = true; - _reason = "Moving too fast."; + _reason = "You've moved to far away from where you started building (within 5 meters)."; detach _object; deleteVehicle _object; }; - [format["Time left to build: %1",(ceil(_previewCounter))],0,0.8,0.1,0,0,8] spawn BIS_fnc_dynamicText; + [format["Time left to build: %1",(ceil(_previewCounter))],0,0.8,0.5,0,0,8] spawn BIS_fnc_dynamicText; if(_previewCounter <= 0) exitWith { _isOk = false; @@ -326,7 +326,7 @@ if (_hasrequireditem) then { deleteVehicle _object; }; - _previewCounter = _previewCounter - 0.1; + _previewCounter = _previewCounter - 0.5; if(abs(_objHDiff) > 5) exitWith { _isOk = false; From b8a5097a7031523a46fdbcd6e8ac6070acb028e5 Mon Sep 17 00:00:00 2001 From: Zac Surplice Date: Tue, 29 Oct 2013 03:48:31 +1100 Subject: [PATCH 3/3] add friendly database persistence --- SQF/dayz_code/init/variables.sqf | 5 +++++ SQF/dayz_code/system/player_monitor.fsm | 5 ++++- SQF/dayz_code/system/player_spawn_2.sqf | 1 + SQF/dayz_server/compile/server_playerSync.sqf | 3 +++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/SQF/dayz_code/init/variables.sqf b/SQF/dayz_code/init/variables.sqf index e21cd35d1..18e09c5a9 100644 --- a/SQF/dayz_code/init/variables.sqf +++ b/SQF/dayz_code/init/variables.sqf @@ -624,6 +624,11 @@ if(!isDedicated) then { if(isNil "DZE_ForceNameTagsOff") then { DZE_ForceNameTagsOff = false; }; + if(isNil "DZE_FriendlySaving") then { + DZE_FriendlySaving = true; + }; + + DZE_Friends = []; DZE_CanPickup = true; DZE_Q = false; diff --git a/SQF/dayz_code/system/player_monitor.fsm b/SQF/dayz_code/system/player_monitor.fsm index fa3f61240..4477bc491 100644 --- a/SQF/dayz_code/system/player_monitor.fsm +++ b/SQF/dayz_code/system/player_monitor.fsm @@ -1085,7 +1085,10 @@ class FSM " //Reload players state" \n " if (count _state > 2) then {" \n " dayz_temperatur = _state select 2;" \n - " };" \n + " }; " \n + " if ((count _state > 3) and DZE_FriendlySaving) then {" \n + " DZE_Friends = _state select 3;" \n + " }; " \n "} else {" \n " _currentWpn = ""Makarov"";" \n " _currentAnim = ""aidlpercmstpsraswpstdnon_player_idlesteady02"";" \n diff --git a/SQF/dayz_code/system/player_spawn_2.sqf b/SQF/dayz_code/system/player_spawn_2.sqf index 37d7cd352..463fb4e64 100644 --- a/SQF/dayz_code/system/player_spawn_2.sqf +++ b/SQF/dayz_code/system/player_spawn_2.sqf @@ -15,6 +15,7 @@ _maxDistancePlayer = DZE_teleport select 3; _maxDistanceVehicle = DZE_teleport select 4; player setVariable ["temperature",dayz_temperatur,true]; +player setVariable ["friendlyTo",DZE_Friends,true]; dayz_myLoad = (((count dayz_myBackpackMags) * 0.2) + (count dayz_myBackpackWpns)) + (((count dayz_myMagazines) * 0.1) + (count dayz_myWeapons * 0.5)); diff --git a/SQF/dayz_server/compile/server_playerSync.sqf b/SQF/dayz_server/compile/server_playerSync.sqf index 50ff7dc57..81e1e90a9 100644 --- a/SQF/dayz_server/compile/server_playerSync.sqf +++ b/SQF/dayz_server/compile/server_playerSync.sqf @@ -165,6 +165,9 @@ if (_characterID != "0") then { }; _temp = round(_character getVariable ["temperature",100]); _currentState = [_currentWpn,_currentAnim,_temp]; + if(DZE_FriendlySaving) then { + _currentState set [(count _currentState),(_character getVariable ["friendlyTo",[]])]; + }; /* Everything is ready, now publish to HIVE */