Changes to default var loading

This commit is contained in:
vbawol 2017-09-26 21:20:41 -05:00
parent 38d704468d
commit a3a0e7e2d9
9 changed files with 36 additions and 26 deletions

View File

@ -13,7 +13,7 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/EPOCH_unitSpawn.sqf
*/
//[[[cog import generate_private_arrays ]]]
private ["_aiskill","_arrSkills","_arrUnits","_arrVals","_bomb","_config","_currentLimit","_disableAI","_driver","_grp","_index","_jammerRange","_jammers","_loop","_minAISkill","_missionConfig","_nonJammer","_nonTrader","_nonTraderAIRange","_playerSpawnArray","_playerSpawnArrayKey","_pos","_restricted","_sapperHndl","_sapperNum","_spawnLimit","_targetPos","_unit","_units"];
private ["_aiskill","_arrSkills","_arrUnits","_arrVals","_bomb","_config","_currentLimit","_disableAI","_driver","_grp","_index","_jammerRange","_jammers","_loop","_minAISkill","_missionConfig","_nonJammer","_nonTrader","_nonTraderAIRange","_playerSpawnArray","_playerSpawnArrayKeyFinal","_pos","_restricted","_sapperHndl","_sapperNum","_spawnLimit","_targetPos","_unit","_units"];
//[[[end]]]
params ["_unitClass",["_trgt",player],["_doVariable",false],["_unitCount",1],["_extraData",[]] ];
@ -22,8 +22,9 @@ _bomb = objNull;
_index = EPOCH_spawnIndex find _unitClass;
_spawnLimit = 0;
if (_index != -1) then {
if (isNil "_playerSpawnArrayKey") then {_playerSpawnArrayKey = "EPOCH_playerSpawnArray"};
_playerSpawnArray = missionNamespace getVariable [_playerSpawnArrayKey,[]];
_playerSpawnArrayKeyFinal = "EPOCH_playerSpawnArray";
if (isNil "_playerSpawnArrayKey") then {_playerSpawnArrayKeyFinal = _playerSpawnArrayKey};
_playerSpawnArray = missionNamespace getVariable [_playerSpawnArrayKeyFinal,[]];
_spawnLimit = _playerSpawnArray select _index;
};
_currentLimit = count(_trgt nearEntities[_unitClass, 800]);

View File

@ -18,7 +18,8 @@ private ["_index","_playerSpawnArray","_playerSpawnArrayKey"];
params ["_spawnName", ["_decrease",1]];
_index = EPOCH_spawnIndex find _spawnName;
if (_index != -1) then{
if (isNil "_playerSpawnArrayKey") then {_playerSpawnArrayKey = "EPOCH_playerSpawnArray"};
_playerSpawnArray = missionNamespace getVariable [_playerSpawnArrayKey,[]];
_playerSpawnArrayKeyFinal = "EPOCH_playerSpawnArray";
if (isNil "_playerSpawnArrayKey") then {_playerSpawnArrayKeyFinal = _playerSpawnArrayKey};
_playerSpawnArray = missionNamespace getVariable [_playerSpawnArrayKeyFinal,[]];
_playerSpawnArray set[_index, ((_playerSpawnArray select _index) - _decrease) max 0];
};

View File

@ -18,7 +18,8 @@ private ["_index","_playerSpawnArray","_playerSpawnArrayKey"];
params ["_spawnName", ["_increase",1]];
_index = EPOCH_spawnIndex find _spawnName;
if (_index != -1) then{
if (isNil "_playerSpawnArrayKey") then {_playerSpawnArrayKey = "EPOCH_playerSpawnArray"};
_playerSpawnArray = missionNamespace getVariable [_playerSpawnArrayKey,[]];
_playerSpawnArrayKeyFinal = "EPOCH_playerSpawnArray";
if (isNil "_playerSpawnArrayKey") then {_playerSpawnArrayKeyFinal = _playerSpawnArrayKey};
_playerSpawnArray = missionNamespace getVariable [_playerSpawnArrayKeyFinal,[]];
_playerSpawnArray set[_index, ((_playerSpawnArray select _index) + _increase) min (EPOCH_spawnLimits select _index)];
};

View File

