DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Environment.c
См. документацию.
6
7class EnvironmentSnapshotData
8{
11}
12
14{
15 const float RAIN_LIMIT_LOW = 0.05;
16
17 protected const float SNOWFALL_LIMIT_LOW = 0.5;
18 protected const float SNOWFALL_WIND_COMBINED_THRESHOLD = 1.3;
19
20 const float WATER_LEVEL_HIGH = 1.5;
21 const float WATER_LEVEL_MID = 1.2;
22 const float WATER_LEVEL_LOW = 0.5;
23 const float WATER_LEVEL_NONE = 0.15;
24
25 protected float m_WetDryTick; //ticks passed since last clothing wetting or drying
26 protected float m_ItemsWetnessMax;
27 protected float m_RoofCheckTimer; // keeps info about tick time
28
29 //player
31 protected float m_PlayerHeightPos; // y position of player above water level (meters)
32 protected float m_PlayerSpeed; // 1-3 speed of player movement
33 protected float m_PlayerTemperature; //34-44
34 protected float m_PlayerHeat; //3-9 heatcomfort generated by entites movement
35 protected float m_HeatComfort;
36 protected float m_TargetHeatComfort;
37
38 //environment
39 protected float m_Rain = 0; // 0-1 amount of rain
40 protected float m_Snowfall = 0; // 0-1 amount of rain
41 protected float m_Wind = 0; // strength of wind
42 protected float m_Fog = 0; // 0-1 how foggy it is
43 protected float m_DayOrNight = 0; // 0-1 day(0) or night(1)
44 protected float m_Clouds = 0; // 0-1 how cloudy it is
45 protected float m_EnvironmentTemperature; //temperature of environment player is in
46 protected float m_Time = 0;
47 protected string m_SurfaceType;
48 protected int m_LiquidType;
49
50 //item temperatures
51 protected float m_ItemTemperatureCoef;
52
53 //
54 protected float m_WaterLevel;
55 protected bool m_IsUnderRoof;
57 protected bool m_IsInWater;
58 protected bool m_IsTempSet;
59 //
60 protected float m_HeatBufferTimer;
61 protected float m_HeatBufferCapPrevious;
62
67
68 protected ref array<int> m_HeadParts;
69 protected ref array<int> m_BodyParts;
70 protected ref array<int> m_FeetParts;
71
73
75 protected float m_UTSAverageTemperature;
77 protected ref SimpleMovingAverage<float> m_UTSAverageTemperatureBuffer;
78 protected ref SimpleMovingAverage<float> m_AverageHeatComfortBuffer;
79
81
82 private bool m_Initialized;
83
84 #ifdef DIAG_DEVELOPER
85 bool m_Debug = false;
86
87 bool m_DebugLogDryWet = false;
88 bool m_DebugLogItemHeat = false;
89 #endif
90
91 void Environment(PlayerBase pPlayer)
92 {
93 m_Player = pPlayer;
94 }
95
96 void Init()
97 {
98 m_PlayerSpeed = 0.0;
99 m_WetDryTick = 0.0;
100 m_RoofCheckTimer = 0.0;
101 m_WaterLevel = 0.0;
102 m_HeatComfort = m_Player.GetStatHeatComfort().Get();
103 m_WorldData = g_Game.GetMission().GetWorldData();
104 m_EnvironmentTemperature = m_WorldData.GetBaseEnvTemperatureAtObject(m_Player);
105
106 m_IsUnderRoof = false;
107 m_IsInWater = false;
108 m_SurfaceType = "cp_dirt";
109
110 m_HeatBufferTimer = 0.0;
111
114 m_UTSAverageTemperatureBuffer = new SimpleMovingAverage<float>(10, 0.0);
115 m_AverageHeatComfortBuffer = new SimpleMovingAverage<float>(20, m_HeatComfort);
116
120 InventorySlots.HEADGEAR,
121 InventorySlots.MASK,
122 InventorySlots.EYEWEAR,
123 InventorySlots.GLOVES,
124 InventorySlots.ARMBAND,
125 InventorySlots.BODY,
126 InventorySlots.HIPS,
127 InventorySlots.VEST,
128 InventorySlots.BACK,
129 InventorySlots.LEGS,
130 InventorySlots.FEET
131 };
135 InventorySlots.GLOVES,
136 InventorySlots.ARMBAND,
137 InventorySlots.BODY,
138 InventorySlots.HIPS,
139 InventorySlots.VEST,
140 InventorySlots.BACK,
141 InventorySlots.LEGS,
142 InventorySlots.FEET
143 };
147 InventorySlots.HIPS,
148 InventorySlots.LEGS,
149 InventorySlots.FEET
150 };
154 InventorySlots.FEET,
155 };
156
159 m_HeadParts = new array<int>();
160 m_HeadParts = {
161 InventorySlots.HEADGEAR,
162 InventorySlots.MASK,
163 };
164
165 m_BodyParts = new array<int>();
166 m_BodyParts = {
167 InventorySlots.GLOVES,
168 InventorySlots.HIPS,
169 InventorySlots.BODY,
170 InventorySlots.BACK,
171 InventorySlots.VEST,
172 InventorySlots.MELEE,
173 InventorySlots.SHOULDER
174 };
175
176 m_FeetParts = new array<int>();
177 m_FeetParts = {
178 InventorySlots.LEGS,
179 InventorySlots.FEET,
180 };
181
183 m_EnvironmentSnapshot = new EnvironmentSnapshotData();
184
185 m_Initialized = true;
186 }
187
188
189 // Calculates heatisolation of clothing, process its wetness, collects heat from heated items and calculates player's heat comfort
190 void Update(float pDelta)
191 {
192 if (m_Player && m_Initialized)
193 {
194 m_RoofCheckTimer += pDelta;
197 {
198 if ( !IsInsideBuilding() )
200
202 }
203
204 m_Time += pDelta;
206 {
207 m_Time = 0;
208 m_WetDryTick++; // Sets whether it is time to add wetness to items and clothing
209
215
217
223
227 else
229
232 {
233 if (IsWaterContact())
234 {
236 }
237 else if ((IsRaining() || (IsSnowing() && MiscGameplayFunctions.GetCombinedSnowfallWindValue() > SNOWFALL_WIND_COMBINED_THRESHOLD)) && !IsInsideBuilding() && !IsUnderRoof() && !IsChildOfType({Car}))
238 {
240 }
241 else
242 {
244 }
245
247 if ((m_ItemsWetnessMax < GameConstants.STATE_WET) && (m_Player.GetStatWet().Get() == 1))
248 {
249 m_Player.GetStatWet().Set(0);
250 }
251 else if ((m_ItemsWetnessMax >= GameConstants.STATE_WET) && (m_Player.GetStatWet().Get() == 0))
252 {
253 m_Player.GetStatWet().Set(1);
254 }
255
256 m_WetDryTick = 0;
258 }
259 }
260 }
261 }
262
264 {
265 return m_IsTempSet;
266 }
267
269 protected float GetPlayerHeat()
270 {
272 return heat;
273 }
274
276 {
277 return m_IsUnderRoof;
278 }
279
280 protected bool IsWaterContact()
281 {
282 return m_IsInWater;
283 }
284
286 {
287 return m_Player && m_Player.IsSoundInsideBuilding();
288 }
289
290 protected bool IsInsideVehicle()
291 {
292 return m_Player && m_Player.IsInVehicle();
293 }
294
295 private bool IsChildOfType(array<typename> typenames)
296 {
297 Object parent = Object.Cast(m_Player.GetParent());
298 if (parent)
299 return parent.IsAnyInherited(typenames);
300
301 return false;
302 }
303
304 private bool IsUnderRoofBuilding()
305 {
307 }
308
309 protected bool IsRaining()
310 {
311 return m_Rain > RAIN_LIMIT_LOW;
312 }
313
314 protected bool IsSnowing()
315 {
317 }
318
320 {
321 if (IsChildOfType({Car}))
322 {
323 CarScript car = CarScript.Cast(m_Player.GetParent());
324 if (car && car.EngineIsOn())
325 {
327 return true;
328 }
329 }
330
332
333 return false;
334 }
335
337 protected void CheckUnderRoof()
338 {
339 // if inside vehicle return immediatelly
340 if (IsChildOfType({Car}))
341 {
342 m_IsUnderRoof = false;
343 m_IsUnderRoofBuilding = false;
344 return;
345 }
346
347 float hitFraction;
348 vector hitPosition, hitNormal;
349 vector from = m_Player.GetPosition();
350 vector to = from + "0 25 0";
351 Object hitObject;
352 PhxInteractionLayers collisionLayerMask = PhxInteractionLayers.ITEM_LARGE|PhxInteractionLayers.BUILDING|PhxInteractionLayers.VEHICLE;
353
354 m_IsUnderRoof = DayZPhysics.RayCastBullet(from, to, collisionLayerMask, null, hitObject, hitPosition, hitNormal, hitFraction);
355
356 m_IsUnderRoofBuilding = hitObject && hitObject.IsInherited(House);
357 }
358
359 protected void CheckWaterContact(out float pWaterLevel)
360 {
361 string surfType;
362 int liquidType;
363
364 m_IsInWater = false;
365
366 if (m_Player.PhysicsGetLinkedEntity() || IsChildOfType({Transport}))
367 return;
368
369 if (m_Player.IsSwimming())
370 {
371 g_Game.SurfaceUnderObjectByBoneCorrectedLiquid(m_Player, SurfaceAnimationBone.RightFrontLimb, surfType, liquidType);
372 m_SurfaceType = surfType;
373 m_LiquidType = liquidType;
374
375 m_IsInWater = true;
376 m_Player.SetInWater(m_IsInWater);
377
379 m_Player.GetMovementState(hms);
380
381 pWaterLevel = WATER_LEVEL_MID;
382 if (hms.m_iMovement >= DayZPlayerConstants.MOVEMENTIDX_WALK)
383 pWaterLevel = WATER_LEVEL_HIGH;
384
385 return;
386 }
387
390 {
391 m_IsInWater = false;
392 return;
393 }
394
395 string impact;
396 g_Game.SurfaceUnderObjectExCorrectedLiquid(m_Player, surfType, impact, liquidType);
397
398 switch (liquidType)
399 {
400 case LIQUID_SALTWATER:
401 case LIQUID_WATER:
405 case LIQUID_HOTWATER:
406 pWaterLevel = m_Player.GetCurrentWaterLevel();
407 m_IsInWater = true;
408 break;
409 }
410
412 m_Player.SetInWater(m_IsInWater);
413
415 m_SurfaceType = surfType;
416 m_LiquidType = liquidType;
417
418 }
419
421 {
423 return 0.0;
424
425 return g_Game.ConfigGetFloat("CfgSurfaces " + m_SurfaceType + " windModifier");
426 }
427
429 {
431 }
432
434 {
435 return m_TargetHeatComfort;
436 }
437
438 // Calculates and return temperature of environment
440 {
441 float temperature = m_WorldData.GetTemperature(m_Player, EEnvironmentTemperatureComponent.ALTITUDE | EEnvironmentTemperatureComponent.OVERCAST);
442
443 if (IsWaterContact())
444 {
445 float waterBodyTemperature = m_WorldData.GetLiquidTypeEnviroTemperature(m_LiquidType);
446 temperature = waterBodyTemperature - m_WorldData.m_WaterContactTemperatureModifier;
447
448 return temperature;
449 }
450
452 {
453 temperature += m_WorldData.m_TemperatureInsideBuildingsModifier;
454 }
455 else if (IsChildOfType({Car}))
456 {
458 return temperature;
459 }
460 else if (IsUnderRoof() && !m_IsUnderRoofBuilding)
461 {
464 }
465 else
466 {
468 temperature += m_WorldData.GetTemperatureComponentValue(temperature, EEnvironmentTemperatureComponent.WIND) * GetWindModifierPerSurface();
469 }
470
471 // incorporate temperature from temperature sources (buffer)
473 temperature = m_UTSAverageTemperature;
474
475 return temperature;
476 }
477
478 // Calculates wet/drying delta based on player's location and weather
480 {
481 float wetDelta = 0;
482 if ( IsWaterContact() )
483 {
486 {
487 wetDelta = 1;
488 }
490 {
491 wetDelta = 0.66;
492 }
494 {
495 wetDelta = 0.66;
496 }
498 {
499 wetDelta = 0.33;
500 }
501 }
502 else if (!IsInsideBuilding() && !IsUnderRoof() && !IsChildOfType({Car}))
503 {
504 if (IsRaining())
506
507 if (IsSnowing() && MiscGameplayFunctions.GetCombinedSnowfallWindValue() > SNOWFALL_WIND_COMBINED_THRESHOLD)
509 }
510 else
511 {
513 float tempEffect = Math.Max(m_PlayerHeat + GetEnvironmentTemperature(), 1.0);
514
515 float weatherEffect = ((1 - (m_Fog * GameConstants.ENVIRO_FOG_DRY_EFFECT))) * (1 - (m_Clouds * GameConstants.ENVIRO_CLOUD_DRY_EFFECT));
516 if (weatherEffect <= 0)
517 {
518 weatherEffect = 1.0;
519 }
520
521 wetDelta = -(GameConstants.ENVIRO_DRY_INCREMENT * weatherEffect * tempEffect);
522 if (!IsInsideBuilding())
523 {
524 wetDelta *= 1 + (GameConstants.ENVIRO_WIND_EFFECT * m_Wind);
525 }
526 }
527
528 return wetDelta;
529 }
530
531 // EXPOSURE
532 // Each tick updates current entity member variables
533 protected void CollectAndSetPlayerData()
534 {
535 vector playerPos = m_Player.GetPosition();
536 m_PlayerHeightPos = playerPos[1];
537
538 HumanCommandMove hcm = m_Player.GetCommand_Move();
539 if (hcm)
540 {
542 }
543
545 }
546
547 // Each tick updates current environment member variables
549 {
550 Weather weather = g_Game.GetWeather();
551 m_Rain = weather.GetRain().GetActual();
552 m_Snowfall = weather.GetSnowfall().GetActual();
553 m_DayOrNight = g_Game.GetMission().GetWorldData().GetDaytime();
554 m_Fog = weather.GetFog().GetActual();
555 m_Clouds = weather.GetOvercast().GetActual();
556 m_Wind = weather.GetWindMagnitude().GetActual();
557
560 }
561
567
570 {
571 float heigthCorrectedTemp = m_WorldData.GetBaseEnvTemperatureAtObject(m_Player);
572 m_Player.SetInColdArea(heigthCorrectedTemp <= GameConstants.COLD_AREA_TEMPERATURE_THRESHOLD);
573 }
574
576 protected void ProcessWetnessByWaterLevel(float pWaterLevel)
577 {
578 if (pWaterLevel >= WATER_LEVEL_HIGH)
580 else if (pWaterLevel >= WATER_LEVEL_MID && pWaterLevel < WATER_LEVEL_HIGH)
582 else if (pWaterLevel >= WATER_LEVEL_LOW && pWaterLevel < WATER_LEVEL_MID)
584 else if (pWaterLevel >= WATER_LEVEL_NONE && pWaterLevel < WATER_LEVEL_LOW)
586 }
587
588 // Wets or dry items once in given time
589 protected void ProcessItemsWetness(array<int> pSlotIds)
590 {
591 EntityAI attachment;
592
593 int playerAttachmentCount = m_Player.GetInventory().AttachmentCount();
594
595 LogDryWetProcess(string.Format("Environment :: ProcessItemsWetness (update interval=%1s)", GameConstants.ENVIRO_TICK_RATE));
596 for (int attIdx = 0; attIdx < playerAttachmentCount; ++attIdx)
597 {
598 attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
599 if (attachment.IsItemBase())
600 {
601 int attachmentSlotsCount = attachment.GetInventory().GetSlotIdCount();
602 for (int attachmentSlotId = 0; attachmentSlotId < attachmentSlotsCount; ++attachmentSlotId)
603 {
604 int attachmentSlot = attachment.GetInventory().GetSlotId(attachmentSlotId);
605 for (int i = 0; i < pSlotIds.Count(); ++i)
606 {
607 if (attachmentSlot == pSlotIds.Get(i))
608 {
609 ApplyWetnessToItem(ItemBase.Cast(attachment));
610 break;
611 }
612 }
613 }
614 }
615 }
616
617 if (m_Player.GetItemInHands())
618 ApplyWetnessToItem(m_Player.GetItemInHands());
619
620 LogDryWetProcess("==========");
621
622 }
623
624 protected void ProcessItemsDryness()
625 {
626 EntityAI attachment;
627 ItemBase item;
628
629 int attCount = m_Player.GetInventory().AttachmentCount();
630
631 LogDryWetProcess(string.Format("Environment :: ProcessItemsDryness (update interval=%1s)", GameConstants.ENVIRO_TICK_RATE));
632 EnvironmentDrynessData drynessData = new EnvironmentDrynessData();
633 drynessData.m_UseTemperatureSources = m_HasTemperatureSources;
634
636 {
637 float distance = vector.Distance(m_UTemperatureSources[0].GetPosition(), m_Player.GetPosition());
638 distance = Math.Max(distance, 0.1);
639 drynessData.m_TemperatureSourceDistance = distance;
640 LogDryWetProcess(string.Format("distance to heatsource: %1 m", distance));
641 }
642
643 for (int attIdx = 0; attIdx < attCount; ++attIdx)
644 {
645 attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
646 if (attachment && attachment.IsItemBase())
647 {
648 item = ItemBase.Cast(attachment);
649 if (item)
650 ApplyDrynessToItemEx(item, drynessData);
651 }
652 }
653
654 if (m_Player.GetItemInHands())
655 {
656 ApplyDrynessToItemEx(m_Player.GetItemInHands(), drynessData);
657 }
658
659 LogDryWetProcess("==========");
660 }
661
662 protected void ApplyWetnessToItem(ItemBase pItem)
663 {
664 if (pItem)
665 {
666 ItemBase parentItem;
667 bool isParentWet = false;
668 bool parentContainsLiquid = false;
670
671 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
672 {
673 EntityAI parent = iLoc.GetParent();
674 if (parent)
675 {
676 parentItem = ItemBase.Cast(parent);
677 if (parentItem)
678 {
679 if (parentItem.GetWet() >= GameConstants.STATE_SOAKING_WET)
680 isParentWet = true;
681
682 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
683 parentContainsLiquid = true;
684 }
685 else
686 isParentWet = true;
687
688 if ((pItem.GetWet() > m_ItemsWetnessMax) && (parent == m_Player))
689 m_ItemsWetnessMax = pItem.GetWet();
690 }
691 }
692
693 if (isParentWet || parentContainsLiquid)
694 {
695 float soakingCoef = 0;
696 if (parentContainsLiquid)
697 {
698 soakingCoef = pItem.GetSoakingIncrement("parentWithLiquid");
699 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);
700 }
701 else if (isParentWet && parentItem)
702 {
703 if (pItem.GetWet() < parentItem.GetWet())
704 soakingCoef = GetWetDelta();
705
706 LogDryWetProcess(string.Format("%1 (soak coef=%2/s, current wetness=%3) [parent wet]", pItem.GetDisplayName(), soakingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
707 }
708 else
709 {
710 soakingCoef = GetWetDelta();
711 LogDryWetProcess(string.Format("%1 (soak coef=%2/s, current wetness=%3) [normal]", pItem.GetDisplayName(), soakingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
712 }
713
714 pItem.AddWet(soakingCoef);
715
716 if (pItem.GetInventory().GetCargo())
717 {
718 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
719 for (int i = 0; i < inItemCount; ++i)
720 {
721 ItemBase inItem;
722 if (Class.CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
723 ApplyWetnessToItem(inItem);
724 }
725 }
726
727 int attCount = pItem.GetInventory().AttachmentCount();
728 if (attCount > 0)
729 {
730 for (int attIdx = 0; attIdx < attCount; ++attIdx)
731 {
732 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
733 ItemBase itemAtt = ItemBase.Cast(attachment);
734 if (itemAtt)
735 ApplyWetnessToItem(itemAtt);
736 }
737 }
738 }
739 }
740 }
741
742 protected void ApplyDrynessToItem(ItemBase pItem)
743 {
744 EnvironmentDrynessData drynessData = new EnvironmentDrynessData();
745 ApplyDrynessToItemEx(pItem, drynessData);
746 }
747
748 protected void ApplyDrynessToItemEx(ItemBase pItem, EnvironmentDrynessData pDrynessData)
749 {
750 if (pItem)
751 {
752 float dryingIncrement = pItem.GetDryingIncrement("player");
753 if (pDrynessData.m_UseTemperatureSources)
754 dryingIncrement = pItem.GetDryingIncrement("playerHeatSource");
755
756 ItemBase parentItem;
757 bool isParentWet = false;
758 bool parentContainsLiquid = false;
759
761 if (pItem.GetInventory().GetCurrentInventoryLocation(iLoc))
762 {
763 EntityAI parent = iLoc.GetParent();
764 if (parent)
765 {
766 parentItem = ItemBase.Cast(parent);
767 if (parentItem)
768 {
769 if (parentItem.GetWet() >= GameConstants.STATE_SOAKING_WET)
770 isParentWet = true;
771
772 if ((parentItem.GetLiquidType() != 0) && (parentItem.GetQuantity() > 0))
773 parentContainsLiquid = true;
774 }
775
776 if ((pItem.GetWet() > m_ItemsWetnessMax) && (parent == m_Player))
777 m_ItemsWetnessMax = pItem.GetWet();
778 }
779 }
780
781 float dryingCoef = 0;
782
783 if (!isParentWet && !parentContainsLiquid)
784 {
785
786 dryingCoef = (-1 * GameConstants.ENVIRO_TICK_RATE * dryingIncrement) / pDrynessData.m_TemperatureSourceDistance;
787 if (pItem.GetWet() >= GameConstants.STATE_DAMP)
788 {
789 LogDryWetProcess(string.Format("%1 (dry coef=%2/s, current wetness=%3) [normal]", pItem.GetDisplayName(), dryingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
790 pItem.AddWet(dryingCoef);
791 }
792
793 if (pItem.GetInventory().GetCargo())
794 {
795 int inItemCount = pItem.GetInventory().GetCargo().GetItemCount();
796 for (int i = 0; i < inItemCount; ++i)
797 {
798 ItemBase inItem;
799 if (Class.CastTo(inItem, pItem.GetInventory().GetCargo().GetItem(i)))
800 ApplyDrynessToItemEx(inItem, pDrynessData);
801 }
802 }
803
804 int attCount = pItem.GetInventory().AttachmentCount();
805 if (attCount > 0)
806 {
807 for (int attIdx = 0; attIdx < attCount; ++attIdx)
808 {
809 EntityAI attachment = pItem.GetInventory().GetAttachmentFromIndex(attIdx);
810 ItemBase itemAtt;
811 if (ItemBase.CastTo(itemAtt, attachment))
812 ApplyDrynessToItemEx(itemAtt, pDrynessData);
813 }
814 }
815 }
816
817 if (parentContainsLiquid)
818 {
820 dryingCoef = (GameConstants.ENVIRO_TICK_RATE * pItem.GetSoakingIncrement("parentWithLiquid")) / pDrynessData.m_TemperatureSourceDistance;
821 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);
822 pItem.AddWet(dryingCoef);
823 }
824
825 if (isParentWet)
826 {
828 dryingCoef = (GameConstants.ENVIRO_TICK_RATE * pItem.GetSoakingIncrement("wetParent")) / pDrynessData.m_TemperatureSourceDistance;
829 LogDryWetProcess(string.Format("%1 (dry coef=%2/s, current wetness=%3) [parent wet]", pItem.GetDisplayName(), dryingCoef / GameConstants.ENVIRO_TICK_RATE, pItem.GetWet()), parentItem != null);
830 pItem.AddWet(dryingCoef);
831 }
832 }
833 }
834
835 // HEAT COMFORT
837 protected void ProcessHeatComfort()
838 {
839 float hcPenaltyTotal
840
841 // NEW body parts => splitted
842 float hcBodyPartTotal, hcBodyPart;
843 float hBodyPartTotal, hBodyPart;
844
845 float heatComfortSum = 0.0;
846 float heatItems = 0.0;
847
848 LogItemHeat("====================");
850 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
852 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
854 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
856 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
858 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
860 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
862 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
864 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
866 hcBodyPartTotal += hcBodyPart; hBodyPartTotal += hBodyPart;
867
874
875 heatItems = hBodyPartTotal;
876 heatComfortSum = hcBodyPartTotal;
877 heatComfortSum += hcPenaltyTotal;
878
880 {
881 if (m_Player.GetStomach().GetStomachVolume() > 0.0)
882 {
883 float stomachContentTemperature = m_Player.GetStomach().GetStomachTemperature();
884 if (stomachContentTemperature < GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT)
885 {
886 stomachContentTemperature = Math.Remap(
887 -10.0,
890 0.0,
891 stomachContentTemperature,
892 );
893 }
894 else if (stomachContentTemperature > GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
895 {
896 stomachContentTemperature = Math.Remap(
898 70.0,
899 0.0,
901 stomachContentTemperature,
902 );
903 }
904 else
905 stomachContentTemperature = 0.0;
906
907 heatComfortSum += stomachContentTemperature * GameConstants.ENVIRO_STOMACH_WEIGHT;
908 }
909 }
910
911 float targetHeatComfort = (heatComfortSum + heatItems + (GetPlayerHeat() / 100)) + EnvTempToCoef(m_EnvironmentTemperature);
912
914 m_EnvironmentSnapshot.m_ClothingHeatComfort = hcBodyPartTotal;
915 m_EnvironmentSnapshot.m_TargetHeatComfort = targetHeatComfort;
917
918 if (m_Player.GetModifiersManager().IsModifierActive(eModifiers.MDF_HEATBUFFER))
919 targetHeatComfort = Math.Clamp(targetHeatComfort, 0.0, m_Player.GetStatHeatComfort().GetMax());
920 else
921 targetHeatComfort = Math.Clamp(targetHeatComfort, m_Player.GetStatHeatComfort().GetMin(), m_Player.GetStatHeatComfort().GetMax());
922
923 targetHeatComfort = Math.Round(targetHeatComfort * 100) * 0.01;
924
925 float dynamicHeatComfort;
926
927 {
928 float direction = 1.0;
929 if (targetHeatComfort < 0.0)
930 direction = -1.0;
931
933 dynamicHeatComfort = m_AverageHeatComfortBuffer.Add(targetHeatComfort);
934 else
935 dynamicHeatComfort = m_AverageHeatComfortBuffer.Add((Math.AbsFloat(targetHeatComfort) - GameConstants.ENVIRO_HEATCOMFORT_MAX_STEP_SIZE) * direction);
936 }
937
938 dynamicHeatComfort = Math.Round(dynamicHeatComfort * 100) * 0.01;
939
940 m_HeatComfort = dynamicHeatComfort;
941
942 SetTargetHeatComfort(targetHeatComfort);
943 m_Player.GetStatHeatComfort().Set(m_HeatComfort);
944 }
945
946 protected void SetTargetHeatComfort(float value)
947 {
948 m_TargetHeatComfort = value;
949 }
950
951 protected void SetHeatcomfortDirectly()
952 {
954 {
955 float targetHeatComfort = 0.0;
956 float dynamicHeatComfort = m_AverageHeatComfortBuffer.Add(targetHeatComfort);
957
958 m_HeatComfort = dynamicHeatComfort;
959
961 m_Player.GetStatHeatComfort().Set(dynamicHeatComfort);
962 }
963 }
964
965 protected void ProcessHeatBuffer(EnvironmentSnapshotData data)
966 {
968 {
969 float applicableHeatbuffer = GetApplicableHeatbuffer();
970
972 float heatBufferCap = Math.InverseLerp(0.0, GameConstants.ENVIRO_HEATCOMFORT_WEIGHT_SUMMARY, data.m_ClothingHeatComfort);
974 m_Player.SetHeatBufferDynamicMax(heatBufferMax);
975
977 if (heatBufferCap < m_HeatBufferCapPrevious)
978 {
979 float heatBufferValueCorrection = GameConstants.ENVIRO_PLAYER_HEATBUFFER_INCREASE / (heatBufferMax * ((-GameConstants.ENVIRO_PLAYER_HEATBUFFER_TEMP_AFFECT * data.m_TargetHeatComfort) + 1 ));
980 m_Player.GetStatHeatBuffer().Add(-heatBufferValueCorrection);
981 m_HeatBufferCapPrevious = heatBufferCap;
982 }
983
984 float increaseRate = 0.0;
985 float decreaseRate = 0.0;
986
987 {
988 increaseRate = GameConstants.ENVIRO_PLAYER_HEATBUFFER_INCREASE / (heatBufferMax * (( -GameConstants.ENVIRO_PLAYER_HEATBUFFER_TEMP_AFFECT * data.m_TargetHeatComfort) + 1 ));
989 decreaseRate = GameConstants.ENVIRO_PLAYER_HEATBUFFER_DECREASE / (heatBufferMax * (( GameConstants.ENVIRO_PLAYER_HEATBUFFER_TEMP_AFFECT * data.m_TargetHeatComfort) + 1 ));
990
991 float decreaseRateByHeatBufferStageCoef = 1;
992
993 if (heatBufferMax > HeatBufferMdfr.STAGE_THRESHOLDS[1])
994 {
995 float heatBufferMaxInversed = Math.InverseLerp(HeatBufferMdfr.STAGE_THRESHOLDS[1], 1.0, heatBufferMax);
996 switch (m_Player.GetHeatBufferStage())
997 {
998 case 2:
999 decreaseRateByHeatBufferStageCoef = Math.Lerp(
1002 heatBufferMaxInversed,
1003 );
1004 break;
1005 case 1:
1006 decreaseRateByHeatBufferStageCoef = Math.Lerp(
1009 heatBufferMaxInversed,
1010 );
1011 break;
1012 }
1013 }
1014 else
1015 {
1016 decreaseRateByHeatBufferStageCoef = GameConstants.ENVIRO_PLAYER_HEATBUFFER_STAGE_RATELIMIT[1][0];
1017 }
1018
1019 decreaseRate *= decreaseRateByHeatBufferStageCoef;
1020
1021 if (m_IsInWater)
1023 }
1024
1026 {
1027 if (m_Player.GetModifiersManager().IsModifierActive(eModifiers.MDF_HEATBUFFER))
1028 {
1029 if (m_HeatBufferTimer >= 1.0)
1030 m_Player.GetStatHeatBuffer().Add(-decreaseRate);
1031 else
1032 m_HeatBufferTimer = 1.0;
1033 }
1034 else
1035 {
1036 m_HeatBufferTimer = 0.0;
1037 if (applicableHeatbuffer > 0.0)
1038 m_Player.GetStatHeatBuffer().Add(-decreaseRate);
1039 else if (applicableHeatbuffer != 0.0 && !m_Player.GetModifiersManager().IsModifierActive(eModifiers.MDF_HEATBUFFER))
1040 m_Player.GetStatHeatBuffer().Set(0.0);
1041 }
1042 }
1043 else
1044 {
1045 if (m_HeatComfort > PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_WARNING && m_UTSAverageTemperature > 0) // m_UTSAverageTemperature can be negative
1046 {
1047 if (applicableHeatbuffer < heatBufferMax)
1048 {
1049 m_Player.GetStatHeatBuffer().Add(increaseRate);
1050 m_HeatBufferCapPrevious = heatBufferCap;
1051 }
1052 }
1053 else if (applicableHeatbuffer > 0.0)
1054 m_Player.GetStatHeatBuffer().Add(-decreaseRate);
1055 else if (applicableHeatbuffer != 0.0 && !m_Player.GetModifiersManager().IsModifierActive(eModifiers.MDF_HEATBUFFER))
1056 m_Player.GetStatHeatBuffer().Set(0.0);
1057
1058 m_HeatBufferTimer = 0.0;
1059 }
1060 }
1061 }
1062
1063 protected float GetApplicableHeatbuffer()
1064 {
1065 float applicableHeatbuffer = Math.Round((m_Player.GetStatHeatBuffer().Get() / m_Player.GetStatHeatBuffer().GetMax()) * 1000) * 0.001;
1066 return applicableHeatbuffer;
1067 }
1068
1070 protected void ProcessItemsTemperature(array<int> pBodyPartIds)
1071 {
1072 EntityAI attachment;
1073 ItemBase item;
1074
1075 int attCount = m_Player.GetInventory().AttachmentCount();
1076 for (int attIdx = 0; attIdx < attCount; ++attIdx)
1077 {
1078 attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
1079 item = ItemBase.Cast(attachment);
1080 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
1081
1083 for (int i = 0; i < pBodyPartIds.Count(); ++i)
1084 {
1085 if (attachmentSlot == pBodyPartIds[i])
1086 {
1087 float heatPermCoef = item.GetHeatPermeabilityCoef();
1088 //first handle the item itself, if necessary
1089 if (item.CanHaveTemperature() && !item.IsSelfAdjustingTemperature())
1090 SetProcessedItemTemperature(item,heatPermCoef);
1091
1092 ProcessItemHierarchyRecursive(item,heatPermCoef);
1093 }
1094 }
1095 }
1096 }
1097
1099 {
1100 ItemBase item = m_Player.GetItemInHands();
1101 if (item)
1102 {
1103 float heatPermCoef = item.GetHeatPermeabilityCoef();
1104 //first handle the item itself, if necessary
1105 if (item.CanHaveTemperature() && !item.IsSelfAdjustingTemperature())
1106 SetProcessedItemTemperature(item,heatPermCoef);
1107
1108 ProcessItemHierarchyRecursive(item,heatPermCoef);
1109 }
1110 }
1111
1112 protected void ProcessItemHierarchyRecursive(ItemBase item, float heatPermeabilityCoef = 1.0)
1113 {
1114 float heatPermCoef = heatPermeabilityCoef;
1115
1116 // go through any attachments and cargo, recursive
1117 int inventoryAttCount = item.GetInventory().AttachmentCount();
1118 if (inventoryAttCount > 0)
1119 {
1120 ItemBase attachmentItem;
1121 for (int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
1122 {
1123 if (Class.CastTo(attachmentItem,item.GetInventory().GetAttachmentFromIndex(inAttIdx)))
1124 {
1125 heatPermCoef = heatPermeabilityCoef;
1126 heatPermCoef *= attachmentItem.GetHeatPermeabilityCoef();
1127
1128 if (attachmentItem.CanHaveTemperature() && !attachmentItem.IsSelfAdjustingTemperature())
1129 {
1130 SetProcessedItemTemperature(attachmentItem,heatPermCoef);
1131 }
1132
1133 ProcessItemHierarchyRecursive(attachmentItem,heatPermCoef);
1134 }
1135 }
1136 }
1137
1138 if (item.GetInventory().GetCargo())
1139 {
1140 int inventoryItemCount = item.GetInventory().GetCargo().GetItemCount();
1141 if (inventoryItemCount > 0)
1142 {
1143 ItemBase inventoryItem;
1144 for (int j = 0; j < inventoryItemCount; ++j)
1145 {
1146 if (Class.CastTo(inventoryItem,item.GetInventory().GetCargo().GetItem(j)))
1147 {
1148 heatPermCoef = heatPermeabilityCoef;
1149 heatPermCoef *= inventoryItem.GetHeatPermeabilityCoef();
1150
1151 if (inventoryItem.CanHaveTemperature() && !inventoryItem.IsSelfAdjustingTemperature())
1152 {
1153 SetProcessedItemTemperature(inventoryItem,heatPermCoef);
1154 }
1155
1156 ProcessItemHierarchyRecursive(inventoryItem,heatPermCoef);
1157 }
1158 }
1159 }
1160 }
1161 }
1162
1163 protected void SetProcessedItemTemperature(ItemBase item, float heatPermeabilityCoef = 1.0)
1164 {
1165 float targetTemperature = GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE;
1166 bool globalCooling = true;
1167 if (m_Player.IsSwimming())
1168 {
1170 targetTemperature = m_WorldData.GetLiquidTypeEnviroTemperature(m_LiquidType);
1171 globalCooling = false;
1172 }
1173
1174 if (item.GetTemperature() != targetTemperature || !item.IsFreezeThawProgressFinished())
1175 {
1176 TemperatureDataInterpolated temperatureData = new TemperatureDataInterpolated(
1177 targetTemperature,
1178 ETemperatureAccessTypes.ACCESS_INVENTORY,
1181 heatPermeabilityCoef,
1182 );
1183 temperatureData.m_UseGlobalCooling = globalCooling;
1184
1185 item.SetTemperatureEx(temperatureData);
1186 }
1187 }
1188
1189 protected float EnvTempToCoef(float pTemp)
1190 {
1192 }
1193
1195 protected void BodyPartHeatProperties(int pBodyPartId, float pCoef, out float pHeatComfort, out float pHeat)
1196 {
1197 pHeatComfort = 0;
1198 pHeat = 0;
1199
1200 int attCount = m_Player.GetInventory().AttachmentCount();
1201 for (int attIdx = 0; attIdx < attCount; ++attIdx)
1202 {
1203 EntityAI attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
1204 if (attachment.IsClothing())
1205 {
1206 ItemBase item = ItemBase.Cast(attachment);
1207 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
1208
1209 if (attachmentSlot == pBodyPartId)
1210 {
1211 LogItemHeat(string.Format("BodyPartHeatProperties (%1)", EnumTools.EnumToString(InventorySlots, pBodyPartId)));
1212
1213 float itemHeatcomfort = 0;
1214 float itemTemperature = 0;
1215
1216 // go through any attachments and cargo (only current level, ignore nested containers - they isolate)
1217 int inventoryAttCount = item.GetInventory().AttachmentCount();
1218 if (inventoryAttCount > 0)
1219 {
1220 LogItemHeat(string.Format("attachments:"), false);
1221 for (int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
1222 {
1223 EntityAI inAttachment = item.GetInventory().GetAttachmentFromIndex(inAttIdx);
1224 ItemBase attachmentItem = ItemBase.Cast(inAttachment);
1225 if (attachmentItem && attachmentItem.CanHaveTemperature())
1226 {
1227 itemTemperature = attachmentItem.GetTemperature();
1228 if (itemTemperature < GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT || itemTemperature > GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
1229 {
1230 itemHeatcomfort = NormalizedTemperature(itemTemperature) * attachmentItem.GetQuantityNormalizedScripted() * attachmentItem.GetTemperaturePerQuantityWeight();
1231 LogItemHeat(string.Format("%1: temperature=%2 heat=%3", attachmentItem, itemTemperature, pHeat), true);
1232 pHeat += itemHeatcomfort;
1233 }
1234 }
1235 }
1236 }
1237 if (item.GetInventory().GetCargo())
1238 {
1239 int inventoryItemCount = item.GetInventory().GetCargo().GetItemCount();
1240
1241 if (inventoryItemCount > 0)
1242 {
1243 LogItemHeat(string.Format("cargo:"), false);
1244 for (int j = 0; j < inventoryItemCount; ++j)
1245 {
1246 ItemBase inventoryItem = ItemBase.Cast(item.GetInventory().GetCargo().GetItem(j));
1247 if (inventoryItem && inventoryItem.CanHaveTemperature())
1248 {
1249 itemTemperature = inventoryItem.GetTemperature();
1250 if (itemTemperature < GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT || itemTemperature > GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
1251 {
1252 itemHeatcomfort = NormalizedTemperature(itemTemperature) * inventoryItem.GetQuantityNormalizedScripted() * inventoryItem.GetTemperaturePerQuantityWeight();
1253 LogItemHeat(string.Format("%1: temperature=%2 heat=%3", inventoryItem, itemTemperature, itemHeatcomfort), true);
1254 pHeat += itemHeatcomfort;
1255 }
1256 }
1257 }
1258 }
1259 }
1260
1261 pHeatComfort = MiscGameplayFunctions.GetCurrentItemHeatIsolation(item) * pCoef;
1262
1263 LogItemHeat(string.Format("overall heat from items=%1 (coef applied)", pHeat));
1264 LogItemHeat("");
1265
1266 break;
1267 }
1268 }
1269 }
1270 }
1271
1272 protected float NakedBodyPartHeatComfortPenalty(int pBodyPartSlotId, float pCoef)
1273 {
1274 float penalty = 0.0;
1275
1276 if (!IsInsideBuilding() && !IsUnderRoof() && !IsChildOfType({Car}) && !IsWaterContact())
1277 {
1279 {
1281 penalty *= pCoef;
1282 }
1283 }
1284
1285 return penalty;
1286 }
1287
1289 {
1290 m_UTemperatureSources.Clear();
1291
1292 array<Object> nearestObjects = new array<Object>();
1294
1295 foreach (Object nearestObject : nearestObjects)
1296 {
1297 EntityAI ent = EntityAI.Cast(nearestObject);
1298 if (ent && ent.IsUniversalTemperatureSource() && ent != m_Player)
1299 {
1301 if (vector.DistanceSq(m_Player.GetPosition(), ent.GetPosition()) > Math.SqrFloat(ent.GetUniversalTemperatureSource().GetMaxRange()))
1302 continue;
1303
1305 if (ent.GetUniversalTemperatureSource().GetLambda().AffectsPlayer())
1306 m_UTemperatureSources.Insert(ent.GetUniversalTemperatureSource());
1307 }
1308 }
1309
1310 if (m_Player.GetItemInHands() && m_Player.GetItemInHands().IsUniversalTemperatureSource())
1311 m_UTemperatureSources.Insert(m_Player.GetItemInHands().GetUniversalTemperatureSource());
1312 }
1313
1314 protected void SetItemHeatingCoef(float val)
1315 {
1317 }
1318
1320 {
1321 int UTScount = m_UTemperatureSources.Count();
1322 if (UTScount == 0)
1323 {
1329
1330 return;
1331 }
1332
1333 array<float> utsTemperatures = new array<float>();
1334
1335 // get temperature from the source (based on distance), save it for min/max filtering
1336 float itemCoefAverage = 0.0;
1337 foreach (UTemperatureSource tempSource : m_UTemperatureSources)
1338 {
1339 utsTemperatures.Insert(CalcTemperatureFromTemperatureSource(tempSource));
1340 itemCoefAverage += tempSource.GetTemperatureItemCoef();
1341 }
1342 itemCoefAverage /= UTScount;
1343 SetItemHeatingCoef(itemCoefAverage);
1344
1345 float min = MiscGameplayFunctions.GetMinValue(utsTemperatures);
1346 float max = MiscGameplayFunctions.GetMaxValue(utsTemperatures);
1347
1348 if (max > 0 && min < 0)
1349 {
1352 }
1353 else
1354 {
1356 }
1357
1358 if (m_HasTemperatureSources == false)
1360
1362 }
1363
1364 protected void OnTemperatureSourcesEnter();
1366
1371
1372 float CalcTemperatureFromTemperatureSource(notnull UTemperatureSource uts)
1373 {
1374 float distance = vector.Distance(m_Player.GetPosition(), uts.GetPosition());
1375 distance = Math.Max(distance, 0.1); //min distance cannot be 0 (division by zero)
1376 float temperature = 0;
1377
1379 if (distance > uts.GetFullRange())
1380 {
1381 float distFactor = Math.InverseLerp(uts.GetMaxRange(), uts.GetFullRange(), distance);
1382 temperature = uts.GetTemperatureCap() * distFactor;
1383 }
1384 else
1385 {
1386 temperature = uts.GetTemperatureCap();
1387 }
1388
1389 return temperature;
1390 }
1391
1393#ifdef DIAG_DEVELOPER
1394 EnvDebugData GetEnvDebugData()
1395 {
1396 EnvDebugData data = new EnvDebugData();
1397 data.Synch(this, m_Player);
1398 return data;
1399 }
1400
1401 void ShowEnvDebugPlayerInfo(bool enabled)
1402 {
1403 EnvDebugData data = GetEnvDebugData();
1404 DisplayEnvDebugPlayerInfo(enabled, data);
1405 }
1406
1407 static void DisplayEnvDebugPlayerInfo(bool enabled, EnvDebugData data)
1408 {
1409 int windowPosX = 10;
1410 int windowPosY = 200;
1411
1412 Object obj;
1413
1414 DbgUI.Begin("Player stats", windowPosX, windowPosY);
1415 if ( enabled )
1416 {
1417 DbgUI.Text(string.Format("Heat comfort(target): %1", data.m_PlayerData.m_HeatComfortTarget));
1418 DbgUI.Text(string.Format("Heat comfort(dynamic): %1", data.m_PlayerData.m_HeatComfortDynamic));
1419 DbgUI.Text(string.Format("Inside: %1 (%2)", data.m_PlayerData.m_Inside, data.m_PlayerData.m_Surface));
1420 DbgUI.Text(string.Format("Under roof: %1 (%2)", data.m_PlayerData.m_UnderRoof, data.m_PlayerData.m_UnderRoofTimer));
1421 if ( data.m_PlayerData.m_WaterLevel > 0 )
1422 {
1423 DbgUI.Text(string.Format("Water Level: %1", data.m_PlayerData.m_WaterLevel));
1424 }
1425
1426 }
1427 DbgUI.End();
1428
1429 DbgUI.Begin("Weather stats:", windowPosX, windowPosY + 200);
1430 if ( enabled )
1431 {
1432 DbgUI.Text(string.Format("Env temperature (base): %1", data.m_MiscData.m_TemperatureBase));
1433 DbgUI.Text(string.Format("Env temperature (height corrected): %1", data.m_MiscData.m_HeightCorrectedTemperature));
1434 DbgUI.Text(string.Format("Env temperature (modfied): %1", data.m_MiscData.m_TemperatureModified));
1435 DbgUI.Text(string.Format("Wind magnitude(surface mult): %1 (x%2)", data.m_WeatherData.m_Wind, data.m_WeatherData.m_WindModifier));
1436 DbgUI.Text(string.Format("Rain: %1", data.m_WeatherData.m_Rain));
1437 DbgUI.Text(string.Format("Snow: %1", data.m_WeatherData.m_Snowfall));
1438 DbgUI.Text(string.Format("Datetime: %1", WorldDataDaytime.ToString(g_Game.GetMission().GetWorldData().GetDaytime())));
1439 DbgUI.Text(string.Format("Fog: %1", data.m_WeatherData.m_Fog));
1440 DbgUI.Text(string.Format("Clouds: %1", data.m_WeatherData.m_Clouds));
1441 DbgUI.Text(string.Format("Wet delta: %1", data.m_MiscData.m_WetDelta));
1442 }
1443 DbgUI.End();
1444 }
1445
1446 void FillDebugWeatherData(EnvDebugWeatherData data)
1447 {
1448 data.m_Wind = m_Wind;
1449 data.m_WindModifier = GetWindModifierPerSurface();
1450 data.m_Rain = m_Rain;
1451 data.m_Snowfall = m_Snowfall;
1452 data.m_Fog = m_Fog;
1453 data.m_Clouds = m_Clouds;
1454 }
1455#endif
1456
1458 {
1459 string message;
1460 message += "Player stats";
1461 message += "\nHeat comfort(target): " + GetTargetHeatComfort().ToString();
1462 message += "\nHeat comfort(dynamic): " + m_HeatComfort.ToString();
1463
1464 int liquidType;
1465 string impact, surfaceType;
1466 g_Game.SurfaceUnderObjectExCorrectedLiquid(m_Player, surfaceType, impact, liquidType);
1467
1468 message += "\nInside: " + IsInsideBuilding().ToString();
1469 message += "\nSurface: " + surfaceType;
1470 message += "\nLiquid: " + liquidType;
1471 message += "\nUnder roof: " + m_IsUnderRoof.ToString() + " (" + GetNextRoofCheck() + ")";
1473 {
1474 message += "\nWater Level: " + m_WaterLevel;
1475 }
1476
1477 message += "\n\nWeather stats";
1478 message += "\nEnv temperature (base): " + m_WorldData.GetBaseEnvTemperature().ToString();
1479 message += "\nEnv temperature (height corrected): " + m_WorldData.GetBaseEnvTemperatureAtObject(m_Player);
1480 message += "\nEnv temperature (modified): " + m_EnvironmentTemperature.ToString();
1481 message += "\nWind: " + m_Wind.ToString() + " (x" + GetWindModifierPerSurface() + ")";
1482 message += "\nRain: " + m_Rain.ToString();
1483 message += "\nSnow: " + m_Snowfall.ToString();
1484 message += "\nDatetime: " + WorldDataDaytime.ToString(m_DayOrNight);
1485 message += "\nFog: " + m_Fog.ToString();
1486 message += "\nClouds: " + m_Clouds.ToString();
1487 message += "\nWet delta: " + GetWetDelta().ToString();
1488
1489 return message;
1490 }
1491
1496
1498 {
1500 {
1501 return m_WaterLevel;
1502 }
1503
1504 return 0.0;
1505 }
1506
1508 {
1509 if (temperature >= lowerLimit && temperature <= upperLimit)
1510 return true;
1511
1512 return false;
1513 }
1514
1515 private float NormalizedTemperature(float temperature, float lowerLimit = GameConstants.ENVIRO_LOW_TEMP_LIMIT, float upperLimit = GameConstants.ENVIRO_HIGH_TEMP_LIMIT)
1516 {
1518 return 0.0;
1519
1521 return Math.Clamp(Math.InverseLerp(lowerLimit, GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT, temperature), -1.0, -0.1);
1522
1524 return Math.Clamp(Math.InverseLerp(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT, upperLimit, temperature), 0.1, 1.0);
1525
1526 // neutral zone
1527 return 0.0;
1528 }
1529
1530 private void LogDryWetProcess(string message, bool indented = false)
1531 {
1532 #ifdef DIAG_DEVELOPER
1533 if (m_DebugLogDryWet)
1534 {
1535 string indentation = "";
1536 if (indented)
1537 indentation = "|--";
1538
1539 Debug.Log(string.Format("%1 %2", indentation, message));
1540 }
1541 #endif
1542 }
1543
1544 private void LogItemHeat(string message, bool indented = false)
1545 {
1546 #ifdef DIAG_DEVELOPER
1547 if (m_DebugLogItemHeat)
1548 {
1549 string indentation = "";
1550 if (indented)
1551 indentation = "|--";
1552
1553 Debug.Log(string.Format("%1 %2", indentation, message));
1554 }
1555 #endif
1556 }
1557
1559 protected float m_HeatSourceTemp;
1560 protected ref SimpleMovingAverage<float> m_WindAverageBuffer;
1561 protected ref EnvironmentSnapshotData m_EnvironmentSnapshot;
1562
1563 void Init(PlayerBase pPlayer)
1564 {
1565 Init();
1566 }
1567
1568 protected bool OverridenHeatComfort(out float value);
1569 void AddToEnvironmentTemperature(float pTemperature);
1570
1571 protected void ProcessItemsHeat()
1572 {
1573 // for backward combatibility only
1575 }
1576
1577 protected void ProcessWetnessByRain()
1578 {
1580 }
1581
1582 // Returns amount of deg C air temperature should be lowered by, based on player's height above water level
1584 {
1585 float temperature_reduction = Math.Max(0, (m_PlayerHeightPos * m_WorldData.m_TemperaturePerHeightReductionModifier));
1586 return temperature_reduction;
1587 }
1588
1590 protected void BodyPartHeatProperties(array<int> pBodyPartIds, float pCoef, out float pHeatComfort, out float pHeat)
1591 {
1592 pHeatComfort = 0;
1593 pHeat = 0;
1594
1595 if (pBodyPartIds.Count() > 0)
1596 {
1597 LogItemHeat(string.Format("BodyPartHeatProperties (%1)", EnumTools.EnumToString(InventorySlots, pBodyPartIds[0])));
1598
1599 int attCount = m_Player.GetInventory().AttachmentCount();
1600 for (int attIdx = 0; attIdx < attCount; ++attIdx)
1601 {
1602 EntityAI attachment = m_Player.GetInventory().GetAttachmentFromIndex(attIdx);
1603 if (attachment.IsClothing())
1604 {
1605 ItemBase item = ItemBase.Cast(attachment);
1606 int attachmentSlot = attachment.GetInventory().GetSlotId(0);
1607
1609 for (int i = 0; i < pBodyPartIds.Count(); ++i)
1610 {
1611 if (attachmentSlot == pBodyPartIds[i])
1612 {
1613 float heatIsoMult = 1.0;
1614 if (attachmentSlot == InventorySlots.BACK)
1616 else if (attachmentSlot == InventorySlots.VEST)
1618
1619 pHeatComfort += heatIsoMult * MiscGameplayFunctions.GetCurrentItemHeatIsolation(item);
1620
1621 float itemHeatcomfort = 0;
1622 float itemTemperature = 0;
1623
1624 // go through any attachments and cargo (only current level, ignore nested containers - they isolate)
1625 int inventoryAttCount = item.GetInventory().AttachmentCount();
1626 if (inventoryAttCount > 0)
1627 {
1628 LogItemHeat(string.Format("attachments:"), false);
1629 for (int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
1630 {
1631 EntityAI inAttachment = item.GetInventory().GetAttachmentFromIndex(inAttIdx);
1632 ItemBase attachmentItem = ItemBase.Cast(inAttachment);
1633 if (attachmentItem && attachmentItem.CanHaveTemperature())
1634 {
1635 itemTemperature = attachmentItem.GetTemperature();
1636 if (itemTemperature < GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT || itemTemperature > GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
1637 {
1638 itemHeatcomfort = NormalizedTemperature(itemTemperature) * attachmentItem.GetQuantityNormalizedScripted() * attachmentItem.GetTemperaturePerQuantityWeight();
1639 LogItemHeat(string.Format("%1: temperature=%2 heat=%3", attachmentItem, itemTemperature, pHeat), true);
1640 pHeat += itemHeatcomfort;
1641 }
1642 }
1643 }
1644 }
1645 if (item.GetInventory().GetCargo())
1646 {
1647 int inventoryItemCount = item.GetInventory().GetCargo().GetItemCount();
1648
1649 if (inventoryItemCount > 0)
1650 {
1651 LogItemHeat(string.Format("cargo:"), false);
1652 for (int j = 0; j < inventoryItemCount; ++j)
1653 {
1654 ItemBase inventoryItem = ItemBase.Cast(item.GetInventory().GetCargo().GetItem(j));
1655 if (inventoryItem && inventoryItem.CanHaveTemperature())
1656 {
1657 itemTemperature = inventoryItem.GetTemperature();
1658 if (itemTemperature < GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT || itemTemperature > GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
1659 {
1660 itemHeatcomfort = NormalizedTemperature(itemTemperature) * inventoryItem.GetQuantityNormalizedScripted() * inventoryItem.GetTemperaturePerQuantityWeight();
1661 LogItemHeat(string.Format("%1: temperature=%2 heat=%3", inventoryItem, itemTemperature, itemHeatcomfort), true);
1662 pHeat += itemHeatcomfort;
1663 }
1664 }
1665 }
1666 }
1667 }
1668 }
1669 }
1670 }
1671 }
1672
1673 pHeatComfort += (pHeatComfort / pBodyPartIds.Count()) * pCoef;
1674
1675 LogItemHeat(string.Format("overall heat from items=%1 (coef applied)", pHeat));
1676 LogItemHeat("");
1677 }
1678 }
1679
1681 {
1682 EnvironmentSnapshotData data = new EnvironmentSnapshotData();
1683 data.m_TargetHeatComfort = m_TargetHeatComfort;
1684
1685 m_EnvironmentSnapshot = data;
1686 }
1687
1689 protected void ProcessHeatBuffer(float heatComfortCloths)
1690 {
1691 m_EnvironmentSnapshot.m_ClothingHeatComfort = heatComfortCloths;
1692 m_EnvironmentSnapshot.m_TargetHeatComfort = m_TargetHeatComfort;
1693
1695 }
1696
1698 protected float WindEffectTemperatureValue(float temperatureInput)
1699 {
1700 float output = 0.0;
1701
1703 output = output * m_Wind * m_WorldData.GetWindCoef();
1704
1705 return -output;
1706 }
1707
1709 {
1710 return m_DayOrNight;
1711 }
1712}
1713
1714class EnvironmentDrynessData
1715{
1718}
1719
1720#ifdef DIAG_DEVELOPER
1721class EnvDebugPlayerData : Param
1722{
1723 float m_HeatComfortDynamic;
1724 float m_HeatComfortTarget;
1725 bool m_Inside;
1726 string m_Surface;
1727 bool m_UnderRoof;
1728 int m_UnderRoofTimer;
1729 float m_WaterLevel;
1730
1731 void Synch(Environment env, PlayerBase player)
1732 {
1733 m_HeatComfortTarget = env.GetTargetHeatComfort();
1734 m_HeatComfortDynamic = player.GetStatHeatComfort().Get();
1735 m_Inside = env.IsInsideBuilding();
1736 m_Surface = player.GetSurfaceType();
1737 m_UnderRoof = env.IsUnderRoof();
1738 m_UnderRoofTimer = env.GetNextRoofCheck();
1739 m_WaterLevel = env.GetWaterLevel();
1740 }
1741
1742 override bool Serialize(Serializer ctx)
1743 {
1744 return (
1745 ctx.Write(m_HeatComfortTarget) && ctx.Write(m_HeatComfortDynamic) && ctx.Write(m_Inside) && ctx.Write(m_Surface) && ctx.Write(m_UnderRoof) && ctx.Write(m_UnderRoofTimer) && ctx.Write(m_WaterLevel));
1746 }
1747
1748 override bool Deserializer(Serializer ctx)
1749 {
1750 return ctx.Write(m_HeatComfortTarget) && ctx.Read(m_HeatComfortDynamic) && ctx.Read(m_Inside) && ctx.Read(m_Surface) && ctx.Read(m_UnderRoof) && ctx.Read(m_UnderRoofTimer) && ctx.Read(m_WaterLevel);
1751 }
1752}
1753
1754class EnvDebugMiscData : Param
1755{
1756 float m_TemperatureBase;
1757 float m_TemperatureModified;
1758 float m_HeightCorrectedTemperature;
1759 float m_WetDelta;
1760
1761 void Synch(Environment env)
1762 {
1763 m_TemperatureBase = g_Game.GetMission().GetWorldData().GetBaseEnvTemperature();
1764 m_TemperatureModified = env.GetTemperature();
1765 m_HeightCorrectedTemperature = m_TemperatureBase - env.GetTemperatureHeightCorrection();
1766 m_WetDelta = env.GetWetDelta();
1767 }
1768
1769 override bool Serialize(Serializer ctx)
1770 {
1771 return ctx.Write(m_TemperatureBase) && ctx.Write(m_TemperatureModified) && ctx.Write(m_HeightCorrectedTemperature) && ctx.Write(m_WetDelta);
1772 }
1773
1774 override bool Deserializer(Serializer ctx)
1775 {
1776 return ctx.Read(m_TemperatureBase) && ctx.Read(m_TemperatureModified) && ctx.Read(m_HeightCorrectedTemperature) && ctx.Read(m_WetDelta);
1777 }
1778}
1779
1780class EnvDebugWeatherData : Param
1781{
1782 float m_Wind;
1783 float m_WindModifier;
1784 float m_Rain;
1785 float m_Snowfall;
1786 float m_Fog;
1787 float m_Clouds;
1788
1789 void Synch(Environment env)
1790 {
1791 env.FillDebugWeatherData(this);
1792 }
1793
1794 override bool Serialize(Serializer ctx)
1795 {
1796 return ctx.Write(m_Wind) && ctx.Write(m_WindModifier) && ctx.Write(m_Rain) && ctx.Write(m_Snowfall) && ctx.Write(m_Fog) && ctx.Write(m_Clouds);
1797 }
1798
1799 override bool Deserializer(Serializer ctx)
1800 {
1801 return ctx.Read(m_Wind) && ctx.Read(m_WindModifier) && ctx.Read(m_Rain) && ctx.Read(m_Snowfall) && ctx.Read(m_Fog) && ctx.Read(m_Clouds);
1802 }
1803}
1804
1805class EnvDebugData : Param
1806{
1807 ref EnvDebugPlayerData m_PlayerData = new EnvDebugPlayerData();
1808 ref EnvDebugMiscData m_MiscData = new EnvDebugMiscData();
1809 ref EnvDebugWeatherData m_WeatherData = new EnvDebugWeatherData();
1810
1811 void Synch(Environment env, PlayerBase player)
1812 {
1813 m_PlayerData.Synch(env, player);
1814 m_MiscData.Synch(env);
1815 m_WeatherData.Synch(env);
1816 }
1817
1818 override bool Serialize(Serializer ctx)
1819 {
1820 return m_PlayerData.Serialize(ctx) && m_MiscData.Serialize(ctx) && m_WeatherData.Serialize(ctx);
1821 }
1822
1823 override bool Deserializer(Serializer ctx)
1824 {
1825 return m_PlayerData.Deserializer(ctx) && m_MiscData.Deserializer(ctx) && m_WeatherData.Deserializer(ctx);
1826 }
1827}
1828#endif
void Serialize()
Определения Inventory.c:187
DayZGame g_Game
Определения DayZGame.c:3868
PhxInteractionLayers
Определения DayZPhysics.c:2
@ DEFAULT
Определения ECrewMemberState.c:3
EEnvironmentTemperatureComponent
float m_TemperatureSourceDistance
Определения Environment.c:1717
enum EEnvironmentHeatcomfortBehaviorCategory m_ClothingHeatComfort
class Environment m_UseTemperatureSources
EEnvironmentHeatcomfortBehaviorCategory
Определения Environment.c:2
@ CAR_ENGINE_ON
Определения Environment.c:4
float m_TargetHeatComfort
Определения Environment.c:10
DayZPlayer m_Player
Определения Hand_Events.c:42
string m_Surface
Определения ImpactEffects.c:17
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
const int windowPosY
Определения PluginPresenceNotifier.c:77
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
void Synch(EntityAI victim)
keeping "step" here for consistency only
Определения TrapBase.c:281
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".
Определения CivilianSedan.c:2
Super root of all classes in Enforce script.
Определения 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)
Определения DayZPhysics.c:124
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.
Определения Debug.c:122
Определения Debug.c:2
Определения Building.c:6
static string EnumToString(typename e, int enumValue)
Return string name of enum value.
Определения EnConvert.c:601
Определения EnConvert.c:590
void ProcessItemsWetness(array< int > pSlotIds)
Определения Environment.c:589
float m_Clouds
Определения Environment.c:44
void CollectAndSetEnvironmentData()
Определения Environment.c:548
ref SimpleMovingAverage< float > m_WindAverageBuffer
Определения Environment.c:1560
float GetPlayerHeat()
Returns heat player generated based on player's movement speed (for now)
Определения Environment.c:269
void ApplyDrynessToItemEx(ItemBase pItem, EnvironmentDrynessData pDrynessData)
Определения Environment.c:748
ref array< int > m_SlotIdsBottom
Определения Environment.c:65
float m_RoofCheckTimer
keeps wetness of most wet item in player's possesion
Определения Environment.c:27
float m_Time
Определения Environment.c:46
void ProcessItemsInHandsTemperature()
Определения Environment.c:1098
float GetWaterLevel()
Определения Environment.c:1497
ref array< int > m_SlotIdsComplete
Определения Environment.c:63
void SetEnvironmentSnapshotData()
Определения Environment.c:1680
float m_PlayerTemperature
Определения Environment.c:33
const float RAIN_LIMIT_LOW
Определения Environment.c:15
int m_LiquidType
Определения Environment.c:48
ref array< int > m_SlotIdsLower
Определения Environment.c:66
void CollectAndSetPlayerData()
Определения Environment.c:533
bool IsChildOfType(array< typename > typenames)
Определения Environment.c:295
const float SNOWFALL_LIMIT_LOW
Определения Environment.c:17
void CheckWaterContact(out float pWaterLevel)
Определения Environment.c:359
float m_Wind
Определения Environment.c:41
float GetUniversalSourcesTemperageAverage()
Определения Environment.c:1367
WorldData m_WorldData
Определения Environment.c:72
float m_Fog
Определения Environment.c:42
void OnTemperatureSourcesLeft()
float NakedBodyPartHeatComfortPenalty(int pBodyPartSlotId, float pCoef)
Определения Environment.c:1272
void ProcessHeatBuffer(float heatComfortCloths)
backward compatibility [<1.27]
Определения Environment.c:1689
float m_ItemTemperatureCoef
Определения Environment.c:51
void Init(PlayerBase pPlayer)
used for calculations before the data modification
Определения Environment.c:1563
ref SimpleMovingAverage< float > m_UTSAverageTemperatureBuffer
Определения Environment.c:77
ref array< int > m_SlotIdsUpper
Определения Environment.c:64
const float WATER_LEVEL_HIGH
Определения Environment.c:20
bool m_IsTempSet
Определения Environment.c:58
int m_HeatComfortBehaviorCategory
Определения Environment.c:80
float GetDayOrNight()
Определения Environment.c:1708
float NormalizedTemperature(float temperature, float lowerLimit=GameConstants.ENVIRO_LOW_TEMP_LIMIT, float upperLimit=GameConstants.ENVIRO_HIGH_TEMP_LIMIT)
Определения Environment.c:1515
void ProcessItemsHeat()
Определения Environment.c:1571
bool IsWaterContact()
Определения Environment.c:280
void SetProcessedItemTemperature(ItemBase item, float heatPermeabilityCoef=1.0)
Определения Environment.c:1163
void ProcessWetnessByWaterLevel(float pWaterLevel)
process attachments by water depth
Определения Environment.c:576
ref array< UTemperatureSource > m_UTemperatureSources
Определения Environment.c:76
void LogItemHeat(string message, bool indented=false)
Определения Environment.c:1544
float m_WetDryTick
Определения Environment.c:25
float GetApplicableHeatbuffer()
Определения Environment.c:1063
float m_DayOrNight
Определения Environment.c:43
ref array< int > m_BodyParts
Определения Environment.c:69
float m_EnvironmentTemperature
Определения Environment.c:45
bool m_HasTemperatureSources
Определения Environment.c:74
void AddToEnvironmentTemperature(float pTemperature)
string m_SurfaceType
Определения Environment.c:47
void ProcessTemperatureSources()
Определения Environment.c:1319
float EnvTempToCoef(float pTemp)
Определения Environment.c:1189
float m_UTSAverageTemperature
Определения Environment.c:75
void ApplyDrynessToItem(ItemBase pItem)
Определения Environment.c:742
float GetEnvironmentTemperature()
Определения Environment.c:439
float m_PlayerHeat
Определения Environment.c:34
float m_WaterLevel
Определения Environment.c:54
bool IsTemperatureSet()
Определения Environment.c:263
ref SimpleMovingAverage< float > m_AverageHeatComfortBuffer
Определения Environment.c:78
float WindEffectTemperatureValue(float temperatureInput)
backward compatibility [<1.28]
Определения Environment.c:1698
float GetTemperature()
Определения Environment.c:428
void Environment(PlayerBase pPlayer)
Определения Environment.c:91
const float SNOWFALL_WIND_COMBINED_THRESHOLD
Определения Environment.c:18
void CheckUnderRoof()
Checks whether Player is sheltered.
Определения Environment.c:337
bool IsInsideVehicle()
Определения Environment.c:290
void SetHeatcomfortDirectly()
Определения Environment.c:951
ref EnvironmentSnapshotData m_EnvironmentSnapshot
Определения Environment.c:1561
float m_HeatBufferCapPrevious
reused as state toggle
Определения Environment.c:61
float GetTemperatureHeightCorrection()
Определения Environment.c:1583
void ProcessItemsTemperature(array< int > pBodyPartIds)
go through all items in player's possession cool/warm them to neutral temperature
Определения Environment.c:1070
bool IsRaining()
Определения Environment.c:309
bool IsUnderRoofBuilding()
Определения Environment.c:304
void ProcessWetnessByRain()
Определения Environment.c:1577
ref array< int > m_FeetParts
Определения Environment.c:70
float m_Rain
target value of heatcomfort (non-buffered)
Определения Environment.c:39
void BodyPartHeatProperties(int pBodyPartId, float pCoef, out float pHeatComfort, out float pHeat)
returns enhanced heat comfort for given body part
Определения Environment.c:1195
const float WATER_LEVEL_NONE
Определения Environment.c:23
float GetWetDelta()
Определения Environment.c:479
bool DetermineHeatcomfortBehavior()
Определения Environment.c:319
void Update(float pDelta)
Определения Environment.c:190
bool IsSnowing()
Определения Environment.c:314
const float WATER_LEVEL_MID
Определения Environment.c:21
void GatherTemperatureSources()
Определения Environment.c:1288
bool m_Initialized
Определения Environment.c:82
PlayerBase m_Player
Определения Environment.c:30
float m_TargetHeatComfort
player's heatcomfort (buffered, stored in player stats)
Определения Environment.c:36
void SetTargetHeatComfort(float value)
Определения Environment.c:946
void Init()
Определения Environment.c:96
void ProcessItemsDryness()
Определения Environment.c:624
void SetItemHeatingCoef(float val)
Определения Environment.c:1314
bool m_IsUnderRoofBuilding
Определения Environment.c:56
bool OverridenHeatComfort(out float value)
void ApplyWetnessToItem(ItemBase pItem)
Определения Environment.c:662
float m_HeatBufferTimer
Определения Environment.c:60
bool IsUnderRoof()
Определения Environment.c:275
void BodyPartHeatProperties(array< int > pBodyPartIds, float pCoef, out float pHeatComfort, out float pHeat)
returns weighted avg heat comfort for bodypart
Определения Environment.c:1590
float GetWindModifierPerSurface()
Определения Environment.c:420
void SetAreaGenericColdness()
Determines whether player is in cold area which restricts use of some actions (digging)
Определения Environment.c:569
float m_HeatComfort
Определения Environment.c:35
float m_PlayerSpeed
Определения Environment.c:32
bool IsNeutralTemperature(float temperature, float lowerLimit=GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT, float upperLimit=GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT)
Определения Environment.c:1507
float m_Snowfall
Определения Environment.c:40
void ProcessHeatBuffer(EnvironmentSnapshotData data)
Определения Environment.c:965
float CalcTemperatureFromTemperatureSource(notnull UTemperatureSource uts)
Определения Environment.c:1372
void ProcessHeatComfort()
Calculates and process player's heatcomfort related to body parts.
Определения Environment.c:837
ref array< int > m_HeadParts
Определения Environment.c:68
string GetDebugMessage()
debug
Определения Environment.c:1457
void OnTemperatureSourcesEnter()
int GetNextRoofCheck()
Определения Environment.c:1492
bool m_IsUnderRoof
Определения Environment.c:55
bool m_IsInWater
Определения Environment.c:57
float GetTargetHeatComfort()
Определения Environment.c:433
const float WATER_LEVEL_LOW
Определения Environment.c:22
bool IsInsideBuilding()
Определения Environment.c:285
void ProcessItemHierarchyRecursive(ItemBase item, float heatPermeabilityCoef=1.0)
Определения Environment.c:1112
float m_ItemsWetnessMax
Определения Environment.c:26
float m_PlayerHeightPos
Определения Environment.c:31
void LogDryWetProcess(string message, bool indented=false)
Определения Environment.c:1530
float m_HeatSourceTemp
DEPRECATED.
Определения Environment.c:1559
void SetEnvironmentTemperature()
Определения Environment.c:562
Определения constants.c:659
const float STAGE_THRESHOLDS[NUMBER_OF_STAGES]
Определения HeatBuffer.c:4
Определения HeatBuffer.c:2
Определения CrashBase.c:2
proto native float GetCurrentMovementSpeed()
0,1,2..3 idle, walk, run, sprint
Определения human.c:434
int m_iMovement
current stance (DayZPlayerConstants.STANCEIDX_ERECT, ...), only if the command has a stance
Определения human.c:1142
Определения human.c:1139
proto native EntityAI GetParent()
returns parent of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
provides access to slot configuration
Определения InventorySlots.c:6
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
Определения InventoryItem.c:731
Определения EnMath.c:7
Определения ObjectTyped.c:2
bool Deserializer(Serializer ctx)
Определения param.c:18
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
Определения PlayerBaseClient.c:2
static const float THRESHOLD_HEAT_COMFORT_MINUS_WARNING
Определения PlayerConstants.c:92
Определения PlayerConstants.c:2
proto bool Write(void value_out)
proto bool Read(void value_in)
Base native class for all motorized wheeled vehicles.
Определения Boat.c:28
proto native Fog GetFog()
Returns a fog phenomenon object.
proto native WindMagnitude GetWindMagnitude()
Returns a wind magnitude phenomenon object.
proto native Snowfall GetSnowfall()
Returns a snowfall phenomenon object.
proto native Rain GetRain()
Returns a rain phenomenon object.
proto native Overcast GetOvercast()
Returns an overcast phenomenon object.
Определения Weather.c:165
proto native float GetActual()
static string ToString(int value)
Определения WorldData.c:470
Определения WorldData.c:463
Keeps information about currently loaded world, like temperature.
Определения WorldData.c:3
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
string ToString()
Определения EnConvert.c:3
proto string ToString(bool simple=true)
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
Определения EnConvert.c:106
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
eModifiers
Определения eModifiers.c:2
class LOD Object
proto native CGame GetGame()
const float ENVIRO_HEATISOLATION_VEST_WEIGHT
weight of back for the sum of heat isolation
Определения constants.c:1094
const float ENVIRO_HEATISOLATION_BACK_WEIGHT
how much this feet parts (clothing) affects final heatcomfort
Определения constants.c:1093
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const float TEMP_COEF_INVENTORY
Определения constants.c:941
const float TEMP_COEF_SWIMMING
Определения constants.c:948
const float ENVIRO_WIND_CHILL_LIMIT
Affects the slope of calculation.
Определения constants.c:793
const float ENVIRO_NAKED_BODY_PENALTY_SNOWFALL_MIN_VALUE
how intensive a rain should be to enable rain penalty on naked body
Определения constants.c:786
const float ENVIRO_TEMPERATURE_UNDERROOF_COEF
increases temp inside vehicles
Определения constants.c:732
const float ENVIRO_TEMP_EFFECT_ON_PLAYER
comfort temperature of environment for the player
Определения constants.c:755
static const float ENVIRO_HEATCOMFORT_VEST_WEIGHT
Определения constants.c:741
const float ENVIRO_HIGH_TEMP_LIMIT
lowest temperature(deg Celsius) where the player gets lowest possible heat comfort (-1)
Определения constants.c:753
const float ENVIRO_HEATCOMFORT_MAX_STEP_SIZE
when is sun highest on sky
Определения constants.c:737
static const float ENVIRO_HEATCOMFORT_HIPS_WEIGHT
Определения constants.c:747
const float ENVIRO_FOG_DRY_EFFECT
how many % of ENVIRO_SUN_INCREMENT is reduced by cloudy sky
Определения constants.c:726
const float COLD_AREA_TEMPERATURE_THRESHOLD
Определения constants.c:789
const float ENVIRO_DRY_INCREMENT
amount of wetness added to items wet value each tick if is raining
Определения constants.c:722
const float ENVIRO_ISOLATION_WETFACTOR_DRENCHED
Определения constants.c:775
const float ENVIRO_CLOUD_DRY_EFFECT
how much is the generic temp effect increased when player is next to a fireplace
Определения constants.c:725
const float ENVIRO_PLAYER_HEATBUFFER_CAPACITY_MIN
How much heat buffer change rates are affected by temperature.
Определения constants.c:760
const float ENVIRO_WET_INCREMENT
in secs. how often we should check if player is under the roof (raycast)
Определения constants.c:721
const float ENVIRO_PLAYER_HEATBUFFER_WATEREFFECT
impact of enviro temperature on player (lower value = higher, cannot be zero or below!...
Определения constants.c:756
const float ENVIRO_STOMACH_WEIGHT
Определения constants.c:751
const float ENVIRO_TICKS_TO_WETNESS_CALCULATION
in secs. how often should enviro effet process
Определения constants.c:719
static const float ENVIRO_HEATCOMFORT_LEGS_WEIGHT
Определения constants.c:745
static const float ENVIRO_HEATCOMFORT_WEIGHT_SUMMARY
don't forget to update the weights from above if you are adding/removing them
Определения constants.c:749
const float ENVIRO_PLAYER_HEATBUFFER_DECREASE
impact of water contact on player's heatbuffer
Определения constants.c:757
const float ENVIRO_PLAYER_HEATBUFFER_TEMP_AFFECT
How much heat buffer increases per one enviro tick.
Определения constants.c:759
static const float ENVIRO_HEATCOMFORT_GLOVES_WEIGHT
Определения constants.c:744
static const float ENVIRO_HEATCOMFORT_FEET_WEIGHT
Определения constants.c:746
const float ENVIRO_TICK_ROOF_RC_CHECK
each X (ticks) is processed wetness on items on player
Определения constants.c:720
const float ITEM_TEMPERATURE_NEUTRAL_ZONE_UPPER_LIMIT
Определения constants.c:802
const float ENVIRO_TEMPERATURE_INSIDE_VEHICLE_COEF
heat entity generates if not moving
Определения constants.c:731
const float ENVIRO_TEMP_SOURCES_LOOKUP_RADIUS
Определения constants.c:783
const float ENVIRO_WIND_EFFECT
windchill effect on base temperature
Определения constants.c:734
const float ENVIRO_WIND_EFFECT_SLOPE
time modifier, how much longer it takes to dig up worms while in a cold area
Определения constants.c:792
const float ITEM_TEMPERATURE_NEUTRAL_ZONE_LOWER_LIMIT
damage per second dealt to attachment by fire
Определения constants.c:801
const float ENVIRO_TICK_RATE
Определения constants.c:718
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения constants.c:806
static const float ENVIRO_HEATCOMFORT_BODY_WEIGHT
Определения constants.c:742
const float ENVIRO_PLAYER_COMFORT_TEMP
highest temperature(deg Celsius) where the player gets highest possible heat comfort (1)
Определения constants.c:754
const float ENVIRO_PLAYER_HEATBUFFER_INCREASE
How much heat buffer decreases per one enviro tick.
Определения constants.c:758
static const float ENVIRO_HEATCOMFORT_BACK_WEIGHT
Определения constants.c:743
static const float ENVIRO_HEATCOMFORT_HEADGEAR_WEIGHT
max step of dynamic heatcomfort change (applies if diff between target and dynamic HC is bigger than ...
Определения constants.c:739
const float ENVIRO_DEFAULT_ENTITY_HEAT
how many times slower is wetting/drying items in backpacks
Определения constants.c:730
const float ENVIRO_SNOW_WET_COEF
Above this value, the wind effect increases the modified temperature.
Определения constants.c:795
const float ENVIRO_NAKED_BODY_PENALTY_RAIN_MIN_VALUE
Определения constants.c:785
const float ENVIRO_LOW_TEMP_LIMIT
how much stomach content affects final heatcomfort
Определения constants.c:752
static const float ENVIRO_HEATCOMFORT_MASK_WEIGHT
how much this body part affects final heatcomfort
Определения constants.c:740
static ref array< ref TFloatArray > ENVIRO_PLAYER_HEATBUFFER_STAGE_RATELIMIT
Minimal heatbuffer capacity of naked character.
Определения constants.c:763
const float STATE_DAMP
Определения constants.c:873
const float STATE_SOAKING_WET
Определения constants.c:871
const float STATE_WET
Определения constants.c:872
const int LIQUID_STILLWATER
Определения constants.c:550
const int LIQUID_HOTWATER
Определения constants.c:551
const int LIQUID_FRESHWATER
Определения constants.c:549
const int LIQUID_WATER
Определения constants.c:539
const int LIQUID_RIVERWATER
Определения constants.c:540
const int LIQUID_SALTWATER
Определения constants.c:548
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float SqrFloat(float f)
Returns squared value.
static proto float Round(float f)
Returns mathematical round of value.
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 InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static float Remap(float inputMin, float inputMax, float outputMin, float outputMax, float inputValue, bool clampedOutput=true)
Returns given value remaped from input range into output range.
Определения EnMath.c:740
static proto float AbsFloat(float f)
Returns absolute value.
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9