move AliveTime stat to local loop

This commit is contained in:
vbawol 2017-09-05 16:16:13 -05:00
parent 6e378ee221
commit 422fdcc487
4 changed files with 9 additions and 11 deletions

View File

@ -272,6 +272,7 @@ if !(EPOCH_ActiveTraderMission isequalto []) then {
// Update read only vars // Update read only vars
EPOCH_playerRadiation = _playerRadiation; EPOCH_playerRadiation = _playerRadiation;
EPOCH_playerAliveTime = _playerAliveTime;
// force update // force update
if (EPOCH_forceUpdateNow) then { if (EPOCH_forceUpdateNow) then {

View File

@ -178,7 +178,7 @@ EPOCH_playerThirst = (EPOCH_playerThirst - _thirstlossRate) max 0;
call _lootBubble; call _lootBubble;
EPOCH_playerStaminaMax = (100 * (round(EPOCH_playerAliveTime/360)/10)) min 2500; EPOCH_playerStaminaMax = (100 * (round(_playerAliveTime/360)/10)) min 2500;
// downtick Nuisance // downtick Nuisance
(EPOCH_customVarLimits select (EPOCH_customVars find "Nuisance")) params [["_playerLimitMax",100],["_playerLimitMin",0]]; (EPOCH_customVarLimits select (EPOCH_customVars find "Nuisance")) params [["_playerLimitMax",100],["_playerLimitMin",0]];

View File

@ -86,7 +86,7 @@ if !(_powerSources isEqualTo[]) then {
// downtick Alcohol // downtick Alcohol
EPOCH_playerAlcohol = ((EPOCH_playerAlcohol - 1) min 100) max 0; EPOCH_playerAlcohol = ((EPOCH_playerAlcohol - 1) min 100) max 0;
EPOCH_playerAliveTime = round(EPOCH_playerAliveTime + (_tickTime - EPOCH_clientAliveTimer)); _playerAliveTime = round(_playerAliveTime + (_tickTime - EPOCH_clientAliveTimer));
EPOCH_clientAliveTimer = _tickTime; EPOCH_clientAliveTimer = _tickTime;
// force update after 60 seconds // force update after 60 seconds

View File

@ -9,6 +9,7 @@ EPOCH_forceUpdateNow = false;
// init local player stat vars // init local player stat vars
_playerRadiation = EPOCH_playerRadiation; _playerRadiation = EPOCH_playerRadiation;
_playerAliveTime = EPOCH_playerAliveTime;
// inline function to sync player stats to server // inline function to sync player stats to server
_fnc_forceUpdate = { _fnc_forceUpdate = {
@ -19,12 +20,15 @@ _fnc_forceUpdate = {
case ("Radiation"): { case ("Radiation"): {
_customVars pushBack _playerRadiation; _customVars pushBack _playerRadiation;
}; };
case ("AliveTime"):{
_customVars pushBack _playerAliveTime;
};
default { default {
_customVars pushBack (missionNamespace getVariable format["EPOCH_player%1",_x]); _customVars pushBack (missionNamespace getVariable format["EPOCH_player%1",_x]);
}; };
}; };
} forEach (missionNamespace getVariable["EPOCH_customVars", []]); } forEach EPOCH_customVars;
[player,_customVars,missionNamespace getVariable "Epoch_personalToken"] remoteExec ["EPOCH_fnc_savePlayer",2]; [player,_customVars,Epoch_personalToken] remoteExec ["EPOCH_fnc_savePlayer",2];
}; };
// disable fuel sources client side. // disable fuel sources client side.
@ -112,13 +116,6 @@ _antagonistSpawnLimits = ["CfgEpochClient", "antagonistSpawnIndex", _antagonistS
EPOCH_spawnIndex = _spawnIndex; EPOCH_spawnIndex = _spawnIndex;
EPOCH_spawnLimits = _spawnLimits; EPOCH_spawnLimits = _spawnLimits;
//
_customVars = [];
{
_customVars pushBack (missionNamespace getVariable format["EPOCH_player%1",_x]);
} forEach (missionNamespace getVariable["EPOCH_customVars", []]);
_prevCustomVars = _customVars;
// default data if mismatch // default data if mismatch
if !(EPOCH_playerSpawnArray isEqualTypeParams _spawnIndex) then{ if !(EPOCH_playerSpawnArray isEqualTypeParams _spawnIndex) then{
EPOCH_playerSpawnArray = []; EPOCH_playerSpawnArray = [];