@ -22,7 +22,7 @@
NOTHING
*/
//[[[cog import generate_private_arrays ]]]
private ["_animConfigArray","_animationEffect","_animationEffectGlobal","_bleedAmount","_bleedChance","_bloodpAmount","_bloodpChance","_canSee","_cfgObjectInteraction","_distance","_doAttack","_fatigueChance","_ppEffect","_say3dsoundsConfig","_selectedMove","_selectedSound","_soundConfigArray","_soundEffect","_soundEffectGlobal","_switchMovehandlerConfig","_target","_toxicAmount","_toxicChance"];
private ["_animConfigArray","_animationEffect","_animationEffectGlobal","_bleedAmount","_bleedChance","_bloodpAmount","_bloodpChance","_canSee","_cfgObjectInteraction","_distance","_doAttack","_fatigueChance","_playerBloodPKeyFinal","_playerImmunityKeyFinal","_playerToxicityKeyFinal","_ppEffect","_say3dsoundsConfig","_selectedMove","_selectedSound","_soundConfigArray","_soundEffect","_soundEffectGlobal","_switchMovehandlerConfig","_target","_toxicAmount","_toxicChance"];
//[[[end]]]
params [["_unit",objNull],["_target",player]];
if (isNull _unit && isNull _target) exitWith {};
@ -113,16 +113,19 @@ if (_doAttack) then {
};
if (random 1 < _toxicChance) then {
if (isNil "_playerToxicityKey") then {_playerToxicityKey = "EPOCH_playerToxicity"};
if (isNil "_playerImmunityKey") then {_playerImmunityKey = "EPOCH_playerImmunity"};
[_playerToxicityKey,random(_toxicAmount - (missionNamespace getVariable [_playerImmunityKey, 0])),100,0] call EPOCH_fnc_setVariableLimited;
_playerToxicityKeyFinal = "EPOCH_playerToxicity";
_playerImmunityKeyFinal = "EPOCH_playerImmunity";
if (isNil "_playerToxicityKey") then {_playerToxicityKeyFinal = _playerToxicityKey};
if (isNil "_playerImmunityKey") then {_playerImmunityKeyFinal = _playerImmunityKey};
[_playerToxicityKeyFinal,random(_toxicAmount - (missionNamespace getVariable [_playerImmunityKeyFinal, 0])),100,0] call EPOCH_fnc_setVariableLimited;
};
if (random 1 < _bleedChance) then {
player setBleedingRemaining((getBleedingRemaining player) + _bleedAmount);
};
if (random 1 < _bloodpChance) then {
if (isNil "_playerBloodPKey") then {_playerBloodPKey = "EPOCH_playerBloodP"};
[_playerBloodPKey,_bloodpAmount,100,0] call EPOCH_fnc_setVariableLimited;
_playerBloodPKeyFinal = "EPOCH_playerBloodP";
if (isNil "_playerBloodPKey") then {_playerBloodPKeyFinal = _playerBloodPKey};
[_playerBloodPKeyFinal,_bloodpAmount,100,0] call EPOCH_fnc_setVariableLimited;
if !(_ppEffect isEqualTo []) then {
[_ppEffect] spawn EPOCH_fnc_spawnEffects;
};

View File

@ -23,7 +23,7 @@
BOOL
*/
//[[[cog import generate_private_arrays ]]]
private ["_config","_doRevenge","_playerDeathScreen","_playerKilledScreen","_playerRevengeMinAliveTime","_tapDiag"];
private ["_config","_doRevenge","_playerAliveTime","_playerAliveTimeKeyFinal","_playerDeathScreen","_playerKilledScreen","_playerRevengeMinAliveTime","_tapDiag"];
//[[[end]]]
params [["_unit",objNull,[objNull]],["_killer",objNull,[objNull]] ];
_config = 'CfgEpochClient' call EPOCH_returnConfig;
@ -32,8 +32,9 @@ _playerRevengeMinAliveTime = getNumber(_config >> "playerRevengeMinAliveTime");
if (_playerDeathScreen isEqualTo "") then {_playerDeathScreen = "TapOut"};
_tapDiag = _playerDeathScreen;
if (isNil "_playerAliveTimeKey") then {_playerAliveTimeKey = "EPOCH_playerAliveTime"};
_playerAliveTime = missionNamespace getVariable [_playerAliveTimeKey,[]];
_playerAliveTimeKeyFinal = "EPOCH_playerAliveTime";
if (isNil "_playerAliveTimeKey") then {_playerAliveTimeKeyFinal = _playerAliveTimeKey};
_playerAliveTime = missionNamespace getVariable [_playerAliveTimeKeyFinal,[]];
_doRevenge = ((getNumber(_config >> "playerDisableRevenge") isEqualTo 0) && _playerAliveTime >= _playerRevengeMinAliveTime);

View File

@ -119,7 +119,8 @@ switch true do {
};
// Nuisance System 0.1
(EPOCH_customVarLimits select (EPOCH_customVars find "Nuisance")) params [["_playerLimitMax",100],["_playerLimitMin",0]];
if (isNil "_playerNuisanceKey") then {_playerNuisanceKey = "EPOCH_playerNuisance"};
[_playerNuisanceKey,_nuisanceLevel,_playerLimitMax,_playerLimitMin] call EPOCH_fnc_setVariableLimited;
_playerNuisanceKeyFinal = "EPOCH_playerNuisance";
if (isNil "_playerNuisanceKey") then {_playerAliveTimeKeyFinal = _playerNuisanceKey};
[_playerNuisanceKeyFinal,_nuisanceLevel,_playerLimitMax,_playerLimitMin] call EPOCH_fnc_setVariableLimited;
};
};

