mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
use local vars for player stats
This commit is contained in:
parent
73d5d95fc5
commit
47e16a8318
@ -43,15 +43,15 @@ EPOCH_currentTargetMode = _currentTargetMode;
|
||||
// dynamic HUD start
|
||||
{
|
||||
_x params [["_selectedVar",[]],["_HUDclass","topRight"],["_ctrlText",""],["_criticalAttributes",[]]];
|
||||
_selectedVar params [["_selVarName",""],["_selVarType",""],["_selVarSubData",""],["_extraLogicRaw",[]],["_customVarLimits",[]]];
|
||||
_selectedVar params [["_selVarName",""],["_selVarType",""],["_selVarSubData",""],["_extraLogicRaw",[]],["_selVarLimits",[]]];
|
||||
|
||||
_varIndex = EPOCH_customVars find _selVarName;
|
||||
if (_varIndex != -1 || !(_customVarLimits isEqualTo [])) then {
|
||||
if (_customVarLimits isEqualTo []) then {
|
||||
_customVarLimits = EPOCH_customVarLimits select _varIndex;
|
||||
_varIndex = _customVarNames find _selVarName;
|
||||
if (_varIndex != -1 || !(_selVarLimits isEqualTo [])) then {
|
||||
if (_selVarLimits isEqualTo []) then {
|
||||
_selVarLimits = _customVarLimits select _varIndex;
|
||||
};
|
||||
_currentVarVal = [_selVarName,_varIndex,_selVarType,_selVarSubData] call EPOCH_fnc_returnHudVar;
|
||||
_customVarLimits params [["_playerLimitMax",100],["_playerLimitMin",0],["_playerWarnLimit",101],["_playerCriticalLimit",101],["_playerWarnLow",0],["_playerCriticalLow",0]];
|
||||
_selVarLimits params [["_playerLimitMax",100],["_playerLimitMin",0],["_playerWarnLimit",101],["_playerCriticalLimit",101],["_playerWarnLow",0],["_playerCriticalLow",0]];
|
||||
|
||||
_extraLogic = false;
|
||||
if !(_extraLogicRaw isEqualTo []) then {
|
||||
@ -61,7 +61,7 @@ EPOCH_currentTargetMode = _currentTargetMode;
|
||||
if (_extraLogicType isEqualType []) then {
|
||||
_extraLogicType params [["_extraLogicVarName",""],["_extraLogicType",""],["_extraLogicDefaultValue",""]];
|
||||
};
|
||||
_extraVarIndex = EPOCH_customVars find _extraLogicVarName;
|
||||
_extraVarIndex = _customVarNames find _extraLogicVarName;
|
||||
_extraLogic = [([_extraLogicVarName,_extraVarIndex,_extraLogicType,_extraLogicDefaultValue] call EPOCH_fnc_returnHudVar),_extraLogicCond,_extraLogicData] call EPOCH_fnc_arrayToLogic;
|
||||
};
|
||||
|
||||
|
@ -181,5 +181,5 @@ call _lootBubble;
|
||||
EPOCH_playerStaminaMax = (100 * (round(_playerAliveTime/360)/10)) min 2500;
|
||||
|
||||
// downtick Nuisance
|
||||
(EPOCH_customVarLimits select (EPOCH_customVars find "Nuisance")) params [["_playerLimitMax",100],["_playerLimitMin",0]];
|
||||
(_customVarLimits select (_customVarNames find "Nuisance")) params [["_playerLimitMax",100],["_playerLimitMin",0]];
|
||||
EPOCH_playerNuisance = ((EPOCH_playerNuisance - 1) min _playerLimitMax) max _playerLimitMin;
|
||||
|
@ -14,6 +14,12 @@ _playerAliveTime = EPOCH_playerAliveTime;
|
||||
// start alive timer
|
||||
_clientAliveTimer = diag_tickTime;
|
||||
|
||||
// init player stat vars
|
||||
_customVarsInit = ["CfgEpochClient", "customVarsDefaults", EPOCH_customVarsDefaults] call EPOCH_fnc_returnConfigEntryV2;
|
||||
_customVarNames = _customVarsInit apply {_x param [0,""]};
|
||||
_defaultVarValues = _customVarsInit apply {_x param [1,0]};
|
||||
_customVarLimits = _customVarsInit apply {_x param [2,[]]};
|
||||
|
||||
// inline function to sync player stats to server
|
||||
_fnc_forceUpdate = {
|
||||
private _customVars = [];
|
||||
@ -27,10 +33,13 @@ _fnc_forceUpdate = {
|
||||
_customVars pushBack _playerAliveTime;
|
||||
};
|
||||
default {
|
||||
_customVars pushBack (missionNamespace getVariable format["EPOCH_player%1",_x]);
|
||||
private _customVarIndex = _customVarNames find _x;
|
||||
if (_customVarIndex != -1) then {
|
||||
_customVars pushBack (missionNamespace getVariable [format["EPOCH_player%1",_x],_defaultVarValues select _customVarIndex]);
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach EPOCH_customVars;
|
||||
} forEach _customVarNames;
|
||||
[player,_customVars,Epoch_personalToken] remoteExec ["EPOCH_fnc_savePlayer",2];
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user