diff --git a/SQF/dayz_code/actions/player_build.sqf b/SQF/dayz_code/actions/player_build.sqf index a896d4ebd..1d0e3010a 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.5; _location2 = getPosATL player; @@ -318,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; }; - cutText [format["%1",_previewCounter], "PLAIN DOWN"]; + [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; @@ -333,9 +326,9 @@ if (_hasrequireditem) then { deleteVehicle _object; }; - _previewCounter = _previewCounter - 1; + _previewCounter = _previewCounter - 0.5; - 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"; 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 */