move weather temp and toxic feaver stats to master loop

This commit is contained in:
vbawol 2017-09-02 16:51:54 -05:00
parent 704dbf85e9
commit ab5ea172a4
5 changed files with 75 additions and 101 deletions

View File

@ -894,7 +894,7 @@ class FSM
" player setHitIndex [_forEachIndex, _x];" \n
"}forEach _hitpoints;" \n
"" \n
"true call EPOCH_fnc_Weather;" \n
"" \n
"[5,100] spawn EPOCH_niteLight;" \n
"" \n
"if (_debug) then {" \n

View File

@ -1,98 +0,0 @@
/*
Author: Aaron Clark - EpochMod.com
Contributors:
Description:
Calculates weather related player stats
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/functions/EPOCH_fnc_Weather.sqf
Example:
call EPOCH_fnc_Weather;
Parameter(s):
NONE
Returns:
NOTHING
*/
//[[[cog import generate_private_arrays ]]]
private ["_airTemp","_increaseWet","_isNearFire","_maxTemp","_playerPosATL","_warming","_waterTemp","_wet","_wetsuit"];
//[[[end]]]
if (isNil "EPOCH_CURRENT_WEATHER") then {
EPOCH_CURRENT_WEATHER = 75;
};
_airTemp = EPOCH_CURRENT_WEATHER;
_waterTemp = EPOCH_CURRENT_WEATHER/2;
_warming = true;
_wet = false;
_maxTemp = 98.6;
_increaseWet = 0;
_wetsuit = (getText(configfile >> "cfgweapons" >> uniform player >> "itemInfo" >> "uniformType") == "Neopren");
if (vehicle player == player) then {
_playerPosATL = getPosATL player;
if (EPOCH_playerIsSwimming) then {
// do nothing if player is wearing a wetsuit
if (!_wetsuit) then {
if (_waterTemp <= 50) then {
_warming = false;
};
_wet = true;
_increaseWet = 10;
};
} else {
if (EPOCH_playerWet > 50 && _airTemp <= 32) then {
_isNearFire = {inflamed _x} count (nearestObjects [_playerPosATL, ["ALL"], 3]);
if (!(call EPOCH_fnc_isInsideBuilding) && _isNearFire == 0) then {
_warming = false;
};
};
if (rain >= 0.25) then {
if (!_wetsuit) then {
_isNearFire = { inflamed _x } count(nearestObjects[_playerPosATL, ["ALL"], 3]);
if (!(call EPOCH_fnc_isInsideBuilding) && _isNearFire == 0) then {
_wet = true;
_increaseWet = rain * 10;
};
};
};
};
};
if ((getFatigue player) == 1 && _airTemp > 100) then {
_maxTemp = _airTemp;
};
if (EPOCH_playerToxicity > 0) then {
EPOCH_playerImmunity = (EPOCH_playerImmunity + 0.1) min 100;
EPOCH_playerToxicity = (EPOCH_playerToxicity - 0.1) max 0;
_maxTemp = 106.7 + 10;
};
if (_warming) then {
EPOCH_playerTemp = (EPOCH_playerTemp + 0.01) min _maxTemp;
} else {
EPOCH_playerTemp = (EPOCH_playerTemp - 0.01) max (95.0 - 10);
};
if (_wet) then {
EPOCH_playerWet = (EPOCH_playerWet + _increaseWet) min 100;
if (EPOCH_playerWet > 50) then {
EPOCH_playerSoiled = (EPOCH_playerSoiled - 1) max 0;
};
} else {
if (_warming) then {
EPOCH_playerWet = (EPOCH_playerWet - 1) max 0;
};
};
true

View File

@ -76,7 +76,73 @@ if !(_attackers isEqualTo[]) then {
};
};
call EPOCH_fnc_Weather;
// weather stats
_airTemp = EPOCH_CURRENT_WEATHER;
_waterTemp = EPOCH_CURRENT_WEATHER/2;
_warming = true;
_wet = false;
_maxTemp = 98.6; // normal body temp
_increaseWet = 0;
_wetsuit = (getText(configfile >> "cfgweapons" >> uniform player >> "itemInfo" >> "uniformType") == "Neopren");
if (_isOnFoot) then {
if (EPOCH_playerIsSwimming) then {
// do nothing if player is wearing a wetsuit
if (!_wetsuit) then {
if (_waterTemp <= 50) then {
_warming = false;
};
_wet = true;
_increaseWet = 10;
};
} else {
if (EPOCH_playerWet > 50 && _airTemp <= 32) then {
_isNearFire = {inflamed _x} count (nearestObjects [player, ["ALL"], 3]);
if (!(call EPOCH_fnc_isInsideBuilding) && _isNearFire == 0) then {
_warming = false;
};
};
if (rain >= 0.25) then {
if (!_wetsuit) then {
_isNearFire = { inflamed _x } count(nearestObjects[player, ["ALL"], 3]);
if (!(call EPOCH_fnc_isInsideBuilding) && _isNearFire == 0) then {
_wet = true;
_increaseWet = rain * 10;
};
};
};
};
};
// allow player to over heat if air temp is high and player is Fatigued
if ((getFatigue player) >= 0.7 && _airTemp > 100) then {
_maxTemp = _airTemp;
};
// toxic fever and immunity increase
if (EPOCH_playerToxicity > 0) then {
EPOCH_playerImmunity = (EPOCH_playerImmunity + 0.1) min 100;
EPOCH_playerToxicity = (EPOCH_playerToxicity - 0.1) max 0;
_maxTemp = 106.7 + 10;
};
if (_warming) then {
EPOCH_playerTemp = (EPOCH_playerTemp + 0.01) min _maxTemp;
} else {
EPOCH_playerTemp = (EPOCH_playerTemp - 0.01) max (95.0 - 10);
};
// wet/dry
if (_wet) then {
EPOCH_playerWet = (EPOCH_playerWet + _increaseWet) min 100;
if (EPOCH_playerWet > 50) then {
EPOCH_playerSoiled = (EPOCH_playerSoiled - 1) max 0;
};
} else {
if (_warming) then {
EPOCH_playerWet = (EPOCH_playerWet - 1) max 0;
};
};
// Hunger / Thirst
_hungerlossRate = _baseHungerLoss * timeMultiplier;

View File

@ -16,6 +16,8 @@ if (isNil "EPOCH_display_setup_complete") then {
call epoch_dynamicHUD_start;
};
_prevEquippedItem = [];
_damagePlayer = damage player;
_isOnFoot = isNull objectParent player;
@ -123,6 +125,11 @@ _lootBubble = {
EPOCH_lastPlayerPos = _playerPos;
};
// init weather temperature var if not already set
if (isNil "EPOCH_CURRENT_WEATHER") then {
EPOCH_CURRENT_WEATHER = 75;
};
_cursorTarget = objNull;
// init cfgBaseBuilding config var

View File

@ -115,7 +115,6 @@ class CfgClientFunctions
class fnc_playerDeath {};
class fnc_playerFired {};
class fnc_isInsideBuilding {};
class fnc_Weather {};
class fnc_findSafePos {};
class fnc_addItemOverflow {};
class pushCustomVar {};