61 bool m_DebugLogDryWet =
false;
277 vector hitPosition, hitNormal;
279 vector to = from +
"0 25 0";
315 switch ( liquidType )
320 pWaterLevel =
m_Player.GetCurrentWaterLevel();
337 return temperature_reduction;
357 temperature =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperature();
429 if (weatherEffect <= 0)
514 int playerAttachmentCount =
m_Player.GetInventory().AttachmentCount();
517 for (
int attIdx = 0; attIdx < playerAttachmentCount; ++attIdx)
519 attachment =
m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
520 if (attachment.IsItemBase())
522 int attachmentSlotsCount = attachment.GetInventory().GetSlotIdCount();
523 for (
int attachmentSlotId = 0; attachmentSlotId < attachmentSlotsCount; ++attachmentSlotId)
525 int attachmentSlot = attachment.GetInventory().GetSlotId(attachmentSlotId);
526 for (
int i = 0; i < pSlotIds.Count(); ++i)
528 if (attachmentSlot == pSlotIds.Get(i))
550 int attCount =
m_Player.GetInventory().AttachmentCount();
553 EnvironmentDrynessData drynessData =
new EnvironmentDrynessData();
559 distance =
Math.
Max(distance, 0.1);
560 drynessData.m_TemperatureSourceDistance = distance;
564 for (
int attIdx = 0; attIdx < attCount; attIdx++)
566 attachment =
m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
567 if (attachment && attachment.IsItemBase())
588 bool isParentWet =
false;
589 bool parentContainsLiquid =
false;
592 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
603 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
604 parentContainsLiquid =
true;
614 if (isParentWet || parentContainsLiquid)
616 float soakingCoef = 0;
617 if (parentContainsLiquid)
619 soakingCoef = pItem.GetSoakingIncrement(
"parentWithLiquid");
622 else if (isParentWet && parentItem)
624 if (pItem.GetWet() < parentItem.GetWet())
626 soakingCoef = pItem.GetSoakingIncrement(
"wetParent");
636 pItem.AddWet(soakingCoef);
639 if (pItem.GetInventory().GetCargo())
641 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
642 for (
int i = 0; i < inItemCount; i++)
645 if (
Class.
CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
650 int attCount = pItem.GetInventory().AttachmentCount();
653 for (
int attIdx = 0; attIdx < attCount; attIdx++)
655 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
667 EnvironmentDrynessData drynessData =
new EnvironmentDrynessData();
675 float dryingIncrement = pItem.GetDryingIncrement(
"player");
676 if (pDrynessData.m_UseTemperatureSources)
677 dryingIncrement = pItem.GetDryingIncrement(
"playerHeatSource");
680 bool isParentWet =
false;
681 bool parentContainsLiquid =
false;
684 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
695 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
696 parentContainsLiquid =
true;
706 float dryingCoef = 0;
708 if (!isParentWet && !parentContainsLiquid)
715 pItem.AddWet(dryingCoef);
718 if (pItem.GetInventory().GetCargo())
720 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
721 for (
int i = 0; i < inItemCount; i++)
724 if (
Class.
CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
729 int attCount = pItem.GetInventory().AttachmentCount();
732 for (
int attIdx = 0; attIdx < attCount; attIdx++)
734 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
736 if (
ItemBase.CastTo(itemAtt, attachment))
744 if (parentContainsLiquid)
749 pItem.AddWet(dryingCoef);
755 if (pItem.GetWet() < parentItem.GetWet())
760 pItem.AddWet(dryingCoef);
772 float hcHead, hcBody, hcFeet;
773 float hHead, hBody, hFeet;
775 float heatComfortAvg;
782 heatComfortAvg = (hcHead + hcBody + hcFeet) / 3;
783 heatAvg = (hHead + hBody + hFeet) / 3;
787 float applicableHB = 0.0;
790 applicableHB =
m_Player.GetStatHeatBuffer().Get() / 30.0;
791 if (applicableHB > 0.0)
809 applicableHB =
m_Player.GetStatHeatBuffer().Get() / 30.0;
866 attCount =
m_Player.GetInventory().AttachmentCount();
868 for (
int attIdx = 0; attIdx < attCount; attIdx++)
870 attachment =
m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
871 if (attachment.IsClothing())
874 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
877 for (
int i = 0; i < pBodyPartIds.Count(); i++)
879 if (attachmentSlot == pBodyPartIds.Get(i))
881 float heatIsoMult = 1.0;
892 pHeatComfort += heatIsoMult * MiscGameplayFunctions.GetCurrentItemHeatIsolation(item);
895 int inAttCount = item.GetInventory().AttachmentCount();
898 for (
int inAttIdx = 0; inAttIdx < inAttCount; inAttIdx++)
900 EntityAI inAttachment = item.GetInventory().GetAttachmentFromIndex(inAttIdx);
904 pHeat += itemAtt.GetTemperature();
908 if (item.GetInventory().GetCargo())
910 int inItemCount = item.GetInventory().GetCargo().GetItemCount();
912 for (
int j = 0; j < inItemCount; j++)
915 if (
Class.
CastTo(inItem, item.GetInventory().GetCargo().GetItem(j)))
917 pHeat += inItem.GetTemperature();
926 pHeatComfort = (pHeatComfort / pBodyPartIds.Count()) * pCoef;
927 pHeat = (pHeat / pBodyPartIds.Count()) * pCoef;
937 foreach (
Object nearestObject : nearestObjects)
940 if (ent && ent.IsUniversalTemperatureSource() && ent !=
m_Player)
950 if (
m_Player.GetItemInHands() &&
m_Player.GetItemInHands().IsUniversalTemperatureSource())
969 float min = MiscGameplayFunctions.GetMinValue(utsTemperatures);
970 float max = MiscGameplayFunctions.GetMaxValue(utsTemperatures);
972 if (max > 0 && min < 0)
993 distance =
Math.
Max(distance, 0.1);
994 float temperature = 0;
999 if (distance > uts.GetFullRange())
1001 float distFactor = 1 - (distance / uts.GetMaxRange());
1002 distFactor =
Math.
Max(distFactor, 0.0);
1003 temperature = uts.GetTemperature() * distFactor;
1010 temperature = uts.GetTemperature();
1019#ifdef DIAG_DEVELOPER
1020 EnvDebugData GetEnvDebugData()
1022 EnvDebugData data =
new EnvDebugData();
1027 void ShowEnvDebugPlayerInfo(
bool enabled)
1029 EnvDebugData data = GetEnvDebugData();
1030 DisplayEnvDebugPlayerInfo(enabled, data);
1033 static void DisplayEnvDebugPlayerInfo(
bool enabled, EnvDebugData data)
1043 DbgUI.
Text(
string.Format(
"Heat comfort: %1", data.m_PlayerData.m_HeatComfort));
1044 DbgUI.
Text(
string.Format(
"Inside: %1 (%2)", data.m_PlayerData.m_Inside, data.m_PlayerData.m_Surface));
1045 DbgUI.
Text(
string.Format(
"Under roof: %1 (%2)", data.m_PlayerData.m_UnderRoof, data.m_PlayerData.m_UnderRoofTimer));
1046 if ( data.m_PlayerData.m_WaterLevel > 0 )
1048 DbgUI.
Text(
string.Format(
"Water Level: %1", data.m_PlayerData.m_WaterLevel));
1057 DbgUI.
Text(
string.Format(
"Env temperature (base): %1", data.m_MiscData.m_TemperatureBase));
1058 DbgUI.
Text(
string.Format(
"Env temperature (modfied): %1", data.m_MiscData.m_TemperatureModified));
1059 DbgUI.
Text(
string.Format(
"Wind: %1 (x%2)", data.m_WeatherData.m_Wind, data.m_WeatherData.m_WindModifier));
1060 DbgUI.
Text(
string.Format(
"Rain: %1", data.m_WeatherData.m_Rain));
1061 DbgUI.
Text(
string.Format(
"Day/Night (1/0): %1", data.m_MiscData.m_DayOrNight));
1062 DbgUI.
Text(
string.Format(
"Fog: %1", data.m_WeatherData.m_Fog));
1063 DbgUI.
Text(
string.Format(
"Clouds: %1", data.m_WeatherData.m_Clouds));
1064 DbgUI.
Text(
string.Format(
"Height: %1", data.m_MiscData.m_Height));
1065 DbgUI.
Text(
string.Format(
"Wet delta: %1", data.m_MiscData.m_WetDelta));
1070 void FillDebugWeatherData(EnvDebugWeatherData data)
1083 message +=
"Player stats";
1092 message +=
"\n\nWeather stats";
1093 message +=
"\nEnv temperature (base): " +
g_Game.GetMission().GetWorldData().GetBaseEnvTemperature().ToString();
1130 #ifdef DIAG_DEVELOPER
1131 if (m_DebugLogDryWet)
1133 string indentation =
"";
1135 indentation =
"|--";
1137 Debug.
Log(
string.Format(
"%1 %2", indentation, message));
1143class EnvironmentDrynessData
1149#ifdef DIAG_DEVELOPER
1150class EnvDebugPlayerData :
Param
1152 float m_HeatComfort;
1156 int m_UnderRoofTimer;
1161 m_HeatComfort = player.GetStatHeatComfort().Get();
1181class EnvDebugMiscData :
Param
1183 float m_TemperatureBase;
1184 float m_TemperatureModified;
1191 m_TemperatureBase =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperature();
1205 return ctx.
Read(m_TemperatureBase) && ctx.
Read(m_TemperatureModified) && ctx.
Read(m_DayOrNight) && ctx.
Read(
m_Height) && ctx.
Read(m_WetDelta);
1209class EnvDebugWeatherData :
Param
1212 float m_WindModifier;
1219 env.FillDebugWeatherData(
this);
1229 return ctx.
Read(m_Wind) && ctx.
Read(m_WindModifier) && ctx.
Read(m_Rain) && ctx.
Read(m_Fog) && ctx.
Read(m_Clouds);
1233class EnvDebugData :
Param
1235 ref EnvDebugPlayerData m_PlayerData =
new EnvDebugPlayerData();
1236 ref EnvDebugMiscData m_MiscData =
new EnvDebugMiscData();
1237 ref EnvDebugWeatherData m_WeatherData =
new EnvDebugWeatherData();
1241 m_PlayerData.Synch(env, player);
1242 m_MiscData.Synch(env);
1243 m_WeatherData.Synch(env);
1248 return m_PlayerData.Serialize(ctx) && m_MiscData.Serialize(ctx) && m_WeatherData.Serialize(ctx);
1253 return m_PlayerData.Deserializer(ctx) && m_MiscData.Deserializer(ctx) && m_WeatherData.Deserializer(ctx);
float m_TemperatureSourceDistance
class Environment m_UseTemperatureSources
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
protected void Synch(EntityAI victim)
keeping "step" here for consistency only
class JsonUndergroundAreaTriggerData GetPosition
proto native void GetObjectsAtPosition(vector pos, float radius, out array< Object > objects, out array< CargoBase > proxyCargos)
Returns list of all objects in circle "radius" around position "pos".
Super root of all classes in Enforce script.
static proto bool RayCastBullet(vector begPos, vector endPos, PhxInteractionLayers layerMask, Object ignoreObj, out Object hitObject, out vector hitPosition, out vector hitNormal, out float hitFraction)
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.
protected void ApplyDrynessToItemEx(ItemBase pItem, EnvironmentDrynessData pDrynessData)
protected void ProcessWetnessByRain()
protected float GetEnvironmentTemperature()
protected void BodyPartHeatProperties(array< int > pBodyPartIds, float pCoef, out float pHeatComfort, out float pHeat)
returns weighted avg heat comfort for bodypart
protected ref SimpleMovingAverage< float > m_WindAverageBuffer
protected ref SimpleMovingAverage< float > m_UTSAverageTemperatureBuffer
protected void CollectAndSetEnvironmentData()
protected float m_WetDryTick
float GetTemperatureHeightCorrection()
protected ref array< UTemperatureSource > m_UTemperatureSources
protected bool m_IsInWater
protected float m_HeatSourceTemp
float CalcTemperatureFromTemperatureSource(notnull UTemperatureSource uts)
protected void CheckWaterContact(out float pWaterLevel)
protected float m_PlayerHeat
void AddToEnvironmentTemperature(float pTemperature)
protected bool IsWaterContact()
private void LogDryWetProcess(string message, bool indented=false)
protected ref array< int > m_SlotIdsBottom
protected void ProcessWetnessByWaterLevel(float pWaterLevel)
void Init(PlayerBase pPlayer)
protected float m_PlayerTemperature
protected float m_PlayerSpeed
protected void CollectAndSetPlayerData()
float GetWindModifierPerSurface()
void Environment(PlayerBase pPlayer)
protected float m_PlayerHeightPos
protected bool m_HasTemperatureSources
const float WATER_LEVEL_MID
protected void GatherTemperatureSources()
protected ref array< int > m_HeadParts
protected string m_SurfaceType
protected float m_DayOrNight
protected float m_HeatBufferTimer
DEPRECATED.
private bool IsUnderRoofBuilding()
protected ref array< int > m_SlotIdsLower
protected float m_HeatComfort
void Update(float pDelta)
const float RAIN_LIMIT_LOW
protected bool m_IsTempSet
protected float m_ItemsWetnessMax
protected bool OverridenHeatComfort(out float value)
DEPRECATED.
protected PlayerBase m_Player
const float WATER_LEVEL_LOW
const float WATER_LEVEL_NONE
protected float m_EnvironmentTemperature
protected float m_WaterLevel
const float WATER_LEVEL_HIGH
string GetDebugMessage()
debug
protected void ProcessTemperatureSources()
protected float m_RoofCheckTimer
keeps wetness of most wet item in player's possesion
protected float GetPlayerHeat()
Returns heat player generated based on player's movement speed (for now)
protected float m_UTSAverageTemperature
protected void CheckUnderRoof()
Checks whether Player is sheltered.
protected void ApplyDrynessToItem(ItemBase pItem)
void SetEnvironmentTemperature()
protected void ProcessItemsHeat()
Calculates and process temperature of items.
protected void ApplyWetnessToItem(ItemBase pItem)
protected bool IsRaining()
protected float EnvTempToCoef(float pTemp)
protected void ProcessItemsDryness()
protected ref array< int > m_SlotIdsUpper
float GetUniversalSourcesTemperageAverage()
protected ref array< int > m_BodyParts
protected bool IsInsideVehicle()
protected ref array< int > m_SlotIdsComplete
protected ref array< int > m_FeetParts
protected bool m_IsUnderRoof
private bool m_IsUnderRoofBuilding
protected void ProcessItemsWetness(array< int > pSlotIds)
proto native float GetCurrentMovementSpeed()
0,1,2..3 idle, walk, run, sprint
int m_iMovement
current stance (DayZPlayerConstants.STANCEIDX_ERECT, ...), only if the command has a stance
proto native EntityAI GetParent()
returns parent of current inventory location
provides access to slot configuration
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
bool Deserializer(Serializer ctx)
static const float THRESHOLD_HEAT_COMFORT_MINUS_WARNING
static const float THRESHOLD_HEAT_COMFORT_PLUS_WARNING
Serialization general interface. Serializer API works with:
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetWindMaximumSpeed()
Returns maximal wind speed in metre per second.
proto native Overcast GetOvercast()
Returns an overcast phenomenon object.
proto native float GetWindSpeed()
Returns actual wind speed in metre per second.
proto native Rain GetRain()
Returns a rain phenomenon object.
proto native Fog GetFog()
Returns a fog phenomenon object.
proto native float GetActual()
Returns actual value of phenomenon in range <0, 1>.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
DayZPlayerConstants
defined in C++
proto native CGame GetGame()
static proto native void Begin(string windowTitle, float x=0, float y=0)
static proto native void Text(string label)
static proto native void End()
const float TEMPERATURE_RATE_COOLING_PLAYER
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const float ENVIRO_TICK_ROOF_RC_CHECK
each X (ticks) is processed wetness on items on player
const float ENVIRO_DRY_INCREMENT
amount of wetness added to items wet value each tick if is raining
const float ENVIRO_HEATCOMFORT_FEETPARTS_WEIGHT
how much this body parts (clothing) affects final heatcomfort
const float ENVIRO_WATER_TEMPERATURE_COEF
converts temperature of items to entities heatcomfort gain
const float ENVIRO_TICK_RATE
const float ENVIRO_TICKS_TO_WETNESS_CALCULATION
in secs. how often should enviro effet process
const float ENVIRO_TEMPERATURE_WIND_COEF
const float ENVIRO_TEMPERATURE_INSIDE_COEF
amount of ?C reduced for each 100 meteres of height above water level
const float ENVIRO_TEMP_EFFECT_ON_PLAYER
comfort temperature of environment for the player
const float ENVIRO_CLOUD_DRY_EFFECT
how much is the generic temp effect increased when player is next to a fireplace
const float ENVIRO_PLAYER_COMFORT_TEMP
highest temperature(deg Celsius) where the player gets highest possible heat comfort (1)
const float ENVIRO_TEMP_SOURCES_LOOKUP_RADIUS
const float ENVIRO_HIGH_TEMP_LIMIT
lowest temperature(deg Celsius) where the player gets lowest possible heat comfort (-1)
const float ENVIRO_FOG_TEMP_EFFECT
how many % of environment temperature can be lowered by clouds
const float ENVIRO_WET_INCREMENT
in secs. how often we should check if player is under the roof (raycast)
const float ENVIRO_HEATCOMFORT_BODYPARTS_WEIGHT
how much this head parts (clothing) affects final heatcomfort
const float ENVIRO_HEATCOMFORT_HEADPARTS_WEIGHT
when is sun highest on sky
const float ENVIRO_WIND_EFFECT
windchill effect on base temperature
const float ENVIRO_PLAYER_HEATBUFFER_TICK
How much heat buffer increases per one enviro tick.
const float ENVIRO_HEATISOLATION_BACK_WEIGHT
how much this feet parts (clothing) affects final heatcomfort
const float ENVIRO_TEMPERATURE_HEIGHT_REDUCTION
heat entity generates if not moving
const float ENVIRO_HEATISOLATION_VEST_WEIGHT
weight of back for the sum of heat isolation
const float ENVIRO_CLOUDS_TEMP_EFFECT
how many % of ENVIRO_SUN_INCREMENT is reduced by fog
const float ENVIRO_DEFAULT_ENTITY_HEAT
how many time is water colder than air
const float ENVIRO_PLAYER_HEATBUFFER_INCREASE
Multiplier of enviro temperature for heat buffer decrease (after its static timer runs out)
const float ENVIRO_PLAYER_HEATBUFFER_DECREASE
impact of enviro temperature on player (lower value = higher, cannot be zero or below!...
const float ENVIRO_FOG_DRY_EFFECT
how many % of ENVIRO_SUN_INCREMENT is reduced by cloudy sky
const float ENVIRO_LOW_TEMP_LIMIT
weight of vest for the sum of heat isolation
const float ENVIRO_TEMPERATURE_UNDERROOF_COEF
increases temp inside vehicles
const float ENVIRO_ITEM_HEAT_TRANSFER_COEF
how many times slower is wetting/drying items in backpacks
const float ENVIRO_TEMPERATURE_INSIDE_VEHICLE_COEF
increases temp in interiors
const float STATE_SOAKING_WET
const int LIQUID_RIVERWATER
static proto float Max(float x, float y)
Returns bigger 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'.
static proto float SqrFloat(float f)
Returns squared value.
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float AbsFloat(float f)
Returns absolute value.