DayZ 1.24
Loading...
Searching...
No Matches
Environment Class Reference
Collaboration diagram for Environment:
[legend]

Protected Member Functions

void Environment (PlayerBase pPlayer)
 
void Init (PlayerBase pPlayer)
 
void Update (float pDelta)
 
bool IsTemperatureSet ()
 
void AddToEnvironmentTemperature (float pTemperature)
 
float GetPlayerHeat ()
 Returns heat player generated based on player's movement speed (for now)
 
bool IsUnderRoof ()
 
bool IsWaterContact ()
 
bool IsInsideBuilding ()
 
bool IsInsideVehicle ()
 
bool IsRaining ()
 
void CheckUnderRoof ()
 Checks whether Player is sheltered.
 
void CheckWaterContact (out float pWaterLevel)
 
float GetTemperatureHeightCorrection ()
 
float GetWindModifierPerSurface ()
 
float GetTemperature ()
 
float GetEnvironmentTemperature ()
 
float GetWetDelta ()
 
void CollectAndSetPlayerData ()
 
void CollectAndSetEnvironmentData ()
 
void SetEnvironmentTemperature ()
 
void ProcessWetnessByRain ()
 
void ProcessWetnessByWaterLevel (float pWaterLevel)
 
void ProcessItemsWetness (array< int > pSlotIds)
 
void ProcessItemsDryness ()
 
void ApplyWetnessToItem (ItemBase pItem)
 
void ApplyDrynessToItem (ItemBase pItem)
 
void ApplyDrynessToItemEx (ItemBase pItem, EnvironmentDrynessData pDrynessData)
 
void ProcessItemsHeat ()
 Calculates and process temperature of items.
 
bool OverridenHeatComfort (out float value)
 DEPRECATED.
 
float EnvTempToCoef (float pTemp)
 
void BodyPartHeatProperties (array< int > pBodyPartIds, float pCoef, out float pHeatComfort, out float pHeat)
 returns weighted avg heat comfort for bodypart
 
void GatherTemperatureSources ()
 
void ProcessTemperatureSources ()
 
float GetUniversalSourcesTemperageAverage ()
 
float CalcTemperatureFromTemperatureSource (notnull UTemperatureSource uts)
 
string GetDebugMessage ()
 debug
 
int GetNextRoofCheck ()
 
float GetWaterLevel ()
 
float GetDayOrNight ()
 

Protected Attributes

float m_WetDryTick
 
float m_ItemsWetnessMax
 
float m_RoofCheckTimer
 keeps wetness of most wet item in player's possesion
 
PlayerBase m_Player
 
float m_PlayerHeightPos
 
float m_PlayerSpeed
 
float m_PlayerTemperature
 
float m_PlayerHeat
 
float m_HeatComfort
 
float m_Rain = 0
 
float m_Wind = 0
 
float m_Fog = 0
 
float m_DayOrNight = 0
 
float m_Clouds = 0
 
float m_EnvironmentTemperature = 0
 
float m_Time = 0
 
string m_SurfaceType
 
float m_WaterLevel
 
bool m_IsUnderRoof
 
bool m_IsInWater
 
bool m_IsTempSet
 
float m_HeatSourceTemp
 
float m_HeatBufferTimer
 DEPRECATED.
 
ref array< intm_SlotIdsComplete
 
ref array< intm_SlotIdsUpper
 
ref array< intm_SlotIdsBottom
 
ref array< intm_SlotIdsLower
 
ref array< intm_HeadParts
 
ref array< intm_BodyParts
 
ref array< intm_FeetParts
 
ref SimpleMovingAverage< floatm_WindAverageBuffer
 
bool m_HasTemperatureSources
 
float m_UTSAverageTemperature
 
ref array< UTemperatureSourcem_UTemperatureSources
 
ref SimpleMovingAverage< floatm_UTSAverageTemperatureBuffer
 

Private Member Functions

bool IsUnderRoofBuilding ()
 
void LogDryWetProcess (string message, bool indented=false)
 

Private Attributes

const float RAIN_LIMIT_LOW = 0.05
 
const float WATER_LEVEL_HIGH = 1.5
 
const float WATER_LEVEL_MID = 1.2
 
const float WATER_LEVEL_LOW = 0.5
 
const float WATER_LEVEL_NONE = 0.15
 
bool m_IsUnderRoofBuilding
 

Detailed Description

Definition at line 1 of file Environment.c.

Constructor & Destructor Documentation

◆ Environment()

void Environment::Environment ( PlayerBase pPlayer)
inlineprotected

Definition at line 64 of file Environment.c.

65 {
67 }
override Widget Init()
Definition DayZGame.c:120

References Init().

Member Function Documentation

◆ AddToEnvironmentTemperature()

void Environment::AddToEnvironmentTemperature ( float pTemperature)
protected

◆ ApplyDrynessToItem()

void Environment::ApplyDrynessToItem ( ItemBase pItem)
inlineprotected

Definition at line 631 of file Environment.c.

632 {
635 }
void ApplyDrynessToItemEx(ItemBase pItem, EnvironmentDrynessData pDrynessData)

References ApplyDrynessToItemEx().

◆ ApplyDrynessToItemEx()

void Environment::ApplyDrynessToItemEx ( ItemBase pItem,
EnvironmentDrynessData pDrynessData )
inlineprotected

adds wetness to item inside parent item containing liquid

adds wetness to item inside wet parent item

Definition at line 637 of file Environment.c.

