DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
Environment.c
Go to the documentation of this file.
2{
3 const float RAIN_LIMIT_LOW = 0.05;
4
5 const float WATER_LEVEL_HIGH = 1.5;
6 const float WATER_LEVEL_MID = 1.2;
7 const float WATER_LEVEL_LOW = 0.5;
8 const float WATER_LEVEL_NONE = 0.15;
9
10 protected float m_WetDryTick; //ticks passed since last clothing wetting or drying
11 protected float m_ItemsWetnessMax;
12 protected float m_RoofCheckTimer; // keeps info about tick time
13
14 //player
16 protected float m_PlayerHeightPos; // y position of player above water level (meters)
17 protected float m_PlayerSpeed; // 1-3 speed of player movement
18 protected float m_PlayerTemperature; //34-44
19 protected float m_PlayerHeat; //3-9 heatcomfort generated by entites movement
20 protected float m_HeatComfort; //delta that changes entitys temperature
21
22 //environment
23 protected float m_Rain = 0; // 0-1 amount of rain
24 protected float m_Wind = 0; // strength of wind
25 protected float m_Fog = 0; // 0-1 how foggy it is
26 protected float m_DayOrNight = 0; // 0-1 day(1) or night(0)
27 protected float m_Clouds = 0; // 0-1 how cloudy it is
28 protected float m_EnvironmentTemperature = 0; //temperature of environment player is in
29 protected float m_Time = 0;
30 protected string m_SurfaceType;
31
32 //
33 protected float m_WaterLevel;
34 protected bool m_IsUnderRoof;
36 protected bool m_IsInWater;
37 protected bool m_IsTempSet;
38 //
39 protected float m_HeatSourceTemp;
40 protected float m_HeatBufferTimer;
41
46
47 protected ref array<int> m_HeadParts;
48 protected ref array<int> m_BodyParts;
49 protected ref array<int> m_FeetParts;
50
51 protected ref SimpleMovingAverage<float> m_WindAverageBuffer;
52
54 protected float m_UTSAverageTemperature;
56 protected ref SimpleMovingAverage<float> m_UTSAverageTemperatureBuffer;
57
58 #ifdef DIAG_DEVELOPER
59 bool m_Debug = false;
60
61 bool m_DebugLogDryWet = false;
62 #endif
63
64 void Environment(PlayerBase pPlayer)
65 {
66 Init(pPlayer);
67 }
68
69 void Init(PlayerBase pPlayer)
70 {
71 m_Player = pPlayer;
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
84 m_WindAverageBuffer = new SimpleMovingAverage<float>(30, 0.5);
85
88 m_UTSAverageTemperatureBuffer = new SimpleMovingAverage<float>(10, 0);
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 }
153
154
155 // Calculates heatisolation of clothing, process its wetness, collects heat from heated items and calculates player's heat comfort
156 void Update(float pDelta)
157 {
158 if (m_Player)
159 {
160 m_RoofCheckTimer += pDelta;
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() )
191 {
193 }
194 else if ( IsRaining() && !IsInsideBuilding() && !IsUnderRoof() && !IsInsideVehicle() )
195 {
197 }
198 else
199 {
201 }
202
204 if ( ( m_ItemsWetnessMax < GameConstants.STATE_WET ) && ( m_Player.GetStatWet().Get() == 1 ) )
205 {
206 m_Player.GetStatWet().Set( 0 );
207 }
208 else if ( ( m_ItemsWetnessMax >= GameConstants.STATE_WET ) && ( m_Player.GetStatWet().Get() == 0 ) )
209 {
210 m_Player.GetStatWet().Set( 1 );
211 }
212
213 m_WetDryTick = 0;
215 }
216 }
217 }
218 }
219
221 {
222 return m_IsTempSet;
223 }
224
225 // DEPRECATED
226 void AddToEnvironmentTemperature(float pTemperature);
227
229 protected float GetPlayerHeat()
230 {
232 return heat;
233 }
234
236 {
237 return m_IsUnderRoof;
238 }
239
240 protected bool IsWaterContact()
241 {
242 return m_IsInWater;
243 }
244
246 {
247 return m_Player && m_Player.IsSoundInsideBuilding();
248 }
249
250 protected bool IsInsideVehicle()
251 {
252 return m_Player && m_Player.IsInVehicle();
253 }
254
255 private bool IsUnderRoofBuilding()
256 {
258 }
259
260 protected bool IsRaining()
261 {
262 return m_Rain > RAIN_LIMIT_LOW;
263 }
264
266 protected void CheckUnderRoof()
267 {
268 // if inside vehicle return immediatelly
269 if (IsInsideVehicle())
270 {
271 m_IsUnderRoof = false;
272 m_IsUnderRoofBuilding = false;
273 return;
274 }
275
276 float hitFraction;
277 vector hitPosition, hitNormal;
278 vector from = m_Player.GetPosition();
279 vector to = from + "0 25 0";
280 Object hitObject;
281 PhxInteractionLayers collisionLayerMask = PhxInteractionLayers.ITEM_LARGE|PhxInteractionLayers.BUILDING|PhxInteractionLayers.VEHICLE;
282
283 m_IsUnderRoof = DayZPhysics.RayCastBullet(from, to, collisionLayerMask, null, hitObject, hitPosition, hitNormal, hitFraction);
284
285 m_IsUnderRoofBuilding = hitObject && hitObject.IsInherited(House);
286 }
287
288 protected void CheckWaterContact(out float pWaterLevel)
289 {
290 m_IsInWater = false;
291 if (m_Player.IsSwimming())
292 {
293 m_IsInWater = true;
295 m_Player.GetMovementState(hms);
296 pWaterLevel = WATER_LEVEL_MID;
297 if (hms.m_iMovement >= DayZPlayerConstants.MOVEMENTIDX_WALK)
298 pWaterLevel = WATER_LEVEL_HIGH;
299
300 return;
301 }
302
305 {
306 m_IsInWater = false;
307 return;
308 }
309
310 string surfType;
311 int liquidType;
312
313 g_Game.SurfaceUnderObject(m_Player, surfType, liquidType);
314
315 switch ( liquidType )
316 {
317 case 0: // sea
318 case LIQUID_WATER:
320 pWaterLevel = m_Player.GetCurrentWaterLevel();
321 m_IsInWater = true;
322 break;
323 }
324
326 m_Player.SetInWater(m_IsInWater);
327
329 m_SurfaceType = surfType;
330 }
331
332 // ENVIRONMENT
333 // Returns amount of deg C air temperature should be lowered by, based on player's height above water level
335 {
336 float temperature_reduction = Math.Max(0, (m_PlayerHeightPos * GameConstants.ENVIRO_TEMPERATURE_HEIGHT_REDUCTION));
337 return temperature_reduction;
338 }
339
341 {
343 return 0.0;
344
345 return g_Game.ConfigGetFloat("CfgSurfaces " + m_SurfaceType + " windModifier");
346 }
347
349 {
351 }
352
353 // Calculates and return temperature of environment
355 {
356 float temperature;
357 temperature = g_Game.GetMission().GetWorldData().GetBaseEnvTemperature();
358 temperature += Math.AbsFloat(temperature * m_Clouds * GameConstants.ENVIRO_CLOUDS_TEMP_EFFECT);
359
360 if (IsWaterContact())
361 {
362 temperature -= Math.AbsFloat(temperature * GameConstants.ENVIRO_WATER_TEMPERATURE_COEF);
363 }
364
366 {
367 temperature += Math.AbsFloat(temperature * GameConstants.ENVIRO_TEMPERATURE_INSIDE_COEF);
368 }
369 else if (IsInsideVehicle())
370 {
372 }
373 else if (IsUnderRoof() && !m_IsUnderRoofBuilding)
374 {
375 temperature += Math.AbsFloat(temperature * GameConstants.ENVIRO_TEMPERATURE_UNDERROOF_COEF);
377 }
378 else
379 {
381 temperature -= Math.AbsFloat(temperature * m_Fog * GameConstants.ENVIRO_FOG_TEMP_EFFECT);
382 temperature -= GetTemperatureHeightCorrection();
383 }
384
385 // incorporate temperature from temperature sources (buffer)
387 {
388 temperature += m_UTSAverageTemperature;
389 }
390
391 return temperature;
392 }
393
394 // Calculats wet/drying delta based on player's location and weather
396 {
397 float wetDelta = 0;
398 if ( IsWaterContact() )
399 {
402 {
403 wetDelta = 1;
404 }
406 {
407 wetDelta = 0.66;
408 }
410 {
411 wetDelta = 0.66;
412 }
414 {
415 wetDelta = 0.33;
416 }
417 }
418 else if (IsRaining() && !IsInsideBuilding() && !IsUnderRoof() && !IsInsideVehicle())
419 {
422 }
423 else
424 {
426 float tempEffect = Math.Max(m_PlayerHeat + GetEnvironmentTemperature(), 1.0);
427
428 float weatherEffect = ((1 - (m_Fog * GameConstants.ENVIRO_FOG_DRY_EFFECT))) * (1 - (m_Clouds * GameConstants.ENVIRO_CLOUD_DRY_EFFECT));
429 if (weatherEffect <= 0)
430 {
431 weatherEffect = 1.0;
432 }
433
434 wetDelta = -(GameConstants.ENVIRO_DRY_INCREMENT * weatherEffect * tempEffect);
435 if (!IsInsideBuilding())
436 {
437 wetDelta *= 1 + (GameConstants.ENVIRO_WIND_EFFECT * m_Wind);
438 }
439 }
440
441 return wetDelta;
442 }
443
444 // EXPOSURE
445 // Each tick updates current entity member variables
446 protected void CollectAndSetPlayerData()
447 {
448 vector playerPos = m_Player.GetPosition();
449 m_PlayerHeightPos = playerPos[1];
450
451 HumanCommandMove hcm = m_Player.GetCommand_Move();
452 if (hcm)
453 {
455 }
456
458 }
459
460 // Each tick updates current environment member variables
462 {
463 Weather weather = g_Game.GetWeather();
464 m_Rain = weather.GetRain().GetActual();
465 m_DayOrNight = g_Game.GetWorld().GetSunOrMoon();
466 m_Fog = weather.GetFog().GetActual();
467 m_Clouds = weather.GetOvercast().GetActual();
468 m_Wind = m_WindAverageBuffer.Add(weather.GetWindSpeed() / weather.GetWindMaximumSpeed());
469
471 }
472
474 {
475 m_IsTempSet = true;
477 }
478
479 protected void ProcessWetnessByRain()
480 {
482 }
483
484 protected void ProcessWetnessByWaterLevel(float pWaterLevel)
485 {
486 // process attachments by water depth
487 if (pWaterLevel >= WATER_LEVEL_HIGH)
488 {
491 }
492 else if (pWaterLevel >= WATER_LEVEL_MID && pWaterLevel < WATER_LEVEL_HIGH)
493 {
496 }
497 else if (pWaterLevel >= WATER_LEVEL_LOW && pWaterLevel < WATER_LEVEL_MID)
498 {
501 }
502 else if (pWaterLevel >= WATER_LEVEL_NONE && pWaterLevel < WATER_LEVEL_LOW)
503 {
506 }
507 }
508
509 // Wets or dry items once in given time
510 protected void ProcessItemsWetness(array<int> pSlotIds)
511 {
512 EntityAI attachment;
513
514 int playerAttachmentCount = m_Player.GetInventory().AttachmentCount();
515
516 LogDryWetProcess(string.Format("Environment :: ProcessItemsWetness (update interval=%1s)", GameConstants.ENVIRO_TICK_RATE));
517 for (int attIdx = 0; attIdx < playerAttachmentCount; ++attIdx)
518 {
519 attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
520 if (attachment.IsItemBase())
521 {
522 int attachmentSlotsCount = attachment.GetInventory().GetSlotIdCount();
523 for (int attachmentSlotId = 0; attachmentSlotId < attachmentSlotsCount; ++attachmentSlotId)
524 {
525 int attachmentSlot = attachment.GetInventory().GetSlotId(attachmentSlotId);
526 for (int i = 0; i < pSlotIds.Count(); ++i)
527 {
528 if (attachmentSlot == pSlotIds.Get(i))
529 {
530 ApplyWetnessToItem(ItemBase.Cast(attachment));
531 break;
532 }
533 }
534 }
535 }
536 }
537
538 if (m_Player.GetItemInHands())
539 ApplyWetnessToItem(m_Player.GetItemInHands());
540
541 LogDryWetProcess("==========");
542
543 }
544
545 protected void ProcessItemsDryness()
546 {
547 EntityAI attachment;
548 ItemBase item;
549
550 int attCount = m_Player.GetInventory().AttachmentCount();
551
552 LogDryWetProcess(string.Format("Environment :: ProcessItemsDryness (update interval=%1s)", GameConstants.ENVIRO_TICK_RATE));
553 EnvironmentDrynessData drynessData = new EnvironmentDrynessData();
554 drynessData.m_UseTemperatureSources = m_HasTemperatureSources;
555
557 {
558 float distance = vector.Distance(m_UTemperatureSources[0].GetPosition(), m_Player.GetPosition());
559 distance = Math.Max(distance, 0.1);
560 drynessData.m_TemperatureSourceDistance = distance;
561 LogDryWetProcess(string.Format("distance to heatsource: %1 m", distance));
562 }
563
564 for (int attIdx = 0; attIdx < attCount; attIdx++)
565 {
566 attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
567 if (attachment && attachment.IsItemBase())
568 {
569 item = ItemBase.Cast(attachment);
570 if (item)
571 ApplyDrynessToItemEx(item, drynessData);
572 }
573 }
574
575 if (m_Player.GetItemInHands())
576 {
577 ApplyDrynessToItemEx(m_Player.GetItemInHands(), drynessData);
578 }
579
580 LogDryWetProcess("==========");
581 }
582
583 protected void ApplyWetnessToItem(ItemBase pItem)
584 {
585 if (pItem)
586 {
587 ItemBase parentItem;
588 bool isParentWet = false;
589 bool parentContainsLiquid = false;
591
592 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
593 {
594 EntityAI parent = iLoc.GetParent();
595 if (parent)
596 {
597 parentItem = ItemBase.Cast(parent);
598 if (parentItem)
599 {
600 if (parentItem.GetWet() >= GameConstants.STATE_SOAKING_WET)
601 isParentWet = true;
602
603 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
604 parentContainsLiquid = true;
605 }
606 else
607 isParentWet = true;
608
609 if ((pItem.GetWet() > m_ItemsWetnessMax) && (parent == m_Player))
610 m_ItemsWetnessMax = pItem.GetWet();
611 }
612 }
613
614 if (isParentWet || parentContainsLiquid)
615 {
616 float soakingCoef = 0;
617 if (parentContainsLiquid)
618 {
619 soakingCoef = pItem.GetSoakingIncrement("parentWithLiquid");
620 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);
621 }
622 else if (isParentWet && parentItem)
623 {
624 if (pItem.GetWet() < parentItem.GetWet())
625 {
626 soakingCoef = pItem.GetSoakingIncrement("wetParent");
627 LogDryWetProcess(string.Format("%1 (soak coef=%2/s, current wetness=%3) [parent wet]", pItem.GetDisplayName(), soakingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
628 }
629 }
630 else
631 {
632 soakingCoef = GetWetDelta();
633 LogDryWetProcess(string.Format("%1 (soak coef=%2/s, current wetness=%3) [normal]", pItem.GetDisplayName(), soakingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
634 }
635
636 pItem.AddWet(soakingCoef);
637 pItem.AddTemperature(GameConstants.ENVIRO_TICK_RATE * GameConstants.TEMPERATURE_RATE_COOLING_PLAYER * pItem.GetSoakingIncrement("wetParent"));
638
639 if (pItem.GetInventory().GetCargo())
640 {
641 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
642 for (int i = 0; i < inItemCount; i++)
643 {
644 ItemBase inItem;
645 if (Class.CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
646 ApplyWetnessToItem(inItem);
647 }
648 }
649
650 int attCount = pItem.GetInventory().AttachmentCount();
651 if (attCount > 0)
652 {
653 for (int attIdx = 0; attIdx < attCount; attIdx++)
654 {
655 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
656 ItemBase itemAtt = ItemBase.Cast(attachment);
657 if (itemAtt)
658 ApplyWetnessToItem(itemAtt);
659 }
660 }
661 }
662 }
663 }
664
665 protected void ApplyDrynessToItem(ItemBase pItem)
666 {
667 EnvironmentDrynessData drynessData = new EnvironmentDrynessData();
668 ApplyDrynessToItemEx(pItem, drynessData);
669 }
670
671 protected void ApplyDrynessToItemEx(ItemBase pItem, EnvironmentDrynessData pDrynessData)
672 {
673 if (pItem)
674 {
675 float dryingIncrement = pItem.GetDryingIncrement("player");
676 if (pDrynessData.m_UseTemperatureSources)
677 dryingIncrement = pItem.GetDryingIncrement("playerHeatSource");
678
679 ItemBase parentItem;
680 bool isParentWet = false;
681 bool parentContainsLiquid = false;
682
684 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
685 {
686 EntityAI parent = iLoc.GetParent();
687 if (parent)
688 {
689 parentItem = ItemBase.Cast(parent);
690 if (parentItem)
691 {
692 if (parentItem.GetWet() >= GameConstants.STATE_SOAKING_WET)
693 isParentWet = true;
694
695 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
696 parentContainsLiquid = true;
697 }
698
699 if ((pItem.GetWet() > m_ItemsWetnessMax) && (parent == m_Player))
700 {
701 m_ItemsWetnessMax = pItem.GetWet();
702 }
703 }
704 }
705
706 float dryingCoef = 0;
707
708 if (!isParentWet && !parentContainsLiquid)
709 {
710
711 dryingCoef = (-1 * GameConstants.ENVIRO_TICK_RATE * dryingIncrement) / pDrynessData.m_TemperatureSourceDistance;
712 if (pItem.GetWet() >= GameConstants.STATE_DAMP)
713 {
714 LogDryWetProcess(string.Format("%1 (dry coef=%2/s, current wetness=%3) [normal]", pItem.GetDisplayName(), dryingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
715 pItem.AddWet(dryingCoef);
716 }
717
718 if (pItem.GetInventory().GetCargo())
719 {
720 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
721 for (int i = 0; i < inItemCount; i++)
722 {
723 ItemBase inItem;
724 if (Class.CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
725 ApplyDrynessToItemEx(inItem, pDrynessData);
726 }
727 }
728
729 int attCount = pItem.GetInventory().AttachmentCount();
730 if (attCount > 0)
731 {
732 for (int attIdx = 0; attIdx < attCount; attIdx++)
733 {
734 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
735 ItemBase itemAtt;
736 if (ItemBase.CastTo(itemAtt, attachment))
737 ApplyDrynessToItemEx(itemAtt, pDrynessData);
738 }
739 }
740
742 }
743
744 if (parentContainsLiquid)
745 {
747 dryingCoef = (GameConstants.ENVIRO_TICK_RATE * pItem.GetSoakingIncrement("parentWithLiquid")) / pDrynessData.m_TemperatureSourceDistance;
748 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);
749 pItem.AddWet(dryingCoef);
751 }
752
753 if (isParentWet)
754 {
755 if (pItem.GetWet() < parentItem.GetWet())
756 {
758 dryingCoef = (GameConstants.ENVIRO_TICK_RATE * pItem.GetSoakingIncrement("wetParent")) / pDrynessData.m_TemperatureSourceDistance;
759 LogDryWetProcess(string.Format("%1 (dry coef=%2/s, current wetness=%3) [parent wet]", pItem.GetDisplayName(), dryingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
760 pItem.AddWet(dryingCoef);
761 }
762
764 }
765 }
766 }
767
768 // HEAT COMFORT
770 protected void ProcessItemsHeat()
771 {
772 float hcHead, hcBody, hcFeet;
773 float hHead, hBody, hFeet;
774
775 float heatComfortAvg;
776 float heatAvg;
777
781
782 heatComfortAvg = (hcHead + hcBody + hcFeet) / 3;
783 heatAvg = (hHead + hBody + hFeet) / 3;
785
786 // heat buffer
787 float applicableHB = 0.0;
788 if (m_UTSAverageTemperature < 0.001)
789 {
790 applicableHB = m_Player.GetStatHeatBuffer().Get() / 30.0;
791 if (applicableHB > 0.0)
792 {
793 if (m_HeatBufferTimer > 1.0)
794 {
796 }
797 else
798 {
800 }
801 }
802 else
803 {
804 m_HeatBufferTimer = 0.0;
805 }
806 }
807 else
808 {
809 applicableHB = m_Player.GetStatHeatBuffer().Get() / 30.0;
811 {
813 m_HeatBufferTimer = 0.0;
814 }
815 else
816 {
817 m_HeatBufferTimer = 0.0;
818 }
819 }
820
821 m_HeatComfort = (heatComfortAvg + heatAvg + (GetPlayerHeat() / 100)) + EnvTempToCoef(m_EnvironmentTemperature);
823 {
824 m_HeatComfort += applicableHB;
825 }
826 else
827 {
829 {
831 }
832 }
833
834 m_HeatComfort = Math.Clamp(m_HeatComfort, m_Player.GetStatHeatComfort().GetMin(), m_Player.GetStatHeatComfort().GetMax());
835
836 m_Player.GetStatHeatComfort().Set(m_HeatComfort);
837 }
838
840 protected bool OverridenHeatComfort(out float value);
841
842 protected float EnvTempToCoef(float pTemp)
843 {
845 {
846 return 1;
847 }
848
850 {
851 return -1;
852 }
853
855 }
856
858 protected void BodyPartHeatProperties(array<int> pBodyPartIds, float pCoef, out float pHeatComfort, out float pHeat)
859 {
860 int attCount;
861
862 EntityAI attachment;
863 ItemBase item;
864
865 pHeatComfort = -1;
866 attCount = m_Player.GetInventory().AttachmentCount();
867
868 for (int attIdx = 0; attIdx < attCount; attIdx++)
869 {
870 attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
871 if (attachment.IsClothing())
872 {
873 item = ItemBase.Cast(attachment);
874 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
875
877 for (int i = 0; i < pBodyPartIds.Count(); i++)
878 {
879 if (attachmentSlot == pBodyPartIds.Get(i))
880 {
881 float heatIsoMult = 1.0;
882 if (attachmentSlot == InventorySlots.VEST)
883 {
885 }
886
887 if (attachmentSlot == InventorySlots.BACK)
888 {
890 }
891
892 pHeatComfort += heatIsoMult * MiscGameplayFunctions.GetCurrentItemHeatIsolation(item);
893
894 // go through any attachments and cargo (only current level, ignore nested containers - they isolate)
895 int inAttCount = item.GetInventory().AttachmentCount();
896 if (inAttCount > 0)
897 {
898 for (int inAttIdx = 0; inAttIdx < inAttCount; inAttIdx++)
899 {
900 EntityAI inAttachment = item.GetInventory().GetAttachmentFromIndex(inAttIdx);
901 ItemBase itemAtt = ItemBase.Cast(inAttachment);
902 if (itemAtt)
903 {
904 pHeat += itemAtt.GetTemperature();
905 }
906 }
907 }
908 if (item.GetInventory().GetCargo())
909 {
910 int inItemCount = item.GetInventory().GetCargo().GetItemCount();
911
912 for (int j = 0; j < inItemCount; j++)
913 {
914 ItemBase inItem;
915 if (Class.CastTo(inItem, item.GetInventory().GetCargo().GetItem(j)))
916 {
917 pHeat += inItem.GetTemperature();
918 }
919 }
920 }
921 }
922 }
923 }
924 }
925
926 pHeatComfort = (pHeatComfort / pBodyPartIds.Count()) * pCoef;
927 pHeat = (pHeat / pBodyPartIds.Count()) * pCoef;
928 }
929
931 {
932 m_UTemperatureSources.Clear();
933
934 array<Object> nearestObjects = new array<Object>;
936
937 foreach (Object nearestObject : nearestObjects)
938 {
939 EntityAI ent = EntityAI.Cast(nearestObject);
940 if (ent && ent.IsUniversalTemperatureSource() && ent != m_Player)
941 {
943 if (vector.DistanceSq(m_Player.GetPosition(), ent.GetPosition()) > Math.SqrFloat(ent.GetUniversalTemperatureSource().GetMaxRange()))
944 continue;
945
946 m_UTemperatureSources.Insert(ent.GetUniversalTemperatureSource());
947 }
948 }
949
950 if (m_Player.GetItemInHands() && m_Player.GetItemInHands().IsUniversalTemperatureSource())
951 m_UTemperatureSources.Insert(m_Player.GetItemInHands().GetUniversalTemperatureSource());
952 }
953
955 {
956 if (m_UTemperatureSources.Count() == 0)
957 {
960 return;
961 }
962
963 array<float> utsTemperatures = new array<float>();
964
965 // get temperature from the source (based on distance), save it for min/max filtering
966 foreach (UTemperatureSource tempSource : m_UTemperatureSources)
967 utsTemperatures.Insert(CalcTemperatureFromTemperatureSource(tempSource));
968
969 float min = MiscGameplayFunctions.GetMinValue(utsTemperatures);
970 float max = MiscGameplayFunctions.GetMaxValue(utsTemperatures);
971
972 if (max > 0 && min < 0)
973 {
976 }
977 else
978 {
980 }
981
983 }
984
986 {
988 }
989
990 float CalcTemperatureFromTemperatureSource(notnull UTemperatureSource uts)
991 {
992 float distance = vector.Distance(m_Player.GetPosition(), uts.GetPosition());
993 distance = Math.Max(distance, 0.1); //min distance cannot be 0 (division by zero)
994 float temperature = 0;
995
996 //Debug.Log(string.Format("CalcTemperatureFromTemperatureSource::distance: %1", distance), "Environment");
997
999 if (distance > uts.GetFullRange())
1000 {
1001 float distFactor = 1 - (distance / uts.GetMaxRange());
1002 distFactor = Math.Max(distFactor, 0.0);
1003 temperature = uts.GetTemperature() * distFactor;
1004 //temperature = Math.Clamp(temperature, uts.GetTemperatureMin(), uts.GetTemperatureMax());
1005 //Debug.Log(string.Format("CalcTemperatureFromTemperatureSource::distFactor: %1", distFactor), "Environment");
1006 //Debug.Log(string.Format("CalcTemperatureFromTemperatureSource::temperatureXX: %1", temperature), "Environment");
1007 }
1008 else
1009 {
1010 temperature = uts.GetTemperature();
1011 }
1012
1013 //Debug.Log(string.Format("CalcTemperatureFromTemperatureSource::temperature: %1", temperature), "Environment");
1014
1015 return temperature;
1016 }
1017
1019#ifdef DIAG_DEVELOPER
1020 EnvDebugData GetEnvDebugData()
1021 {
1022 EnvDebugData data = new EnvDebugData();
1023 data.Synch(this, m_Player);
1024 return data;
1025 }
1026
1027 void ShowEnvDebugPlayerInfo(bool enabled)
1028 {
1029 EnvDebugData data = GetEnvDebugData();
1030 DisplayEnvDebugPlayerInfo(enabled, data);
1031 }
1032
1033 static void DisplayEnvDebugPlayerInfo(bool enabled, EnvDebugData data)
1034 {
1035 int windowPosX = 10;
1036 int windowPosY = 200;
1037
1038 Object obj;
1039
1040 DbgUI.Begin("Player stats", windowPosX, windowPosY);
1041 if ( enabled )
1042 {
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 )
1047 {
1048 DbgUI.Text(string.Format("Water Level: %1", data.m_PlayerData.m_WaterLevel));
1049 }
1050
1051 }
1052 DbgUI.End();
1053
1054 DbgUI.Begin("Weather stats:", windowPosX, windowPosY + 200);
1055 if ( enabled )
1056 {
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));
1066 }
1067 DbgUI.End();
1068 }
1069
1070 void FillDebugWeatherData(EnvDebugWeatherData data)
1071 {
1072 data.m_Wind = m_Wind;
1073 data.m_WindModifier = GetWindModifierPerSurface();
1074 data.m_Rain = m_Rain;
1075 data.m_Fog = m_Fog;
1076 data.m_Clouds = m_Clouds;
1077 }
1078#endif
1079
1081 {
1082 string message;
1083 message += "Player stats";
1084 message += "\nHeat comfort: " + m_HeatComfort.ToString();
1085 message += "\nInside: " + IsInsideBuilding().ToString() + " (" + m_Player.GetSurfaceType() + ")";
1086 message += "\nUnder roof: " + m_IsUnderRoof.ToString() + " (" + GetNextRoofCheck() + ")";
1088 {
1089 message += "\nWater Level: " + m_WaterLevel;
1090 }
1091
1092 message += "\n\nWeather stats";
1093 message += "\nEnv temperature (base): " + g_Game.GetMission().GetWorldData().GetBaseEnvTemperature().ToString();
1094 message += "\nEnv temperature (modified): " + m_EnvironmentTemperature.ToString();
1095 message += "\nWind: " + m_Wind.ToString() + " (x" + GetWindModifierPerSurface() + ")";
1096 message += "\nRain: " + m_Rain.ToString();
1097 message += "\nDay/Night (1/0): " + m_DayOrNight.ToString();
1098 message += "\nFog: " + m_Fog.ToString();
1099 message += "\nClouds: " + m_Clouds.ToString();
1100 message += "\nHeight: " + GetTemperatureHeightCorrection().ToString();
1101 message += "\nWet delta: " + GetWetDelta().ToString();
1102
1103 return message;
1104 }
1105
1107 {
1109 }
1110
1112 {
1114 {
1115 return m_WaterLevel;
1116 }
1117 else
1118 {
1119 return 0;
1120 }
1121 }
1122
1124 {
1125 return m_DayOrNight;
1126 }
1127
1128 private void LogDryWetProcess(string message, bool indented = false)
1129 {
1130 #ifdef DIAG_DEVELOPER
1131 if (m_DebugLogDryWet)
1132 {
1133 string indentation = "";
1134 if (indented)
1135 indentation = "|--";
1136
1137 Debug.Log(string.Format("%1 %2", indentation, message));
1138 }
1139 #endif
1140 }
1141}
1142
1143class EnvironmentDrynessData
1144{
1147}
1148
1149#ifdef DIAG_DEVELOPER
1150class EnvDebugPlayerData : Param
1151{
1152 float m_HeatComfort;
1153 bool m_Inside;
1154 string m_Surface;
1155 bool m_UnderRoof;
1156 int m_UnderRoofTimer;
1157 float m_WaterLevel;
1158
1159 void Synch(Environment env, PlayerBase player)
1160 {
1161 m_HeatComfort = player.GetStatHeatComfort().Get();
1162 m_Inside = env.IsInsideBuilding();
1163 m_Surface = player.GetSurfaceType();
1164 m_UnderRoof = env.IsUnderRoof();
1165 m_UnderRoofTimer = env.GetNextRoofCheck();
1166 m_WaterLevel = env.GetWaterLevel();
1167 }
1168
1169 override bool Serialize(Serializer ctx)
1170 {
1171 return (
1172 ctx.Write(m_HeatComfort) && ctx.Write(m_Inside) && ctx.Write(m_Surface) && ctx.Write(m_UnderRoof) && ctx.Write(m_UnderRoofTimer) && ctx.Write(m_WaterLevel));
1173 }
1174
1175 override bool Deserializer(Serializer ctx)
1176 {
1177 return ctx.Read(m_HeatComfort) && ctx.Read(m_Inside) && ctx.Read(m_Surface) && ctx.Read(m_UnderRoof) && ctx.Read(m_UnderRoofTimer) && ctx.Read(m_WaterLevel);
1178 }
1179}
1180
1181class EnvDebugMiscData : Param
1182{
1183 float m_TemperatureBase;
1184 float m_TemperatureModified;
1185 float m_DayOrNight;
1186 float m_Height;
1187 float m_WetDelta;
1188
1189 void Synch(Environment env)
1190 {
1191 m_TemperatureBase = g_Game.GetMission().GetWorldData().GetBaseEnvTemperature();
1192 m_TemperatureModified = env.GetTemperature();
1193 m_DayOrNight = env.GetDayOrNight();
1195 m_WetDelta = env.GetWetDelta();
1196 }
1197
1198 override bool Serialize(Serializer ctx)
1199 {
1200 return ctx.Write(m_TemperatureBase) && ctx.Write(m_TemperatureModified) && ctx.Write(m_DayOrNight) && ctx.Write(m_Height) && ctx.Write(m_WetDelta);
1201 }
1202
1203 override bool Deserializer(Serializer ctx)
1204 {
1205 return ctx.Read(m_TemperatureBase) && ctx.Read(m_TemperatureModified) && ctx.Read(m_DayOrNight) && ctx.Read(m_Height) && ctx.Read(m_WetDelta);
1206 }
1207}
1208
1209class EnvDebugWeatherData : Param
1210{
1211 float m_Wind;
1212 float m_WindModifier;
1213 float m_Rain;
1214 float m_Fog;
1215 float m_Clouds;
1216
1217 void Synch(Environment env)
1218 {
1219 env.FillDebugWeatherData(this);
1220 }
1221
1222 override bool Serialize(Serializer ctx)
1223 {
1224 return ctx.Write(m_Wind) && ctx.Write(m_WindModifier) && ctx.Write(m_Rain) && ctx.Write(m_Fog) && ctx.Write(m_Clouds);
1225 }
1226
1227 override bool Deserializer(Serializer ctx)
1228 {
1229 return ctx.Read(m_Wind) && ctx.Read(m_WindModifier) && ctx.Read(m_Rain) && ctx.Read(m_Fog) && ctx.Read(m_Clouds);
1230 }
1231}
1232
1233class EnvDebugData : Param
1234{
1235 ref EnvDebugPlayerData m_PlayerData = new EnvDebugPlayerData();
1236 ref EnvDebugMiscData m_MiscData = new EnvDebugMiscData();
1237 ref EnvDebugWeatherData m_WeatherData = new EnvDebugWeatherData();
1238
1239 void Synch(Environment env, PlayerBase player)
1240 {
1241 m_PlayerData.Synch(env, player);
1242 m_MiscData.Synch(env);
1243 m_WeatherData.Synch(env);
1244 }
1245
1246 override bool Serialize(Serializer ctx)
1247 {
1248 return m_PlayerData.Serialize(ctx) && m_MiscData.Serialize(ctx) && m_WeatherData.Serialize(ctx);
1249 }
1250
1251 override bool Deserializer(Serializer ctx)
1252 {
1253 return m_PlayerData.Deserializer(ctx) && m_MiscData.Deserializer(ctx) && m_WeatherData.Deserializer(ctx);
1254 }
1255}
1256#endif
void Serialize()
Definition Inventory.c:190
DayZGame g_Game
Definition DayZGame.c:3654
override Widget Init()
Definition DayZGame.c:122
PhxInteractionLayers
Definition DayZPhysics.c:2
float m_TemperatureSourceDistance
class Environment m_UseTemperatureSources
string m_Surface
static protected int m_Height
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
const int windowPosY
protected bool m_Debug
protected void Synch(EntityAI victim)
keeping "step" here for consistency only
Definition TrapBase.c:306
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.
Definition EnScript.c:11
static proto bool RayCastBullet(vector begPos, vector endPos, PhxInteractionLayers layerMask, Object ignoreObj, out Object hitObject, out vector hitPosition, out vector hitNormal, out float hitFraction)
Definition DbgUI.c:60
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
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
Definition Environment.c:51
protected ref SimpleMovingAverage< float > m_UTSAverageTemperatureBuffer
Definition Environment.c:56
protected void CollectAndSetEnvironmentData()
protected float m_WetDryTick
Definition Environment.c:10
int GetNextRoofCheck()
float GetTemperatureHeightCorrection()
protected ref array< UTemperatureSource > m_UTemperatureSources
Definition Environment.c:55
protected bool m_IsInWater
Definition Environment.c:36
protected float m_Clouds
Definition Environment.c:27
protected float m_HeatSourceTemp
Definition Environment.c:39
bool IsInsideBuilding()
float CalcTemperatureFromTemperatureSource(notnull UTemperatureSource uts)
protected void CheckWaterContact(out float pWaterLevel)
protected float m_Time
Definition Environment.c:29
protected float m_PlayerHeat
Definition Environment.c:19
void AddToEnvironmentTemperature(float pTemperature)
float GetDayOrNight()
protected bool IsWaterContact()
private void LogDryWetProcess(string message, bool indented=false)
protected ref array< int > m_SlotIdsBottom
Definition Environment.c:44
protected void ProcessWetnessByWaterLevel(float pWaterLevel)
void Init(PlayerBase pPlayer)
Definition Environment.c:69
float GetWaterLevel()
protected float m_PlayerTemperature
Definition Environment.c:18
protected float m_PlayerSpeed
Definition Environment.c:17
protected void CollectAndSetPlayerData()
float GetTemperature()
float GetWindModifierPerSurface()
protected float m_Rain
Definition Environment.c:23
void Environment(PlayerBase pPlayer)
Definition Environment.c:64
protected float m_PlayerHeightPos
Definition Environment.c:16
bool IsUnderRoof()
protected bool m_HasTemperatureSources
Definition Environment.c:53
const float WATER_LEVEL_MID
Definition Environment.c:6
protected void GatherTemperatureSources()
protected ref array< int > m_HeadParts
Definition Environment.c:47
protected float m_Wind
Definition Environment.c:24
protected string m_SurfaceType
Definition Environment.c:30
protected float m_DayOrNight
Definition Environment.c:26
protected float m_HeatBufferTimer
DEPRECATED.
Definition Environment.c:40
private bool IsUnderRoofBuilding()
protected ref array< int > m_SlotIdsLower
Definition Environment.c:45
bool IsTemperatureSet()
protected float m_HeatComfort
Definition Environment.c:20
protected float m_Fog
Definition Environment.c:25
void Update(float pDelta)
const float RAIN_LIMIT_LOW
Definition Environment.c:3
protected bool m_IsTempSet
Definition Environment.c:37
protected float m_ItemsWetnessMax
Definition Environment.c:11
protected bool OverridenHeatComfort(out float value)
DEPRECATED.
protected PlayerBase m_Player
Definition Environment.c:15
const float WATER_LEVEL_LOW
Definition Environment.c:7
const float WATER_LEVEL_NONE
Definition Environment.c:8
protected float m_EnvironmentTemperature
Definition Environment.c:28
protected float m_WaterLevel
Definition Environment.c:33
const float WATER_LEVEL_HIGH
Definition Environment.c:5
string GetDebugMessage()
debug
float GetWetDelta()
protected void ProcessTemperatureSources()
protected float m_RoofCheckTimer
keeps wetness of most wet item in player's possesion
Definition Environment.c:12
protected float GetPlayerHeat()
Returns heat player generated based on player's movement speed (for now)
protected float m_UTSAverageTemperature
Definition Environment.c:54
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
Definition Environment.c:43
float GetUniversalSourcesTemperageAverage()
protected ref array< int > m_BodyParts
Definition Environment.c:48
protected bool IsInsideVehicle()
protected ref array< int > m_SlotIdsComplete
Definition Environment.c:42
protected ref array< int > m_FeetParts
Definition Environment.c:49
protected bool m_IsUnderRoof
Definition Environment.c:34
private bool m_IsUnderRoofBuilding
Definition Environment.c:35
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
Definition human.c:1118
InventoryLocation.
proto native EntityAI GetParent()
returns parent of current inventory location
provides access to slot configuration
Definition EnMath.c:7
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
bool Deserializer(Serializer ctx)
Definition param.c:18
static const float THRESHOLD_HEAT_COMFORT_MINUS_WARNING
static const float THRESHOLD_HEAT_COMFORT_PLUS_WARNING
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
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.
string ToString()
Definition EnConvert.c:3
proto string ToString()
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++
Definition dayzplayer.c:602
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
Definition constants.c:796
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
Definition constants.c:658
const float ENVIRO_DRY_INCREMENT
amount of wetness added to items wet value each tick if is raining
Definition constants.c:660
const float ENVIRO_HEATCOMFORT_FEETPARTS_WEIGHT
how much this body parts (clothing) affects final heatcomfort
Definition constants.c:682
const float ENVIRO_WATER_TEMPERATURE_COEF
converts temperature of items to entities heatcomfort gain
Definition constants.c:670
const float ENVIRO_TICK_RATE
Definition constants.c:656
const float ENVIRO_TICKS_TO_WETNESS_CALCULATION
in secs. how often should enviro effet process
Definition constants.c:657
const float ENVIRO_TEMPERATURE_WIND_COEF
Definition constants.c:676
const float ENVIRO_TEMPERATURE_INSIDE_COEF
amount of ?C reduced for each 100 meteres of height above water level
Definition constants.c:673
const float ENVIRO_TEMP_EFFECT_ON_PLAYER
comfort temperature of environment for the player
Definition constants.c:688
const float ENVIRO_CLOUD_DRY_EFFECT
how much is the generic temp effect increased when player is next to a fireplace
Definition constants.c:663
const float ENVIRO_PLAYER_COMFORT_TEMP
highest temperature(deg Celsius) where the player gets highest possible heat comfort (1)
Definition constants.c:687
const float ENVIRO_TEMP_SOURCES_LOOKUP_RADIUS
Definition constants.c:706
const float ENVIRO_HIGH_TEMP_LIMIT
lowest temperature(deg Celsius) where the player gets lowest possible heat comfort (-1)
Definition constants.c:686
const float ENVIRO_FOG_TEMP_EFFECT
how many % of environment temperature can be lowered by clouds
Definition constants.c:666
const float ENVIRO_WET_INCREMENT
in secs. how often we should check if player is under the roof (raycast)
Definition constants.c:659
const float ENVIRO_HEATCOMFORT_BODYPARTS_WEIGHT
how much this head parts (clothing) affects final heatcomfort
Definition constants.c:681
const float ENVIRO_HEATCOMFORT_HEADPARTS_WEIGHT
when is sun highest on sky
Definition constants.c:680
const float ENVIRO_WIND_EFFECT
windchill effect on base temperature
Definition constants.c:677
const float ENVIRO_PLAYER_HEATBUFFER_TICK
How much heat buffer increases per one enviro tick.
Definition constants.c:691
const float ENVIRO_HEATISOLATION_BACK_WEIGHT
how much this feet parts (clothing) affects final heatcomfort
Definition constants.c:683
const float ENVIRO_TEMPERATURE_HEIGHT_REDUCTION
heat entity generates if not moving
Definition constants.c:672
const float ENVIRO_HEATISOLATION_VEST_WEIGHT
weight of back for the sum of heat isolation
Definition constants.c:684
const float ENVIRO_CLOUDS_TEMP_EFFECT
how many % of ENVIRO_SUN_INCREMENT is reduced by fog
Definition constants.c:665
const float ENVIRO_DEFAULT_ENTITY_HEAT
how many time is water colder than air
Definition constants.c:671
const float ENVIRO_PLAYER_HEATBUFFER_INCREASE
Multiplier of enviro temperature for heat buffer decrease (after its static timer runs out)
Definition constants.c:690
const float ENVIRO_PLAYER_HEATBUFFER_DECREASE
impact of enviro temperature on player (lower value = higher, cannot be zero or below!...
Definition constants.c:689
const float ENVIRO_FOG_DRY_EFFECT
how many % of ENVIRO_SUN_INCREMENT is reduced by cloudy sky
Definition constants.c:664
const float ENVIRO_LOW_TEMP_LIMIT
weight of vest for the sum of heat isolation
Definition constants.c:685
const float ENVIRO_TEMPERATURE_UNDERROOF_COEF
increases temp inside vehicles
Definition constants.c:675
const float ENVIRO_ITEM_HEAT_TRANSFER_COEF
how many times slower is wetting/drying items in backpacks
Definition constants.c:669
const float ENVIRO_TEMPERATURE_INSIDE_VEHICLE_COEF
increases temp in interiors
Definition constants.c:674
const float STATE_SOAKING_WET
Definition constants.c:767
const float STATE_WET
Definition constants.c:768
const float STATE_DAMP
Definition constants.c:769
const int LIQUID_WATER
Definition constants.c:489
const int LIQUID_RIVERWATER
Definition constants.c:490
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.