From 853d69d20136af290f244659db26ac48a5502f5f Mon Sep 17 00:00:00 2001 From: vbawol Date: Tue, 26 Sep 2017 09:08:22 -0500 Subject: [PATCH] use setvar for digest --- .../compile/setup/masterLoop/Event1.sqf | 6 ++- .../compile/setup/masterLoop/Event2.sqf | 53 +++++++++++-------- .../epoch_config/Configs/CfgEpochClient.hpp | 13 ----- 3 files changed, 34 insertions(+), 38 deletions(-) diff --git a/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf b/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf index 4d8d2744..d60f2856 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf @@ -119,8 +119,10 @@ if (_forceFatigue) then { }; // Blood pressure handler -if (EPOCH_digestBloodP > 0) then { - _playerBloodP = ((_playerBloodP + EPOCH_digestBloodP) min _playerBloodPMax) max _playerBloodPMin; +_digestBloodP = missionNamespace getVariable ["EPOCH_digestBloodP", 0]; +if (_digestBloodP > 0) then { + _playerBloodP = ((_playerBloodP + _digestBloodP) min _playerBloodPMax) max _playerBloodPMin; + missionNamespace setVariable ["EPOCH_digestBloodP", 0]; } else { if (_forceBloodRise) then { // force Blood Pressure Rise diff --git a/Sources/epoch_code/compile/setup/masterLoop/Event2.sqf b/Sources/epoch_code/compile/setup/masterLoop/Event2.sqf index a65fe22f..ebbb72b9 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/Event2.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/Event2.sqf @@ -55,9 +55,10 @@ if (_playerRadiation > 1) then { }; // Energy Handler -if (EPOCH_digestEnergy > 0) then { - _energyValue = _energyValue + EPOCH_digestEnergy; - EPOCH_digestEnergy = 0; +_digestEnergy = missionNamespace getVariable ["EPOCH_digestEnergy", 0]; +if (_digestEnergy > 0) then { + _energyValue = _energyValue + _digestEnergy; + missionNamespace setVariable ["EPOCH_digestEnergy", 0]; }; _playerEnergy = ((_playerEnergy + _energyValue) min _playerEnergyMax) max _playerEnergyMin; @@ -140,9 +141,10 @@ if ((getFatigue player) >= 0.7 && _airTemp > 100) then { }; // Immunity Handler -if (EPOCH_digestImmunity > 0) then { - _playerImmunity = ((_playerImmunity + EPOCH_digestImmunity) min _playerImmunityMax) max _playerImmunityMin; - EPOCH_digestImmunity = 0; +_digestImmunity = missionNamespace getVariable ["EPOCH_digestImmunity", 0]; +if (_digestImmunity > 0) then { + _playerImmunity = ((_playerImmunity + _digestImmunity) min _playerImmunityMax) max _playerImmunityMin; + missionNamespace setVariable ["EPOCH_digestImmunity", 0]; }; // toxic fever and immunity increase @@ -184,10 +186,11 @@ if (_playerStamina < 100) then { _hungerlossRate = (_hungerlossRate / 2); }; +_digestAlcohol = missionNamespace getVariable ["EPOCH_digestAlcohol", 0]; // Alcohol Handler -if (EPOCH_digestAlcohol > 0) then { - _playerAlcohol = ((_playerAlcohol + EPOCH_digestAlcohol) min _playerAlcoholMax) max _playerAlcoholMin; - EPOCH_digestAlcohol = 0; +if (_digestAlcohol > 0) then { + _playerAlcohol = ((_playerAlcohol + _digestAlcohol) min _playerAlcoholMax) max _playerAlcoholMin; + missionNamespace setVariable ["EPOCH_digestAlcohol", 0]; } else { // downtick Alcohol _alcoholLossRate = 0.17; @@ -195,42 +198,46 @@ if (EPOCH_digestAlcohol > 0) then { }; // Hunger Handler -if (EPOCH_digestHunger > 0) then { - _playerHunger = ((_playerHunger + EPOCH_digestHunger) min _playerHungerMax) max _playerHungerMin; - EPOCH_digestHunger = 0; +_digestHunger = missionNamespace getVariable ["EPOCH_digestHunger", 0]; +if (_digestHunger > 0) then { + _playerHunger = ((_playerHunger + _digestHunger) min _playerHungerMax) max _playerHungerMin; + missionNamespace setVariable ["EPOCH_digestHunger", 0]; } else { // downtick Hunger _playerHunger = ((_playerHunger - _hungerlossRate) min _playerHungerMax) max _playerHungerMin; }; // Thirst Handler -if (EPOCH_digestThirst > 0) then { - _playerThirst = ((_playerThirst + EPOCH_digestThirst) min _playerThirstMax) max _playerThirstMin; - EPOCH_digestThirst = 0; +_digestThirst = missionNamespace getVariable ["EPOCH_digestThirst", 0]; +if (_digestThirst > 0) then { + _playerThirst = ((_playerThirst + _digestThirst) min _playerThirstMax) max _playerThirstMin; + missionNamespace setVariable ["EPOCH_digestThirst", 0]; } else { // downtick Thirst _playerThirst = ((_playerThirst - _thirstlossRate) min _playerThirstMax) max _playerThirstMin; }; // Nuisance Handler, this only allows var to increse not decrease -if (EPOCH_digestNuisance > 0) then { - _playerNuisance = ((_playerNuisance + EPOCH_digestNuisance) min _playerNuisanceMax) max _playerNuisanceMin; - EPOCH_digestNuisance = 0; +_digestNuisance = missionNamespace getVariable ["EPOCH_digestNuisance", 0]; +if (_digestNuisance > 0) then { + _playerNuisance = ((_playerNuisance + _digestNuisance) min _playerNuisanceMax) max _playerNuisanceMin; + missionNamespace setVariable ["EPOCH_digestNuisance", 0]; } else { // downtick Nuisance _playerNuisance = ((_playerNuisance - 1) min _playerNuisanceMax) max _playerNuisanceMin; }; // Radiation Handler -if (EPOCH_digestRadiation < 0 && _radsLevel == 0) then { +_digestRadiation = missionNamespace getVariable ["EPOCH_digestRadiation", 0]; +if (_digestRadiation < 0 && _radsLevel == 0) then { // only lower rads if player has taken medicine and it no longer in a radiation zone. _playerRadiation = ((_playerRadiation - 0.01) min _playerRadiationMax) max _playerRadiationMin; - EPOCH_digestRadiation = (EPOCH_digestRadiation + 1) min 0; + missionNamespace setVariable ["EPOCH_digestRadiation", (_digestRadiation + 1) min 0]; } else { // allow increase rads based on radiation levels and consumed rads - if (EPOCH_digestRadiation > 0) then { - _radsLevel = _radsLevel + EPOCH_digestRadiation; - EPOCH_digestRadiation = 0; + if (_digestRadiation > 0) then { + _radsLevel = _radsLevel + _digestRadiation; + missionNamespace setVariable ["EPOCH_digestRadiation", 0]; }; _playerRadiation = ((_playerRadiation + _radsLevel) min _playerRadiationMax) max _playerRadiationMin; }; diff --git a/Sources/epoch_config/Configs/CfgEpochClient.hpp b/Sources/epoch_config/Configs/CfgEpochClient.hpp index dc2d8e37..a6044cd8 100644 --- a/Sources/epoch_config/Configs/CfgEpochClient.hpp +++ b/Sources/epoch_config/Configs/CfgEpochClient.hpp @@ -106,19 +106,6 @@ class CfgEpochClient {"Nuisance",0,{100,0}}, {"MissionArray",{},{}} }; - // Digest System - hunger[] = { - 0, // default value - 10, // loss rate - 20, // increase rate - 1000 // max - }; - thirst[] = { - 0, // default value - 10, // loss rate - 20, // increase rate - 1000 // max - }; hudConfigs[] = { {{"BloodP","","",{"getPlayerDamage",">=",0.7}},"topRight","x\addons\a3_epoch_code\Data\UI\bleeding_ca.paa",{"forceUpdate"}},