From de1e15374b3938b9d9cb684bd5c5683858376b3b Mon Sep 17 00:00:00 2001 From: Raymix Date: Sun, 12 Nov 2017 15:10:40 +0000 Subject: [PATCH] Reduces rads over time at a cost of immunity. --- .../compile/setup/masterLoop/Event2.sqf | 1 - .../compile/setup/masterLoop/Event5.sqf | 16 +++++++++++----- .../epoch_code/compile/setup/masterLoop/init.sqf | 2 ++ Sources/epoch_config/Configs/CfgEpochClient.hpp | 5 ++++- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Sources/epoch_code/compile/setup/masterLoop/Event2.sqf b/Sources/epoch_code/compile/setup/masterLoop/Event2.sqf index 833ddfd8..750d4d9f 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/Event2.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/Event2.sqf @@ -140,7 +140,6 @@ if ((getFatigue player) >= 0.7 && _airTemp > 100) then { // toxic fever and immunity increase _playerToxicity = missionNamespace getVariable [_playerToxicityKey, _playerToxicityDefault]; -// _playerImmunity = missionNamespace getVariable [_playerImmunityKey, _playerImmunityDefault]; if (_playerToxicity > 0) then { _playerImmunity = [_playerImmunityKey,0.1,_playerImmunityMax,_playerImmunityMin] call EPOCH_fnc_setVariableLimited; _playerToxicity = [_playerToxicityKey,-0.1,_playerToxicityMax,_playerToxicityMin] call EPOCH_fnc_setVariableLimited; diff --git a/Sources/epoch_code/compile/setup/masterLoop/Event5.sqf b/Sources/epoch_code/compile/setup/masterLoop/Event5.sqf index 956b4b02..15c677de 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/Event5.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/Event5.sqf @@ -6,7 +6,7 @@ _powerSources = nearestObjects[player, ["Land_spp_Tower_F","Land_wpp_Turbine_V2_ // TODO: add more sources and config based check instead of global var // _nearestLocations removed as they don't support getVariable -// All sources used as a temp solution +// All sources used as a temp solution, please re-use as much as you can. _allSources = nearestObjects[player, ["All"], _radiatedObjMaxRange]; _nearbyRadioactiveObjects = _allSources select {(_x getVariable ["EPOCH_Rads", []]) select 0 > 0}; @@ -75,11 +75,17 @@ if (uniform player == "hazmat_placeholder") then { }; // Radiation Handler -if (_radsLevel > 0) then { - // increase rads based on radiation levels - _playerRadiation = [_playerRadiationKey,_radsLevel,_playerRadiationMax,_playerRadiationMin] call EPOCH_fnc_setVariableLimited; -}; +_playerRadiation = missionNamespace getVariable [_playerRadiationKey, _playerRadiationDefault]; +_playerImmunity = missionNamespace getVariable [_playerImmunityKey, _playerImmunityDefault]; +if (_radsLevel > 0) then { // increase rads based on radiation levels + _playerRadiation = [_playerRadiationKey,_radsLevel,_playerRadiationMax,_playerRadiationMin] call EPOCH_fnc_setVariableLimited; +} else { //Decrease rad level, but at a cost of immunity loss + if (_playerRadiation > 0) then { + _playerRadiation = [_playerRadiationKey,(_baseRadiationLoss * _playerImmunity / 100),_playerRadiationMax,_playerRadiationMin] call EPOCH_fnc_setVariableLimited; + _playerImmunity = [_playerImmunityKey,_baseRadiationLossImmunityPenalty,_playerImmunityMax,_playerImmunityMin] call EPOCH_fnc_setVariableLimited; + }; +}; if !(surfaceIsWater _position) then { if (_nearestLocations isEqualTo []) then{ if (count(player nearEntities["Animal_Base_F", 800]) < 2) then { diff --git a/Sources/epoch_code/compile/setup/masterLoop/init.sqf b/Sources/epoch_code/compile/setup/masterLoop/init.sqf index 6cd5cf6d..1e41c494 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/init.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/init.sqf @@ -115,6 +115,8 @@ _prevEnergy = missionNamespace getVariable [_playerEnergyKey, _playerEnergyDefau // init config data _antagonistRndChance = ["CfgEpochClient", "antagonistRngChance", 100] call EPOCH_fnc_returnConfigEntryV2; +_baseRadiationLoss = ["CfgEpochClient", "baseRadiationLoss", -0.1] call EPOCH_fnc_returnConfigEntryV2; +_baseRadiationLossImmunityPenalty = ["CfgEpochClient", "baseRadiationLossImmunityPenalty", -0.1] call EPOCH_fnc_returnConfigEntryV2; _baseHungerLoss = ["CfgEpochClient", "baseHungerLoss", 2] call EPOCH_fnc_returnConfigEntryV2; _baseThirstLoss = ["CfgEpochClient", "baseThirstLoss", 2] call EPOCH_fnc_returnConfigEntryV2; _baseAlcoholLoss = ["CfgEpochClient", "baseAlcoholLoss", 0.17] call EPOCH_fnc_returnConfigEntryV2; diff --git a/Sources/epoch_config/Configs/CfgEpochClient.hpp b/Sources/epoch_config/Configs/CfgEpochClient.hpp index 47da1b07..ff327dc7 100644 --- a/Sources/epoch_config/Configs/CfgEpochClient.hpp +++ b/Sources/epoch_config/Configs/CfgEpochClient.hpp @@ -24,7 +24,10 @@ class CfgEpochClient radiatedObjMaxFalloutDist = 125; // max distance radiated object can affect player (number in meters) geigerCounterEnergyUsage = 10; // default loss of 10 energy every 10sec of use radiationEffectsThreshold = 10; // default level for screen effects to indicate a player's rad dosage (0-100) - + + baseRadiationLoss = -1; //default radiation loss every 1 minute, calculated from total immunity. No immunity no reduction. + baseRadiationLossImmunityPenalty = -1; //immunity is reduced as a penalty for radiation loss effect + baseHungerLoss = 2; // increase number to speed up rate of Hunger loss baseThirstLoss = 2; // increase number to speed up rate of Thirst loss accelerateHTALoss = "true"; // use server's time acceleration to increase the rate of Hunger, Thirst and Alcohol loss