349{
351 {
352 float distanceToTemperatureSource;
353
354 foreach (
Object nearestObject : nearestObjects)
355 {
357
359 if (nearestItem && nearestItem.HasWetness() && nearestItem != pSettings.
m_Parent && !nearestItem.IsInherited(Man) && !nearestItem.IsUniversalTemperatureSource())
360 {
361 distanceToTemperatureSource =
vector.
Distance(nearestItem.GetPosition(), position);
362 distanceToTemperatureSource =
Math.
Max(distanceToTemperatureSource, 0.3);
363
364 float dryModifier = 0;
365
367 {
368 dryModifier = (-1 * m_ExecuteInterval * nearestItem.GetDryingIncrement("groundHeatSource")) / distanceToTemperatureSource;
369 Math.
Clamp(dryModifier, nearestItem.GetWetMin(), nearestItem.GetWetMax());
370 nearestItem.AddWet(dryModifier);
371 }
372
375 foreach (
EntityAI cargoEntity : cargoEntities)
376 {
378 if (cargoItem)
379 {
380 dryModifier = 0;
382 {
383 dryModifier = (-1 * m_ExecuteInterval * cargoItem.GetDryingIncrement("groundHeatSource")) / distanceToTemperatureSource;
384 Math.
Clamp(dryModifier, cargoItem.GetWetMin(), cargoItem.GetWetMax());
385 cargoItem.AddWet(dryModifier);
386 }
387 }
388 }
389 }
390 }
391 }
392
394 {
395 float distanceToTemperatureSource;
398
399 foreach (
Object nearestObject : nearestObjects)
400 {
401 if (
Class.
CastTo(nearestEntity,nearestObject) && nearestEntity != pSettings.
m_Parent && !nearestEntity.IsSelfAdjustingTemperature())
402 {
403 float temperatureDifference = tempTarget - nearestEntity.GetTemperature();
404
405 distanceToTemperatureSource =
vector.
Distance(nearestEntity.GetPosition(), position);
406 distanceToTemperatureSource =
Math.
Max(distanceToTemperatureSource, 0.1);
407
408 float time = m_ExecuteInterval;
409 if (m_ExecuteInterval == -1)
410 time = 1;
411
412 float distFactor = 1;
414 {
416 distFactor =
Math.
Max(distFactor, 0.0);
417 }
418
420
421 if (nearestEntity.GetInventory())
422 {
424 }
425 else if (nearestEntity.CanHaveTemperature() && !nearestEntity.IsSelfAdjustingTemperature())
426 {
427 dta.m_HeatPermeabilityCoef = nearestEntity.GetHeatPermeabilityCoef();
428
430 nearestEntity.SetTemperatureEx(dta);
431 else
432 nearestEntity.RefreshTemperatureAccess(dta);
433 }
434 }
435 }
436 }
437
439 {
440 float heatPermCoef = heatPermeabilityCoef;
441 heatPermCoef *= ent.GetHeatPermeabilityCoef();
443
444
445 if (ent.CanHaveTemperature() && !ent.IsSelfAdjustingTemperature())
446 {
449 ent.SetTemperatureEx(dta);
450 else
451 ent.RefreshTemperatureAccess(dta);
452 }
453
454
455 int inventoryAttCount = ent.GetInventory().AttachmentCount();
456 if (inventoryAttCount > 0)
457 {
459 for (int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
460 {
461 if (
Class.
CastTo(attachmentEnt,ent.GetInventory().GetAttachmentFromIndex(inAttIdx)))
462 {
464 }
465 }
466 }
467
468 if (ent.GetInventory().GetCargo())
469 {
470 int inventoryItemCount = ent.GetInventory().GetCargo().GetItemCount();
471 if (inventoryItemCount > 0)
472 {
474 for (int j = 0; j < inventoryItemCount; ++j)
475 {
476 if (
Class.
CastTo(cargoEnt,ent.GetInventory().GetCargo().GetItem(j)))
477 {
479 }
480 }
481 }
482 }
483 }
484
486 {
489
492 pos = pSettings.
m_Parent.GetPosition();
493
494
496
497
498 vector minPos = pos -
Vector(halfRange, halfRange / 2, halfRange);
499 vector maxPos = pos +
Vector(halfRange, halfRange / 2, halfRange);
500
503
504 for (int i = nearestObjects.Count() - 1; i >= 0; --i)
505 {
506 EntityAI entity = nearestObjects[i];
507 if (entity)
508 {
509 vector objPos = entity.GetPosition();
512 nearestObjects.Remove(i);
513 }
514 }
515
516 if (nearestObjects.Count() > 0)
517 {
520 }
521 }
522
525 {
528 pos = pSettings.
m_Parent.GetPosition();
529
530
532
533
534 vector minPos = pos -
Vector(halfRange, halfRange / 2, halfRange);
535 vector maxPos = pos +
Vector(halfRange, halfRange / 2, halfRange);
536
539
540 for (int i = nearestObjects.Count() - 1; i >= 0; --i)
541 {
542 EntityAI entity = nearestObjects[i];
543 if (entity)
544 {
545 vector objPos = entity.GetPosition();
548 nearestObjects.Remove(i);
549 }
550 }
551
553 }
554}
555
558{
560 {
561 m_AffectsPlayer = false;
562 }
563}
564
void DayZPlayerUtils()
cannot be instantiated
override void WarmAndCoolItemsInVicinity(UniversalTemperatureSourceSettings pSettings, vector position, out notnull array< EntityAI > nearestObjects)
override void DryItemsInVicinity(UniversalTemperatureSourceSettings pSettings, vector position, out notnull array< EntityAI > nearestObjects)
void UpdateVicinityTemperatureRecursive(EntityAI ent, TemperatureData dta, float heatPermeabilityCoef=1.0)
UniversalTemperatureSourceLambdaBaseImpl UniversalTemperatureSourceLambdaBase UniversalTemperatureSourceLambdaEngine()
override void Execute(UniversalTemperatureSourceSettings pSettings, UniversalTemperatureSourceResult resultValues)
Super root of all classes in Enforce script.
float m_HeatPermeabilityCoef
vector m_Position
if the stats can be overriden by coefficient/variables from WorldData (currently TemperatureCap only)
float m_RangeFull
temperature cap that will limit the return value from GetTemperature method
float m_TemperatureCap
used to determine speed of temperature change, and some temperature subsystems
float m_TemperatureItemCoef
max temperature 'non-IsSelfAdjustingTemperature' entity in vicinity will get per update (cap);
float m_RangeMax
range where the full temperature is given to receiver
float m_TemperatureItemCap
how often the Update is ticking
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static const float TEMPERATURE_SENSITIVITY_THRESHOLD
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
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 InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto float AbsFloat(float f)
Returns absolute value.