302{
304 {
305 float distanceToTemperatureSource;
306
307 foreach (
Object nearestObject : nearestObjects)
308 {
310
312 if (nearestItem && nearestItem.HasWetness() && nearestItem != pSettings.
m_Parent && !nearestItem.IsInherited(Man) && !nearestItem.IsUniversalTemperatureSource())
313 {
314 distanceToTemperatureSource =
vector.
Distance(nearestItem.GetPosition(), position);
315 distanceToTemperatureSource =
Math.
Max(distanceToTemperatureSource, 0.3);
316
317 float dryModifier = 0;
318
320 {
321 dryModifier = (-1 * m_ExecuteInterval * nearestItem.GetDryingIncrement("groundHeatSource")) / distanceToTemperatureSource;
322 Math.
Clamp(dryModifier, nearestItem.GetWetMin(), nearestItem.GetWetMax());
323 nearestItem.AddWet(dryModifier);
324 }
325
328 foreach (
EntityAI cargoEntity : cargoEntities)
329 {
331 if (cargoItem)
332 {
333 dryModifier = 0;
335 {
336 dryModifier = (-1 * m_ExecuteInterval * cargoItem.GetDryingIncrement("groundHeatSource")) / distanceToTemperatureSource;
337 Math.
Clamp(dryModifier, cargoItem.GetWetMin(), cargoItem.GetWetMax());
338 cargoItem.AddWet(dryModifier);
339 }
340 }
341 }
342 }
343 }
344 }
345
347 {
348 float distanceToTemperatureSource;
351
352 foreach (
Object nearestObject : nearestObjects)
353 {
354 if (
Class.
CastTo(nearestEntity,nearestObject) && nearestEntity != pSettings.
m_Parent && !nearestEntity.IsSelfAdjustingTemperature())
355 {
356 float temperatureDifference = tempTarget - nearestEntity.GetTemperature();
357
358 distanceToTemperatureSource =
vector.
Distance(nearestEntity.GetPosition(), position);
359 distanceToTemperatureSource =
Math.
Max(distanceToTemperatureSource, 0.1);
360
361 float time = m_ExecuteInterval;
362 if (m_ExecuteInterval == -1)
363 time = 1;
364
365 float distFactor = 1;
367 {
369 distFactor =
Math.
Max(distFactor, 0.0);
370 }
371
373
374 if (nearestEntity.GetInventory())
375 {
377 }
378 else if (nearestEntity.CanHaveTemperature() && !nearestEntity.IsSelfAdjustingTemperature())
379 {
380 dta.m_HeatPermeabilityCoef = nearestEntity.GetHeatPermeabilityCoef();
381
383 nearestEntity.SetTemperatureEx(dta);
384 else
385 nearestEntity.RefreshTemperatureAccess(dta);
386 }
387 }
388 }
389 }
390
392 {
393 float heatPermCoef = heatPermeabilityCoef;
394 heatPermCoef *= ent.GetHeatPermeabilityCoef();
396
397
398 if (ent.CanHaveTemperature() && !ent.IsSelfAdjustingTemperature())
399 {
402 ent.SetTemperatureEx(dta);
403 else
404 ent.RefreshTemperatureAccess(dta);
405 }
406
407
408 int inventoryAttCount = ent.GetInventory().AttachmentCount();
409 if (inventoryAttCount > 0)
410 {
412 for (int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
413 {
414 if (
Class.
CastTo(attachmentEnt,ent.GetInventory().GetAttachmentFromIndex(inAttIdx)))
415 {
417 }
418 }
419 }
420
421 if (ent.GetInventory().GetCargo())
422 {
423 int inventoryItemCount = ent.GetInventory().GetCargo().GetItemCount();
424 if (inventoryItemCount > 0)
425 {
427 for (int j = 0; j < inventoryItemCount; ++j)
428 {
429 if (
Class.
CastTo(cargoEnt,ent.GetInventory().GetCargo().GetItem(j)))
430 {
432 }
433 }
434 }
435 }
436 }
437
439 {
442
445 pos = pSettings.
m_Parent.GetPosition();
446
447
449
450
451 vector minPos = pos -
Vector(halfRange, halfRange / 2, halfRange);
452 vector maxPos = pos +
Vector(halfRange, halfRange / 2, halfRange);
453
456
457 for (int i = nearestObjects.Count() - 1; i >= 0; --i)
458 {
459 EntityAI entity = nearestObjects[i];
460 if (entity)
461 {
462 vector objPos = entity.GetPosition();
465 nearestObjects.Remove(i);
466 }
467 }
468
469 if (nearestObjects.Count() > 0)
470 {
473 }
474 }
475
478 {
481 pos = pSettings.
m_Parent.GetPosition();
482
483
485
486
487 vector minPos = pos -
Vector(halfRange, halfRange / 2, halfRange);
488 vector maxPos = pos +
Vector(halfRange, halfRange / 2, halfRange);
489
492
493 for (int i = nearestObjects.Count() - 1; i >= 0; --i)
494 {
495 EntityAI entity = nearestObjects[i];
496 if (entity)
497 {
498 vector objPos = entity.GetPosition();
501 nearestObjects.Remove(i);
502 }
503 }
504
506 }
507}
508
511{
513 {
514 m_AffectsPlayer = false;
515 }
516}
517
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.