638 {
639 if (pItem)
640 {
641 float dryingIncrement = pItem.GetDryingIncrement("player");
642 if (pDrynessData.m_UseTemperatureSources)
643 dryingIncrement = pItem.GetDryingIncrement("playerHeatSource");
644
646 bool isParentWet = false;
647 bool parentContainsLiquid = false;
648
650 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
651 {
652 EntityAI parent = iLoc.GetParent();
653 if (parent)
654 {
655 parentItem = ItemBase.Cast(parent);
656 if (parentItem)
657 {
659 isParentWet = true;
660
661 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
663 }
664
665 if ((pItem.GetWet() > m_ItemsWetnessMax) && (parent == m_Player))
666 m_ItemsWetnessMax = pItem.GetWet();
667 }
668 }
669
670 float dryingCoef = 0;
671
673 {
674
675 dryingCoef = (-1 * GameConstants.ENVIRO_TICK_RATE * dryingIncrement) / pDrynessData.m_TemperatureSourceDistance;
676 if (pItem.GetWet() >= GameConstants.STATE_DAMP)
677 {
678 LogDryWetProcess(string.Format("%1 (dry coef=%2/s, current wetness=%3) [normal]", pItem.GetDisplayName(), dryingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
679 pItem.AddWet(dryingCoef);
680 }
681
682 if (pItem.GetInventory().GetCargo())
683 {
684 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
685 for (int i = 0; i < inItemCount; i++)
686 {
688 if (Class.CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
690 }
691 }
692
693 int attCount = pItem.GetInventory().AttachmentCount();
694 if (attCount > 0)
695 {
696 for (int attIdx = 0; attIdx < attCount; attIdx++)
697 {
698 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
700 if (ItemBase.CastTo(itemAtt, attachment))
702 }
703 }
704
706 }
707
709 {
711 dryingCoef = (GameConstants.ENVIRO_TICK_RATE * pItem.GetSoakingIncrement("parentWithLiquid")) / pDrynessData.m_TemperatureSourceDistance;
712 LogDryWetProcess(string.Format("%1 (dry coef=%2/s, current wetness=%3) [parent contains liquid]", pItem.GetDisplayName(), dryingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
713 pItem.AddWet(dryingCoef);
715 }
716
717 if (isParentWet)
718 {
719 if (pItem.GetWet() < parentItem.GetWet())
720 {
722 dryingCoef = (GameConstants.ENVIRO_TICK_RATE * pItem.GetSoakingIncrement("wetParent")) / pDrynessData.m_TemperatureSourceDistance;
723 LogDryWetProcess(string.Format("%1 (dry coef=%2/s, current wetness=%3) [parent wet]", pItem.GetDisplayName(), dryingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
724 pItem.AddWet(dryingCoef);
725 }
726
728 }
729 }
730 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
PlayerBase m_Player
Definition Environment.c:15
float m_ItemsWetnessMax
Definition Environment.c:11
void LogDryWetProcess(string message, bool indented=false)
InventoryLocation.
const float TEMPERATURE_RATE_COOLING_PLAYER
Definition constants.c:811
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const float ENVIRO_TICK_RATE
Definition constants.c:671
const float STATE_DAMP
Definition constants.c:784
const float STATE_SOAKING_WET
Definition constants.c:782

References ApplyDrynessToItemEx(), Class::CastTo(), GameConstants::ENVIRO_TICK_RATE, LogDryWetProcess(), m_ItemsWetnessMax, m_Player, GameConstants::STATE_DAMP, GameConstants::STATE_SOAKING_WET, and GameConstants::TEMPERATURE_RATE_COOLING_PLAYER.

Referenced by ApplyDrynessToItem(), ApplyDrynessToItemEx(), and ProcessItemsDryness().

◆ ApplyWetnessToItem()

void Environment::ApplyWetnessToItem ( ItemBase pItem)
inlineprotected

Definition at line 549 of file Environment.c.

550 {
551 if (pItem)
552 {
554 bool isParentWet = false;
555 bool parentContainsLiquid = false;
557
558 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
559 {
560 EntityAI parent = iLoc.GetParent();
561 if (parent)
562 {
563 parentItem = ItemBase.Cast(parent);
564 if (parentItem)
565 {
567 isParentWet = true;
568
569 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
571 }
572 else
573 isParentWet = true;
574
575 if ((pItem.GetWet() > m_ItemsWetnessMax) && (parent == m_Player))
576 m_ItemsWetnessMax = pItem.GetWet();
577 }
578 }
579
581 {
582 float soakingCoef = 0;
584 {
585 soakingCoef = pItem.GetSoakingIncrement("parentWithLiquid");
586 LogDryWetProcess(string.Format("%1 (soak coef=%2/s, current wetness=%3) [parent contains liquid]", pItem.GetDisplayName(), soakingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
587 }
588 else if (isParentWet && parentItem)
589 {
590 if (pItem.GetWet() < parentItem.GetWet())
591 {
592 soakingCoef = pItem.GetSoakingIncrement("wetParent");
593 LogDryWetProcess(string.Format("%1 (soak coef=%2/s, current wetness=%3) [parent wet]", pItem.GetDisplayName(), soakingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
594 }
595 }
596 else
597 {
599 LogDryWetProcess(string.Format("%1 (soak coef=%2/s, current wetness=%3) [normal]", pItem.GetDisplayName(), soakingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
600 }
601
602 pItem.AddWet(soakingCoef);
603 pItem.AddTemperature(GameConstants.ENVIRO_TICK_RATE * GameConstants.TEMPERATURE_RATE_COOLING_PLAYER * pItem.GetSoakingIncrement("wetParent"));
604
605 if (pItem.GetInventory().GetCargo())
606 {
607 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
608 for (int i = 0; i < inItemCount; i++)
609 {
611 if (Class.CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
613 }
614 }
615
616 int attCount = pItem.GetInventory().AttachmentCount();
617 if (attCount > 0)
618 {
619 for (int attIdx = 0; attIdx < attCount; attIdx++)
620 {
621 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
623 if (itemAtt)
625 }
626 }
627 }
628 }
629 }
float GetWetDelta()
void ApplyWetnessToItem(ItemBase pItem)

References ApplyWetnessToItem(), Class::CastTo(), GameConstants::ENVIRO_TICK_RATE, GetWetDelta(), LogDryWetProcess(), m_ItemsWetnessMax, m_Player, GameConstants::STATE_SOAKING_WET, and GameConstants::TEMPERATURE_RATE_COOLING_PLAYER.

Referenced by ApplyWetnessToItem(), and ProcessItemsWetness().

◆ BodyPartHeatProperties()

void Environment::BodyPartHeatProperties ( array< int > pBodyPartIds,
float pCoef,
out float pHeatComfort,
out float pHeat )
inlineprotected

returns weighted avg heat comfort for bodypart

go through all body parts we've defined for that zone (ex.: head, body, feet)

Definition at line 806 of file Environment.c.

807 {
808 int attCount;
809
812
813 pHeatComfort = -1;
814 attCount = m_Player.GetInventory().AttachmentCount();
815
816 for (int attIdx = 0; attIdx < attCount; attIdx++)
817 {
818 attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
819 if (attachment.IsClothing())
820 {
821 item = ItemBase.Cast(attachment);
822 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
823
825 for (int i = 0; i < pBodyPartIds.Count(); i++)
826 {
827 if (attachmentSlot == pBodyPartIds.Get(i))
828 {
829 float heatIsoMult = 1.0;
830 if (attachmentSlot == InventorySlots.VEST)
832
833 if (attachmentSlot == InventorySlots.BACK)
835
836 pHeatComfort += heatIsoMult * MiscGameplayFunctions.GetCurrentItemHeatIsolation(item);
837
838 // go through any attachments and cargo (only current level, ignore nested containers - they isolate)
839 int inAttCount = item.GetInventory().AttachmentCount();
840 if (inAttCount > 0)
841 {
842 for (int inAttIdx = 0; inAttIdx < inAttCount; inAttIdx++)
843 {
844 EntityAI inAttachment = item.GetInventory().GetAttachmentFromIndex(inAttIdx);
846 if (itemAtt)
847 pHeat += itemAtt.GetTemperature();
848 }
849 }
850 if (item.GetInventory().GetCargo())
851 {
852 int inItemCount = item.GetInventory().GetCargo().GetItemCount();
853
854 for (int j = 0; j < inItemCount; j++)
855 {
857 if (Class.CastTo(inItem, item.GetInventory().GetCargo().GetItem(j)))
858 pHeat += inItem.GetTemperature();
859 }
860 }
861 }
862 }
863 }
864 }
865
867 pHeat = (pHeat / pBodyPartIds.Count()) * pCoef;
868 }
provides access to slot configuration
const float ENVIRO_HEATISOLATION_VEST_WEIGHT
weight of back for the sum of heat isolation
Definition constants.c:699
const float ENVIRO_HEATISOLATION_BACK_WEIGHT
how much this feet parts (clothing) affects final heatcomfort
Definition constants.c:698

References Class::CastTo(), GameConstants::ENVIRO_HEATISOLATION_BACK_WEIGHT, GameConstants::ENVIRO_HEATISOLATION_VEST_WEIGHT, and m_Player.

Referenced by ProcessItemsHeat().

◆ CalcTemperatureFromTemperatureSource()

float Environment::CalcTemperatureFromTemperatureSource ( notnull UTemperatureSource uts)
inlineprotected

heat transfer through air to player (env temperature)

dist factor minimum should be at 0

Definition at line 928 of file Environment.c.

929 {
930 float distance = vector.Distance(m_Player.GetPosition(), uts.GetPosition());
931 distance = Math.Max(distance, 0.1); //min distance cannot be 0 (division by zero)
932 float temperature = 0;
933
934 //Debug.Log(string.Format("CalcTemperatureFromTemperatureSource::distance: %1", distance), "Environment");
935
937 if (distance > uts.GetFullRange())
938 {
939 float distFactor = 1 - (distance / uts.GetMaxRange());
940 distFactor = Math.Max(distFactor, 0.0);
941 temperature = uts.GetTemperature() * distFactor;
942 //temperature = Math.Clamp(temperature, uts.GetTemperatureMin(), uts.GetTemperatureMax());
943 //Debug.Log(string.Format("CalcTemperatureFromTemperatureSource::distFactor: %1", distFactor), "Environment");
944 //Debug.Log(string.Format("CalcTemperatureFromTemperatureSource::temperatureXX: %1", temperature), "Environment");
945 }
946 else
947 temperature = uts.GetTemperature();
948
949 //Debug.Log(string.Format("CalcTemperatureFromTemperatureSource::temperature: %1", temperature), "Environment");
950
951 return temperature;
952 }
Definition EnMath.c:7
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
static proto float Max(float x, float y)
Returns bigger of two given values.

References vector::Distance(), m_Player, and Math::Max().

Referenced by ProcessTemperatureSources().

◆ CheckUnderRoof()

void Environment::CheckUnderRoof ( )
inlineprotected

Checks whether Player is sheltered.

Definition at line 256 of file Environment.c.

257 {
258 // if inside vehicle return immediatelly
259 if (IsInsideVehicle())
260 {
261 m_IsUnderRoof = false;
262 m_IsUnderRoofBuilding = false;
263 return;
264 }
265
266 float hitFraction;
268 vector from = m_Player.GetPosition();
269 vector to = from + "0 25 0";
272
274
276 }
PhxInteractionLayers
Definition DayZPhysics.c:2
static proto bool RayCastBullet(vector begPos, vector endPos, PhxInteractionLayers layerMask, Object ignoreObj, out Object hitObject, out vector hitPosition, out vector hitNormal, out float hitFraction)
bool IsInsideVehicle()
bool m_IsUnderRoofBuilding
Definition Environment.c:35
bool m_IsUnderRoof
Definition Environment.c:34

References IsInsideVehicle(), m_IsUnderRoof, m_IsUnderRoofBuilding, m_Player, and DayZPhysics::RayCastBullet().

Referenced by Update().

◆ CheckWaterContact()

void Environment::CheckWaterContact ( out float pWaterLevel)
inlineprotected

no valid surface under character

sync info about water contact to player

update active surface

Definition at line 278 of file Environment.c.

279 {
280 m_IsInWater = false;
281 if (m_Player.IsSwimming())
282 {
283 m_IsInWater = true;
285 m_Player.GetMovementState(hms);
287 if (hms.m_iMovement >= DayZPlayerConstants.MOVEMENTIDX_WALK)
289
290 return;
291 }
292
295 {
296 m_IsInWater = false;
297 return;
298 }
299
300 string surfType;
301 int liquidType;
302
303 g_Game.SurfaceUnderObject(m_Player, surfType, liquidType);
304
305 switch (liquidType)
306 {
307 case 0: // sea
308 case LIQUID_WATER:
310 pWaterLevel = m_Player.GetCurrentWaterLevel();
311 m_IsInWater = true;
312 break;
313 }
314
316 m_Player.SetInWater(m_IsInWater);
317
320 }
DayZGame g_Game
Definition DayZGame.c:3528
const float WATER_LEVEL_HIGH
Definition Environment.c:5
string m_SurfaceType
Definition Environment.c:30
bool IsUnderRoofBuilding()
const float WATER_LEVEL_MID
Definition Environment.c:6
bool m_IsInWater
Definition Environment.c:36
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
const int LIQUID_WATER
Definition constants.c:504
const int LIQUID_RIVERWATER
Definition constants.c:505

References g_Game, IsUnderRoofBuilding(), LIQUID_RIVERWATER, LIQUID_WATER, m_IsInWater, m_Player, m_SurfaceType, WATER_LEVEL_HIGH, and WATER_LEVEL_MID.

Referenced by Update().

◆ CollectAndSetEnvironmentData()

void Environment::CollectAndSetEnvironmentData ( )
inlineprotected

Definition at line 429 of file Environment.c.

430 {
431 Weather weather = g_Game.GetWeather();
432 m_Rain = weather.GetRain().GetActual();
433 m_DayOrNight = g_Game.GetWorld().GetSunOrMoon();
434 m_Fog = weather.GetFog().GetActual();
435 m_Clouds = weather.GetOvercast().GetActual();
436 m_Wind = m_WindAverageBuffer.Add(weather.GetWindSpeed() / weather.GetWindMaximumSpeed());
437
439 }
float m_Clouds
Definition Environment.c:27
ref SimpleMovingAverage< float > m_WindAverageBuffer
Definition Environment.c:51
float m_DayOrNight
Definition Environment.c:26
void SetEnvironmentTemperature()

References g_Game, m_Clouds, m_DayOrNight, m_Fog, m_Rain, m_Wind, m_WindAverageBuffer, and SetEnvironmentTemperature().

Referenced by Update().

◆ CollectAndSetPlayerData()

void Environment::CollectAndSetPlayerData ( )
inlineprotected

Definition at line 416 of file Environment.c.

417 {
418 vector playerPos = m_Player.GetPosition();
420
421 HumanCommandMove hcm = m_Player.GetCommand_Move();
422 if (hcm)
423 m_PlayerSpeed = hcm.GetCurrentMovementSpeed();
424
426 }
float GetPlayerHeat()
Returns heat player generated based on player's movement speed (for now)
float m_PlayerHeat
Definition Environment.c:19
float m_PlayerSpeed
Definition Environment.c:17
float m_PlayerHeightPos
Definition Environment.c:16

References GetPlayerHeat(), m_Player, m_PlayerHeat, m_PlayerHeightPos, and m_PlayerSpeed.

Referenced by Update().

◆ EnvTempToCoef()

float Environment::EnvTempToCoef ( float pTemp)
inlineprotected

Definition at line 794 of file Environment.c.

795 {
797 return 1;
798
800 return -1;
801
803 }
const float ENVIRO_TEMP_EFFECT_ON_PLAYER
comfort temperature of environment for the player
Definition constants.c:703
const float ENVIRO_HIGH_TEMP_LIMIT
lowest temperature(deg Celsius) where the player gets lowest possible heat comfort (-1)
Definition constants.c:701
const float ENVIRO_PLAYER_COMFORT_TEMP
highest temperature(deg Celsius) where the player gets highest possible heat comfort (1)
Definition constants.c:702
const float ENVIRO_LOW_TEMP_LIMIT
weight of vest for the sum of heat isolation
Definition constants.c:700

References GameConstants::ENVIRO_HIGH_TEMP_LIMIT, GameConstants::ENVIRO_LOW_TEMP_LIMIT, GameConstants::ENVIRO_PLAYER_COMFORT_TEMP, and GameConstants::ENVIRO_TEMP_EFFECT_ON_PLAYER.

Referenced by ProcessItemsHeat().

◆ GatherTemperatureSources()

void Environment::GatherTemperatureSources ( )
inlineprotected

next temp source is too far

Definition at line 870 of file Environment.c.

871 {
872 m_UTemperatureSources.Clear();
873
876
878 {
880 if (ent && ent.IsUniversalTemperatureSource() && ent != m_Player)
881 {
883 if (vector.DistanceSq(m_Player.GetPosition(), ent.GetPosition()) > Math.SqrFloat(ent.GetUniversalTemperatureSource().GetMaxRange()))
884 continue;
885
886 m_UTemperatureSources.Insert(ent.GetUniversalTemperatureSource());
887 }
888 }
889
890 if (m_Player.GetItemInHands() && m_Player.GetItemInHands().IsUniversalTemperatureSource())
891 m_UTemperatureSources.Insert(m_Player.GetItemInHands().GetUniversalTemperatureSource());
892 }
ref array< UTemperatureSource > m_UTemperatureSources
Definition Environment.c:55
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
proto native CGame GetGame()
const float ENVIRO_TEMP_SOURCES_LOOKUP_RADIUS
Definition constants.c:721
static proto float SqrFloat(float f)
Returns squared value.

References vector::DistanceSq(), GameConstants::ENVIRO_TEMP_SOURCES_LOOKUP_RADIUS, GetGame(), m_Player, m_UTemperatureSources, and Math::SqrFloat().

Referenced by Update().

◆ GetDayOrNight()

float Environment::GetDayOrNight ( )
inlineprotected

Definition at line 1051 of file Environment.c.

1052 {
1053 return m_DayOrNight;
1054 }

References m_DayOrNight.

◆ GetDebugMessage()

string Environment::GetDebugMessage ( )
inlineprotected

debug

Definition at line 1014 of file Environment.c.

1015 {
1016 string message;
1017 message += "Player stats";
1018 message += "\nHeat comfort: " + m_HeatComfort.ToString();
1019 message += "\nInside: " + IsInsideBuilding().ToString() + " (" + m_Player.GetSurfaceType() + ")";
1020 message += "\nUnder roof: " + m_IsUnderRoof.ToString() + " (" + GetNextRoofCheck() + ")";
1022 message += "\nWater Level: " + m_WaterLevel;
1023
1024 message += "\n\nWeather stats";
1025 message += "\nEnv temperature (base): " + g_Game.GetMission().GetWorldData().GetBaseEnvTemperature().ToString();
1026 message += "\nEnv temperature (modified): " + m_EnvironmentTemperature.ToString();
1027 message += "\nWind: " + m_Wind.ToString() + " (x" + GetWindModifierPerSurface() + ")";
1028 message += "\nRain: " + m_Rain.ToString();
1029 message += "\nDay/Night (1/0): " + m_DayOrNight.ToString();
1030 message += "\nFog: " + m_Fog.ToString();
1031 message += "\nClouds: " + m_Clouds.ToString();
1032 message += "\nHeight: " + GetTemperatureHeightCorrection().ToString();
1033 message += "\nWet delta: " + GetWetDelta().ToString();
1034
1035 return message;
1036 }
bool IsWaterContact()
float m_EnvironmentTemperature
Definition Environment.c:28
float m_WaterLevel
Definition Environment.c:33
float GetTemperatureHeightCorrection()
const float WATER_LEVEL_NONE
Definition Environment.c:8
float GetWindModifierPerSurface()
float m_HeatComfort
Definition Environment.c:20
int GetNextRoofCheck()
bool IsInsideBuilding()
string ToString()
Definition EnConvert.c:3
proto string ToString()

References g_Game, GetNextRoofCheck(), GetTemperatureHeightCorrection(), GetWetDelta(), GetWindModifierPerSurface(), IsInsideBuilding(), IsWaterContact(), m_Clouds, m_DayOrNight, m_EnvironmentTemperature, m_Fog, m_HeatComfort, m_IsUnderRoof, m_Player, m_Rain, m_WaterLevel, m_Wind, bool::ToString(), float::ToString(), and WATER_LEVEL_NONE.

◆ GetEnvironmentTemperature()

float Environment::GetEnvironmentTemperature ( )
inlineprotected

Definition at line 344 of file Environment.c.

345 {
346 float temperature;
347 temperature = g_Game.GetMission().GetWorldData().GetBaseEnvTemperature();
349
350 if (IsWaterContact())
352
355 else if (IsInsideVehicle())
357 else if (IsUnderRoof() && !m_IsUnderRoofBuilding)
358 {
361 }
362 else
363 {
367 }
368
369 // incorporate temperature from temperature sources (buffer)
372
373 return temperature;
374 }
float m_UTSAverageTemperature
Definition Environment.c:54
bool IsUnderRoof()
const float ENVIRO_TEMPERATURE_UNDERROOF_COEF
increases temp inside vehicles
Definition constants.c:690
const float ENVIRO_WATER_TEMPERATURE_COEF
converts temperature of items to entities heatcomfort gain
Definition constants.c:685
const float ENVIRO_CLOUDS_TEMP_EFFECT
how many % of ENVIRO_SUN_INCREMENT is reduced by fog
Definition constants.c:680
const float ENVIRO_FOG_TEMP_EFFECT
how many % of environment temperature can be lowered by clouds
Definition constants.c:681
const float ENVIRO_TEMPERATURE_INSIDE_VEHICLE_COEF
increases temp in interiors
Definition constants.c:689
const float ENVIRO_TEMPERATURE_INSIDE_COEF
amount of ?C reduced for each 100 meteres of height above water level
Definition constants.c:688
const float ENVIRO_TEMPERATURE_WIND_COEF
Definition constants.c:691
static proto float AbsFloat(float f)
Returns absolute value.

References Math::AbsFloat(), GameConstants::ENVIRO_CLOUDS_TEMP_EFFECT, GameConstants::ENVIRO_FOG_TEMP_EFFECT, GameConstants::ENVIRO_TEMPERATURE_INSIDE_COEF, GameConstants::ENVIRO_TEMPERATURE_INSIDE_VEHICLE_COEF, GameConstants::ENVIRO_TEMPERATURE_UNDERROOF_COEF, GameConstants::ENVIRO_TEMPERATURE_WIND_COEF, GameConstants::ENVIRO_WATER_TEMPERATURE_COEF, g_Game, GetTemperatureHeightCorrection(), GetWindModifierPerSurface(), IsInsideBuilding(), IsInsideVehicle(), IsUnderRoof(), IsWaterContact(), m_Clouds, m_Fog, m_IsUnderRoofBuilding, m_UTSAverageTemperature, and m_Wind.

Referenced by GetWetDelta(), and SetEnvironmentTemperature().

◆ GetNextRoofCheck()

int Environment::GetNextRoofCheck ( )
inlineprotected

Definition at line 1038 of file Environment.c.

1039 {
1041 }
float m_RoofCheckTimer
keeps wetness of most wet item in player's possesion
Definition Environment.c:12
const float ENVIRO_TICK_ROOF_RC_CHECK
each X (ticks) is processed wetness on items on player
Definition constants.c:673

References GameConstants::ENVIRO_TICK_ROOF_RC_CHECK, and m_RoofCheckTimer.

Referenced by GetDebugMessage().

◆ GetPlayerHeat()

float Environment::GetPlayerHeat ( )
inlineprotected

Returns heat player generated based on player's movement speed (for now)

Definition at line 219 of file Environment.c.

220 {
222 return heat;
223 }
const float ENVIRO_DEFAULT_ENTITY_HEAT
how many time is water colder than air
Definition constants.c:686

References GameConstants::ENVIRO_DEFAULT_ENTITY_HEAT, m_PlayerSpeed, and Math::Max().

Referenced by CollectAndSetPlayerData(), and ProcessItemsHeat().

◆ GetTemperature()

float Environment::GetTemperature ( )
inlineprotected

Definition at line 338 of file Environment.c.

339 {
341 }

References m_EnvironmentTemperature.

◆ GetTemperatureHeightCorrection()

float Environment::GetTemperatureHeightCorrection ( )
inlineprotected

Definition at line 324 of file Environment.c.

325 {
328 }
const float ENVIRO_TEMPERATURE_HEIGHT_REDUCTION
heat entity generates if not moving
Definition constants.c:687

References GameConstants::ENVIRO_TEMPERATURE_HEIGHT_REDUCTION, m_PlayerHeightPos, and Math::Max().

Referenced by GetDebugMessage(), and GetEnvironmentTemperature().

◆ GetUniversalSourcesTemperageAverage()

float Environment::GetUniversalSourcesTemperageAverage ( )
inlineprotected

Definition at line 923 of file Environment.c.

924 {
926 }

References m_UTSAverageTemperature.

◆ GetWaterLevel()

float Environment::GetWaterLevel ( )
inlineprotected

Definition at line 1043 of file Environment.c.

1044 {
1046 return m_WaterLevel;
1047 else
1048 return 0;
1049 }

References IsWaterContact(), m_WaterLevel, and WATER_LEVEL_NONE.

◆ GetWetDelta()

float Environment::GetWetDelta ( )
inlineprotected

player is getting wet by movement/swimming in water (+differentiate wetDelta by water level)

player is getting wet from rain

player is drying

Definition at line 377 of file Environment.c.

378 {
379 float wetDelta = 0;
380 if (IsWaterContact())
381 {
384 wetDelta = 1;
386 wetDelta = 0.66;
388 wetDelta = 0.66;
390 wetDelta = 0.33;
391 }
392 else if (IsRaining() && !IsInsideBuilding() && !IsUnderRoof() && !IsInsideVehicle())
393 {
396 }
397 else
398 {
401
403 if (weatherEffect <= 0)
404 weatherEffect = 1.0;
405
407 if (!IsInsideBuilding())
409 }
410
411 return wetDelta;
412 }
float GetEnvironmentTemperature()
bool IsRaining()
const float WATER_LEVEL_LOW
Definition Environment.c:7
const float ENVIRO_FOG_DRY_EFFECT
how many % of ENVIRO_SUN_INCREMENT is reduced by cloudy sky
Definition constants.c:679
const float ENVIRO_DRY_INCREMENT
amount of wetness added to items wet value each tick if is raining
Definition constants.c:675
const float ENVIRO_CLOUD_DRY_EFFECT
how much is the generic temp effect increased when player is next to a fireplace
Definition constants.c:678
const float ENVIRO_WET_INCREMENT
in secs. how often we should check if player is under the roof (raycast)
Definition constants.c:674
const float ENVIRO_TICKS_TO_WETNESS_CALCULATION
in secs. how often should enviro effet process
Definition constants.c:672
const float ENVIRO_WIND_EFFECT
windchill effect on base temperature
Definition constants.c:692

References GameConstants::ENVIRO_CLOUD_DRY_EFFECT, GameConstants::ENVIRO_DRY_INCREMENT, GameConstants::ENVIRO_FOG_DRY_EFFECT, GameConstants::ENVIRO_TICKS_TO_WETNESS_CALCULATION, GameConstants::ENVIRO_WET_INCREMENT, GameConstants::ENVIRO_WIND_EFFECT, GetEnvironmentTemperature(), IsInsideBuilding(), IsInsideVehicle(), IsRaining(), IsUnderRoof(), IsWaterContact(), m_Clouds, m_Fog, m_PlayerHeat, m_Rain, m_WaterLevel, m_Wind, Math::Max(), WATER_LEVEL_HIGH, WATER_LEVEL_LOW, WATER_LEVEL_MID, and WATER_LEVEL_NONE.

Referenced by ApplyWetnessToItem(), and GetDebugMessage().

◆ GetWindModifierPerSurface()

float Environment::GetWindModifierPerSurface ( )
inlineprotected

Definition at line 330 of file Environment.c.

331 {
333 return 0.0;
334
335 return g_Game.ConfigGetFloat("CfgSurfaces " + m_SurfaceType + " windModifier");
336 }

References g_Game, IsUnderRoofBuilding(), and m_SurfaceType.

Referenced by GetDebugMessage(), and GetEnvironmentTemperature().

◆ Init()

void Environment::Init ( PlayerBase pPlayer)
inlineprotected

whole body slots

upper body part slots

bottom body part slots

lower body part slots


heat comfort related slots

Definition at line 69 of file Environment.c.

70 {
72 m_PlayerSpeed = 0.0;
73 m_WetDryTick = 0.0;
74 m_RoofCheckTimer = 0.0;
75 m_WaterLevel = 0.0;
76 m_HeatComfort = 0.0;
77
78 m_IsUnderRoof = false;
79 m_IsInWater = false;
80 m_SurfaceType = "cp_dirt";
81
83
85
89
93 InventorySlots.HEADGEAR,
94 InventorySlots.MASK,
95 InventorySlots.EYEWEAR,
96 InventorySlots.GLOVES,
97 InventorySlots.ARMBAND,
98 InventorySlots.BODY,
99 InventorySlots.HIPS,
100 InventorySlots.VEST,
101 InventorySlots.BACK,
102 InventorySlots.LEGS,
103 InventorySlots.FEET
104 };
108 InventorySlots.GLOVES,
109 InventorySlots.ARMBAND,
110 InventorySlots.BODY,
111 InventorySlots.HIPS,
112 InventorySlots.VEST,
113 InventorySlots.BACK,
114 InventorySlots.LEGS,
115 InventorySlots.FEET
116 };
120 InventorySlots.HIPS,
121 InventorySlots.LEGS,
122 InventorySlots.FEET
123 };
127 InventorySlots.FEET,
128 };
129
133 m_HeadParts = {
134 InventorySlots.HEADGEAR,
135 InventorySlots.MASK,
136 };
137
139 m_BodyParts = {
140 InventorySlots.GLOVES,
141
142 InventorySlots.BODY,
143 InventorySlots.BACK,
144 InventorySlots.VEST,
145 };
146
148 m_FeetParts = {
149 InventorySlots.LEGS,
150 InventorySlots.FEET,
151 };
152 }
ref array< int > m_SlotIdsBottom
Definition Environment.c:44
ref array< int > m_SlotIdsComplete
Definition Environment.c:42
ref array< int > m_SlotIdsLower
Definition Environment.c:45
ref SimpleMovingAverage< float > m_UTSAverageTemperatureBuffer
Definition Environment.c:56
ref array< int > m_SlotIdsUpper
Definition Environment.c:43
float m_WetDryTick
Definition Environment.c:10
ref array< int > m_BodyParts
Definition Environment.c:48
ref array< int > m_FeetParts
Definition Environment.c:49
float m_HeatBufferTimer
DEPRECATED.
Definition Environment.c:40
ref array< int > m_HeadParts
Definition Environment.c:47

References m_BodyParts, m_FeetParts, m_HeadParts, m_HeatBufferTimer, m_HeatComfort, m_IsInWater, m_IsUnderRoof, m_Player, m_PlayerSpeed, m_RoofCheckTimer, m_SlotIdsBottom, m_SlotIdsComplete, m_SlotIdsLower, m_SlotIdsUpper, m_SurfaceType, m_UTemperatureSources, m_UTSAverageTemperature, m_UTSAverageTemperatureBuffer, m_WaterLevel, m_WetDryTick, and m_WindAverageBuffer.

◆ IsInsideBuilding()

bool Environment::IsInsideBuilding ( )
inlineprotected

Definition at line 235 of file Environment.c.

236 {
237 return m_Player && m_Player.IsSoundInsideBuilding();
238 }

References m_Player.

Referenced by GetDebugMessage(), GetEnvironmentTemperature(), GetWetDelta(), and Update().

◆ IsInsideVehicle()

bool Environment::IsInsideVehicle ( )
inlineprotected

Definition at line 240 of file Environment.c.

241 {
242 return m_Player && m_Player.IsInVehicle();
243 }

References m_Player.

Referenced by CheckUnderRoof(), GetEnvironmentTemperature(), GetWetDelta(), and Update().

◆ IsRaining()

bool Environment::IsRaining ( )
inlineprotected

Definition at line 250 of file Environment.c.

251 {
252 return m_Rain > RAIN_LIMIT_LOW;
253 }
const float RAIN_LIMIT_LOW
Definition Environment.c:3

References m_Rain, and RAIN_LIMIT_LOW.

Referenced by GetWetDelta(), and Update().

◆ IsTemperatureSet()

bool Environment::IsTemperatureSet ( )
inlineprotected

Definition at line 210 of file Environment.c.

211 {
212 return m_IsTempSet;
213 }
bool m_IsTempSet
Definition Environment.c:37

References m_IsTempSet.

◆ IsUnderRoof()

bool Environment::IsUnderRoof ( )
inlineprotected

Definition at line 225 of file Environment.c.

226 {
227 return m_IsUnderRoof;
228 }

References m_IsUnderRoof.

Referenced by GetEnvironmentTemperature(), GetWetDelta(), and Update().

◆ IsUnderRoofBuilding()

bool Environment::IsUnderRoofBuilding ( )
inlineprivate

Definition at line 245 of file Environment.c.

246 {
248 }

References m_IsUnderRoofBuilding.

Referenced by CheckWaterContact(), and GetWindModifierPerSurface().

◆ IsWaterContact()

bool Environment::IsWaterContact ( )
inlineprotected

Definition at line 230 of file Environment.c.

231 {
232 return m_IsInWater;
233 }

References m_IsInWater.

Referenced by GetDebugMessage(), GetEnvironmentTemperature(), GetWaterLevel(), GetWetDelta(), and Update().

◆ LogDryWetProcess()

void Environment::LogDryWetProcess ( string message,
bool indented = false )
inlineprivate

Definition at line 1056 of file Environment.c.

1057 {
1058#ifdef DIAG_DEVELOPER
1059 if (m_DebugLogDryWet)
1060 {
1061 string indentation = "";
1062 if (indented)
1063 indentation = "|--";
1064
1065 Debug.Log(string.Format("%1 %2", indentation, message));
1066 }
1067#endif
1068 }
Definition Debug.c:14
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133

References Debug::Log().

Referenced by ApplyDrynessToItemEx(), ApplyWetnessToItem(), ProcessItemsDryness(), and ProcessItemsWetness().

◆ OverridenHeatComfort()

bool Environment::OverridenHeatComfort ( out float value)
protected

DEPRECATED.

◆ ProcessItemsDryness()

void Environment::ProcessItemsDryness ( )
inlineprotected

Definition at line 513 of file Environment.c.

514 {
517
518 int attCount = m_Player.GetInventory().AttachmentCount();
519
520 LogDryWetProcess(string.Format("Environment :: ProcessItemsDryness (update interval=%1s)", GameConstants.ENVIRO_TICK_RATE));
522 drynessData.m_UseTemperatureSources = m_HasTemperatureSources;
523
525 {
527 distance = Math.Max(distance, 0.1);
528 drynessData.m_TemperatureSourceDistance = distance;
529 LogDryWetProcess(string.Format("distance to heatsource: %1 m", distance));
530 }
531
532 for (int attIdx = 0; attIdx < attCount; attIdx++)
533 {
534 attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
535 if (attachment && attachment.IsItemBase())
536 {
537 item = ItemBase.Cast(attachment);
538 if (item)
540 }
541 }
542
543 if (m_Player.GetItemInHands())
544 ApplyDrynessToItemEx(m_Player.GetItemInHands(), drynessData);
545
546 LogDryWetProcess("==========");
547 }
class JsonUndergroundAreaTriggerData GetPosition
bool m_HasTemperatureSources
Definition Environment.c:53

References ApplyDrynessToItemEx(), vector::Distance(), GameConstants::ENVIRO_TICK_RATE, GetPosition, LogDryWetProcess(), m_HasTemperatureSources, m_Player, m_UTemperatureSources, and Math::Max().

Referenced by Update().

◆ ProcessItemsHeat()

void Environment::ProcessItemsHeat ( )
inlineprotected

Calculates and process temperature of items.

Heat Comfort

Heat (from items);

Definition at line 734 of file Environment.c.

735 {
736 float hcHead, hcBody, hcFeet;
737 float hHead, hBody, hFeet;
738
739 float heatComfortAvg;
740 float heatAvg;
741
745
747 heatAvg = (hHead + hBody + hFeet) / 3;
749
750 // heat buffer
751 float applicableHB = 0.0;
752 if (m_UTSAverageTemperature < 0.001)
753 {
754 applicableHB = m_Player.GetStatHeatBuffer().Get() / 30.0;
755 if (applicableHB > 0.0)
756 {
757 if (m_HeatBufferTimer > 1.0)
759 else
761 }
762 else
763 m_HeatBufferTimer = 0.0;
764 }
765 else
766 {
767 applicableHB = m_Player.GetStatHeatBuffer().Get() / 30.0;
769 {
771 m_HeatBufferTimer = 0.0;
772 }
773 else
774 m_HeatBufferTimer = 0.0;
775 }
776
780 else
781 {
784 }
785
786 m_HeatComfort = Math.Clamp(m_HeatComfort, m_Player.GetStatHeatComfort().GetMin(), m_Player.GetStatHeatComfort().GetMax());
787
788 m_Player.GetStatHeatComfort().Set(m_HeatComfort);
789 }
float EnvTempToCoef(float pTemp)
void BodyPartHeatProperties(array< int > pBodyPartIds, float pCoef, out float pHeatComfort, out float pHeat)
returns weighted avg heat comfort for bodypart
static const float THRESHOLD_HEAT_COMFORT_MINUS_WARNING
static const float THRESHOLD_HEAT_COMFORT_PLUS_WARNING
const float ENVIRO_ITEM_HEAT_TRANSFER_COEF
how many times slower is wetting/drying items in backpacks
Definition constants.c:684
const float ENVIRO_PLAYER_HEATBUFFER_TICK
How much heat buffer increases per one enviro tick.
Definition constants.c:706
const float ENVIRO_PLAYER_HEATBUFFER_DECREASE
impact of enviro temperature on player (lower value = higher, cannot be zero or below!...
Definition constants.c:704
const float ENVIRO_HEATCOMFORT_BODYPARTS_WEIGHT
how much this head parts (clothing) affects final heatcomfort
Definition constants.c:696
const float ENVIRO_HEATCOMFORT_HEADPARTS_WEIGHT
when is sun highest on sky
Definition constants.c:695
const float ENVIRO_PLAYER_HEATBUFFER_INCREASE
Multiplier of enviro temperature for heat buffer decrease (after its static timer runs out)
Definition constants.c:705
const float ENVIRO_HEATCOMFORT_FEETPARTS_WEIGHT
how much this body parts (clothing) affects final heatcomfort
Definition constants.c:697
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.

References BodyPartHeatProperties(), Math::Clamp(), GameConstants::ENVIRO_HEATCOMFORT_BODYPARTS_WEIGHT, GameConstants::ENVIRO_HEATCOMFORT_FEETPARTS_WEIGHT, GameConstants::ENVIRO_HEATCOMFORT_HEADPARTS_WEIGHT, GameConstants::ENVIRO_ITEM_HEAT_TRANSFER_COEF, GameConstants::ENVIRO_PLAYER_HEATBUFFER_DECREASE, GameConstants::ENVIRO_PLAYER_HEATBUFFER_INCREASE, GameConstants::ENVIRO_PLAYER_HEATBUFFER_TICK, EnvTempToCoef(), GetPlayerHeat(), m_BodyParts, m_EnvironmentTemperature, m_FeetParts, m_HeadParts, m_HeatBufferTimer, m_HeatComfort, m_Player, m_UTSAverageTemperature, Math::Min(), PlayerConstants::THRESHOLD_HEAT_COMFORT_MINUS_WARNING, and PlayerConstants::THRESHOLD_HEAT_COMFORT_PLUS_WARNING.

Referenced by Update().

◆ ProcessItemsWetness()

void Environment::ProcessItemsWetness ( array< int > pSlotIds)
inlineprotected

Definition at line 478 of file Environment.c.

479 {
481
482 int playerAttachmentCount = m_Player.GetInventory().AttachmentCount();
483
484 LogDryWetProcess(string.Format("Environment :: ProcessItemsWetness (update interval=%1s)", GameConstants.ENVIRO_TICK_RATE));
485 for (int attIdx = 0; attIdx < playerAttachmentCount; ++attIdx)
486 {
487 attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
488 if (attachment.IsItemBase())
489 {
490 int attachmentSlotsCount = attachment.GetInventory().GetSlotIdCount();
492 {
493 int attachmentSlot = attachment.GetInventory().GetSlotId(attachmentSlotId);
494 for (int i = 0; i < pSlotIds.Count(); ++i)
495 {
496 if (attachmentSlot == pSlotIds.Get(i))
497 {
499 break;
500 }
501 }
502 }
503 }
504 }
505
506 if (m_Player.GetItemInHands())
507 ApplyWetnessToItem(m_Player.GetItemInHands());
508
509 LogDryWetProcess("==========");
510
511 }

References ApplyWetnessToItem(), GameConstants::ENVIRO_TICK_RATE, LogDryWetProcess(), and m_Player.

Referenced by ProcessWetnessByRain(), and ProcessWetnessByWaterLevel().

◆ ProcessTemperatureSources()

void Environment::ProcessTemperatureSources ( )
inlineprotected

adds average of 2 most significat sources to buffer

Definition at line 894 of file Environment.c.

895 {
896 if (m_UTemperatureSources.Count() == 0)
897 {
900 return;
901 }
902
904
905 // get temperature from the source (based on distance), save it for min/max filtering
908
909 float min = MiscGameplayFunctions.GetMinValue(utsTemperatures);
910 float max = MiscGameplayFunctions.GetMaxValue(utsTemperatures);
911
912 if (max > 0 && min < 0)
913 {
916 }
917 else
919
921 }
float CalcTemperatureFromTemperatureSource(notnull UTemperatureSource uts)

References CalcTemperatureFromTemperatureSource(), m_HasTemperatureSources, m_UTemperatureSources, m_UTSAverageTemperature, and m_UTSAverageTemperatureBuffer.

Referenced by Update().

◆ ProcessWetnessByRain()

void Environment::ProcessWetnessByRain ( )
inlineprotected

Definition at line 447 of file Environment.c.

448 {
450 }
void ProcessItemsWetness(array< int > pSlotIds)

References m_SlotIdsComplete, and ProcessItemsWetness().

Referenced by Update().

◆ ProcessWetnessByWaterLevel()

void Environment::ProcessWetnessByWaterLevel ( float pWaterLevel)
inlineprotected

complete

upper part

bottom part

feet

Definition at line 452 of file Environment.c.

453 {
454 // process attachments by water depth
456 {
459 }
461 {
464 }
466 {
469 }
471 {
474 }
475 }

References m_SlotIdsBottom, m_SlotIdsComplete, m_SlotIdsLower, m_SlotIdsUpper, ProcessItemsWetness(), WATER_LEVEL_HIGH, WATER_LEVEL_LOW, WATER_LEVEL_MID, and WATER_LEVEL_NONE.

Referenced by Update().

◆ SetEnvironmentTemperature()

void Environment::SetEnvironmentTemperature ( )
inlineprotected

◆ Update()

void Environment::Update ( float pDelta)
inlineprotected

check if player is under roof (only if the Building check is false)

Updates data

Process temperature

Process item wetness/dryness

setting of wetness/dryiness of player

reset item wetness counter;

Definition at line 156 of file Environment.c.

157 {
158 if (m_Player)
159 {
163 {
164 if (!IsInsideBuilding())
166
168 }
169
170 m_Time += pDelta;
172 {
173 m_Time = 0;
174 m_WetDryTick++; // Sets whether it is time to add wetness to items and clothing
175
181
183
186
189 {
190 if (IsWaterContact())
192 else if (IsRaining() && !IsInsideBuilding() && !IsUnderRoof() && !IsInsideVehicle())
194 else
196
198 if ((m_ItemsWetnessMax < GameConstants.STATE_WET) && (m_Player.GetStatWet().Get() == 1))
199 m_Player.GetStatWet().Set(0);
200 else if ((m_ItemsWetnessMax >= GameConstants.STATE_WET) && (m_Player.GetStatWet().Get() == 0))
201 m_Player.GetStatWet().Set(1);
202
203 m_WetDryTick = 0;
205 }
206 }
207 }
208 }
void CollectAndSetEnvironmentData()
void CollectAndSetPlayerData()
void CheckWaterContact(out float pWaterLevel)
void ProcessItemsHeat()
Calculates and process temperature of items.
void ProcessWetnessByWaterLevel(float pWaterLevel)
void ProcessTemperatureSources()
void CheckUnderRoof()
Checks whether Player is sheltered.
void ProcessWetnessByRain()
void GatherTemperatureSources()
void ProcessItemsDryness()
const float STATE_WET
Definition constants.c:783

References CheckUnderRoof(), CheckWaterContact(), CollectAndSetEnvironmentData(), CollectAndSetPlayerData(), GameConstants::ENVIRO_TICK_RATE, GameConstants::ENVIRO_TICK_ROOF_RC_CHECK, GameConstants::ENVIRO_TICKS_TO_WETNESS_CALCULATION, GatherTemperatureSources(), IsInsideBuilding(), IsInsideVehicle(), IsRaining(), IsUnderRoof(), IsWaterContact(), m_ItemsWetnessMax, m_Player, m_RoofCheckTimer, m_Time, m_WaterLevel, m_WetDryTick, ProcessItemsDryness(), ProcessItemsHeat(), ProcessTemperatureSources(), ProcessWetnessByRain(), ProcessWetnessByWaterLevel(), and GameConstants::STATE_WET.

Member Data Documentation

◆ m_BodyParts

ref array<int> Environment::m_BodyParts
protected

Definition at line 48 of file Environment.c.

Referenced by Init(), and ProcessItemsHeat().

◆ m_Clouds

float Environment::m_Clouds = 0
protected

◆ m_DayOrNight

float Environment::m_DayOrNight = 0
protected

Definition at line 26 of file Environment.c.

Referenced by CollectAndSetEnvironmentData(), GetDayOrNight(), and GetDebugMessage().

◆ m_EnvironmentTemperature

float Environment::m_EnvironmentTemperature = 0
protected

◆ m_FeetParts

ref array<int> Environment::m_FeetParts
protected

Definition at line 49 of file Environment.c.

Referenced by Init(), and ProcessItemsHeat().

◆ m_Fog

float Environment::m_Fog = 0
protected

◆ m_HasTemperatureSources

bool Environment::m_HasTemperatureSources
protected

Definition at line 53 of file Environment.c.

Referenced by ProcessItemsDryness(), and ProcessTemperatureSources().

◆ m_HeadParts

ref array<int> Environment::m_HeadParts
protected

Definition at line 47 of file Environment.c.

Referenced by Init(), and ProcessItemsHeat().

◆ m_HeatBufferTimer

float Environment::m_HeatBufferTimer
protected

DEPRECATED.

Definition at line 40 of file Environment.c.

Referenced by Init(), and ProcessItemsHeat().

◆ m_HeatComfort

float Environment::m_HeatComfort
protected

Definition at line 20 of file Environment.c.

Referenced by GetDebugMessage(), Init(), and ProcessItemsHeat().

◆ m_HeatSourceTemp

float Environment::m_HeatSourceTemp
protected

Definition at line 39 of file Environment.c.

◆ m_IsInWater

bool Environment::m_IsInWater
protected

Definition at line 36 of file Environment.c.

Referenced by CheckWaterContact(), Init(), and IsWaterContact().

◆ m_IsTempSet

bool Environment::m_IsTempSet
protected

Definition at line 37 of file Environment.c.

Referenced by IsTemperatureSet(), and SetEnvironmentTemperature().

◆ m_IsUnderRoof

bool Environment::m_IsUnderRoof
protected

Definition at line 34 of file Environment.c.

Referenced by CheckUnderRoof(), GetDebugMessage(), Init(), and IsUnderRoof().

◆ m_IsUnderRoofBuilding

bool Environment::m_IsUnderRoofBuilding
private

Definition at line 35 of file Environment.c.

Referenced by CheckUnderRoof(), GetEnvironmentTemperature(), and IsUnderRoofBuilding().

◆ m_ItemsWetnessMax

float Environment::m_ItemsWetnessMax
protected

Definition at line 11 of file Environment.c.

Referenced by ApplyDrynessToItemEx(), ApplyWetnessToItem(), and Update().

◆ m_Player

◆ m_PlayerHeat

float Environment::m_PlayerHeat
protected

Definition at line 19 of file Environment.c.

Referenced by CollectAndSetPlayerData(), and GetWetDelta().

◆ m_PlayerHeightPos

float Environment::m_PlayerHeightPos
protected

Definition at line 16 of file Environment.c.

Referenced by CollectAndSetPlayerData(), and GetTemperatureHeightCorrection().

◆ m_PlayerSpeed

float Environment::m_PlayerSpeed
protected

Definition at line 17 of file Environment.c.

Referenced by CollectAndSetPlayerData(), GetPlayerHeat(), and Init().

◆ m_PlayerTemperature

float Environment::m_PlayerTemperature
protected

Definition at line 18 of file Environment.c.

◆ m_Rain

float Environment::m_Rain = 0
protected

◆ m_RoofCheckTimer

float Environment::m_RoofCheckTimer
protected

keeps wetness of most wet item in player's possesion

Definition at line 12 of file Environment.c.

Referenced by GetNextRoofCheck(), Init(), and Update().

◆ m_SlotIdsBottom

ref array<int> Environment::m_SlotIdsBottom
protected

Definition at line 44 of file Environment.c.

Referenced by Init(), and ProcessWetnessByWaterLevel().

◆ m_SlotIdsComplete

ref array<int> Environment::m_SlotIdsComplete
protected

Definition at line 42 of file Environment.c.

Referenced by Init(), ProcessWetnessByRain(), and ProcessWetnessByWaterLevel().

◆ m_SlotIdsLower

ref array<int> Environment::m_SlotIdsLower
protected

Definition at line 45 of file Environment.c.

Referenced by Init(), and ProcessWetnessByWaterLevel().

◆ m_SlotIdsUpper

ref array<int> Environment::m_SlotIdsUpper
protected

Definition at line 43 of file Environment.c.

Referenced by Init(), and ProcessWetnessByWaterLevel().

◆ m_SurfaceType

string Environment::m_SurfaceType
protected

Definition at line 30 of file Environment.c.

Referenced by CheckWaterContact(), GetWindModifierPerSurface(), and Init().

◆ m_Time

float Environment::m_Time = 0
protected

Definition at line 29 of file Environment.c.

Referenced by Update().

◆ m_UTemperatureSources

ref array<UTemperatureSource> Environment::m_UTemperatureSources
protected

◆ m_UTSAverageTemperature

float Environment::m_UTSAverageTemperature
protected

◆ m_UTSAverageTemperatureBuffer

ref SimpleMovingAverage<float> Environment::m_UTSAverageTemperatureBuffer
protected

Definition at line 56 of file Environment.c.

Referenced by Init(), and ProcessTemperatureSources().

◆ m_WaterLevel

float Environment::m_WaterLevel
protected

Definition at line 33 of file Environment.c.

Referenced by GetDebugMessage(), GetWaterLevel(), GetWetDelta(), Init(), and Update().

◆ m_WetDryTick

float Environment::m_WetDryTick
protected

Definition at line 10 of file Environment.c.

Referenced by Init(), and Update().

◆ m_Wind

float Environment::m_Wind = 0
protected

◆ m_WindAverageBuffer

ref SimpleMovingAverage<float> Environment::m_WindAverageBuffer
protected

Definition at line 51 of file Environment.c.

Referenced by CollectAndSetEnvironmentData(), and Init().

◆ RAIN_LIMIT_LOW

const float Environment::RAIN_LIMIT_LOW = 0.05
private

Definition at line 3 of file Environment.c.

Referenced by IsRaining().

◆ WATER_LEVEL_HIGH

const float Environment::WATER_LEVEL_HIGH = 1.5
private

Definition at line 5 of file Environment.c.

Referenced by CheckWaterContact(), GetWetDelta(), and ProcessWetnessByWaterLevel().

◆ WATER_LEVEL_LOW

const float Environment::WATER_LEVEL_LOW = 0.5
private

Definition at line 7 of file Environment.c.

Referenced by GetWetDelta(), and ProcessWetnessByWaterLevel().

◆ WATER_LEVEL_MID

const float Environment::WATER_LEVEL_MID = 1.2
private

Definition at line 6 of file Environment.c.

Referenced by CheckWaterContact(), GetWetDelta(), and ProcessWetnessByWaterLevel().

◆ WATER_LEVEL_NONE

const float Environment::WATER_LEVEL_NONE = 0.15
private

The documentation for this class was generated from the following file: