345{
347 {
348 float distanceToTemperatureSource;
349
350 foreach (
Object nearestObject : nearestObjects)
351 {
354
356 if (nearestItem && nearestItem.HasWetness() && nearestItem != pSettings.
m_Parent && !nearestItem.IsInherited(Man) && !nearestItem.IsUniversalTemperatureSource())
357 {
358 distanceToTemperatureSource =
vector.
Distance(nearestItem.GetPosition(), position);
359 distanceToTemperatureSource =
Math.
Max(distanceToTemperatureSource, 0.001);
360 distanceToTemperatureSource = 1 / distanceToTemperatureSource;
361 distanceToTemperatureSource =
Math.
Clamp(distanceToTemperatureSource, 0.0, 1.0);
362
363 float dryValue = 0;
364
366 {
367 dryValue = (-1 * m_ExecuteInterval * nearestItem.GetDryingIncrement(
"groundHeatSource")) * pSettings.
m_ItemDryModifier * distanceToTemperatureSource;
368 Math.
Clamp(dryValue, nearestItem.GetWetMin(), nearestItem.GetWetMax());
369 nearestItem.AddWet(dryValue);
370 }
371
374 foreach (
EntityAI cargoEntity : cargoEntities)
375 {
377 if (cargoItem)
378 {
379 dryValue = 0;
381 {
382 dryValue = (-1 * m_ExecuteInterval * cargoItem.GetDryingIncrement(
"groundHeatSource")) * pSettings.
m_ItemDryModifier * distanceToTemperatureSource;
383 Math.
Clamp(dryValue, cargoItem.GetWetMin(), cargoItem.GetWetMax());
384 cargoItem.AddWet(dryValue);
385 }
386 }
387 }
388 }
389 }
390 }
391
393 {
394 float distanceToTemperatureSource;
397
398 foreach (
Object nearestObject : nearestObjects)
399 {
400 if (
Class.
CastTo(nearestEntity,nearestObject) && nearestEntity != pSettings.
m_Parent && !nearestEntity.IsSelfAdjustingTemperature())
401 {
402 float temperatureDifference = tempTarget - nearestEntity.GetTemperature();
403
404 distanceToTemperatureSource =
vector.
Distance(nearestEntity.GetPosition(), position);
405 distanceToTemperatureSource =
Math.
Max(distanceToTemperatureSource, 0.1);
406
407 float time = m_ExecuteInterval;
408 if (m_ExecuteInterval == -1)
409 time = 1;
410
411 float distFactor = 1;
413 {
415 distFactor =
Math.
Max(distFactor, 0.0);
416 }
417
419
420 if (nearestEntity.GetInventory())
421 {
423 }
424 else if (nearestEntity.CanHaveTemperature() && !nearestEntity.IsSelfAdjustingTemperature())
425 {
426 dta.m_HeatPermeabilityCoef = nearestEntity.GetHeatPermeabilityCoef();
427
429 nearestEntity.SetTemperatureEx(dta);
430 else
431 nearestEntity.RefreshTemperatureAccess(dta);
432 }
433 }
434 }
435 }
436
438 {
439 float heatPermCoef = heatPermeabilityCoef;
440 heatPermCoef *= ent.GetHeatPermeabilityCoef();
442
443
444 if (ent.CanHaveTemperature() && !ent.IsSelfAdjustingTemperature())
445 {
448 ent.SetTemperatureEx(dta);
449 else
450 ent.RefreshTemperatureAccess(dta);
451 }
452
453
454 int inventoryAttCount = ent.GetInventory().AttachmentCount();
455 for (int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
456 {
458 if (
Class.
CastTo(attachmentEnt,ent.GetInventory().GetAttachmentFromIndex(inAttIdx)))
459 {
461 }
462 }
463
464 CargoBase cargo = ent.GetInventory().GetCargo();
465 if (cargo)
466 {
468 for (int j = 0; j < inventoryItemCount; ++j)
469 {
472 {
474 }
475 }
476 }
477 }
478
480 {
483
486 pos = pSettings.
m_Parent.GetPosition();
487
488
490
491
492 vector minPos = pos -
Vector(halfRange, halfRange / 2, halfRange);
493 vector maxPos = pos +
Vector(halfRange, halfRange / 2, halfRange);
494
497
498 for (int i = nearestObjects.Count() - 1; i >= 0; --i)
499 {
500 EntityAI entity = nearestObjects[i];
501 if (entity)
502 {
503 vector objPos = entity.GetPosition();
506 nearestObjects.Remove(i);
507 }
508 }
509
510 if (nearestObjects.Count() > 0)
511 {
514 }
515 }
516
519 {
522 pos = pSettings.
m_Parent.GetPosition();
523
524
526
527
528 vector minPos = pos -
Vector(halfRange, halfRange / 2, halfRange);
529 vector maxPos = pos +
Vector(halfRange, halfRange / 2, halfRange);
530
533
534 for (int i = nearestObjects.Count() - 1; i >= 0; --i)
535 {
536 EntityAI entity = nearestObjects[i];
537 if (entity)
538 {
539 vector objPos = entity.GetPosition();
542 nearestObjects.Remove(i);
543 }
544 }
545
547 }
548}
549
552{
554 {
555 m_AffectsPlayer = false;
556 }
557}
558
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)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
represents base for cargo storage for entities
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_ItemDryModifier
maximum range where the receiver can get some temperature
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.