View File

@ -26,11 +26,12 @@
BOOL
*/
//[[[cog import generate_private_arrays ]]]
private ["_adj","_currentPos","_handled","_playerStaminaKey","_step"];
private ["_adj","_currentPos","_handled","_playerStaminaKeyFinal","_step"];
//[[[end]]]
params ["_display","_dikCode","_shift","_ctrl","_alt"];
if (isNil "_playerStaminaKey") then {_playerStaminaKey = "EPOCH_playerStamina"};
_playerStaminaKeyFinal = "EPOCH_playerStamina";
if (isNil "_playerStaminaKey") then {_playerStaminaKeyFinal = _playerStaminaKey};
_handled = false;
@ -204,13 +205,13 @@ if (vehicle player == player) then {
if ((primaryWeapon player != "") && (currentWeapon player == primaryWeapon player)) then {
player switchMove "AovrPercMrunSrasWrflDf";
[player, "AovrPercMrunSrasWrflDf", Epoch_personalToken] remoteExec ["EPOCH_server_handle_switchMove",2];
[_playerStaminaKey, -30, 1000 , 0] call EPOCH_fnc_setVariableLimited;
[_playerStaminaKeyFinal, -30, 1000 , 0] call EPOCH_fnc_setVariableLimited;
_handled = true;
} else {
if (currentWeapon player == "") then {
player switchMove "epoch_unarmed_jump";
[player, "epoch_unarmed_jump", Epoch_personalToken] remoteExec ["EPOCH_server_handle_switchMove",2];
[_playerStaminaKey, -30, 1000 , 0] call EPOCH_fnc_setVariableLimited;
[_playerStaminaKeyFinal, -30, 1000 , 0] call EPOCH_fnc_setVariableLimited;
_handled = true;
};
};

View File

@ -24,7 +24,7 @@
NOTHING
*/
//[[[cog import generate_private_arrays ]]]
private ["_playerBloodPKey","_prevPlayerObject"];
private ["_playerBloodPKeyFinal","_prevPlayerObject"];
//[[[end]]]
params [
["_playerObject",objNull,[objNull]],
@ -58,8 +58,9 @@ if !(alive player && alive _playerObject && !isPlayer _playerObject) then {
Epoch_personalToken = _personalToken;
// reset blood Pressure to warning level
if (isNil "_playerBloodPKey") then {_playerBloodPKey = "EPOCH_playerBloodP"};
missionNamespace setVariable [_playerBloodPKey, 120];
_playerBloodPKeyFinal = "EPOCH_playerBloodP";
if (isNil "_playerBloodPKey") then {_playerBloodPKeyFinal = _playerBloodPKey};
missionNamespace setVariable [_playerBloodPKeyFinal, 120];
// restart masterloop
[] spawn EPOCH_masterLoop;

View File

@ -31,7 +31,7 @@ _customVarLimits = _customVarsInit apply {_x param [2,[]]};
_varNameTmp = call compile format["_player%1Key",_x];
if !(isNil "_varNameTmp") then {_varName = _varNameTmp};
_varLimits params [[format["_player%1MaxRaw",_x],100],[format["_player%1MinRaw",_x],0]];
_loadVar = missionNamespace setVariable [_varName, missionNamespace getVariable [format["EPOCH_player%1",_x], _varDefault]];
missionNamespace setVariable [_varName, missionNamespace getVariable [format["EPOCH_player%1",_x], _varDefault]];
call compile format['_player%1 = missionNamespace getVariable [_varName, _varDefault]; _player%1Max = _player%1MaxRaw; _player%1Min = _player%1MinRaw',_x];
} forEach _customVarNames;