303{
305 {
306 float distanceToTemperatureSource;
307
308 foreach (
Object nearestObject : nearestObjects)
309 {
312
314 if (nearestItem && nearestItem.HasWetness() && nearestItem != pSettings.
m_Parent && !nearestItem.IsInherited(Man) && !nearestItem.IsUniversalTemperatureSource())
315 {
316 distanceToTemperatureSource =
vector.
Distance(nearestItem.GetPosition(), position);
317 distanceToTemperatureSource =
Math.
Max(distanceToTemperatureSource, 0.001);
318 distanceToTemperatureSource = 1 / distanceToTemperatureSource;
319 distanceToTemperatureSource =
Math.
Clamp(distanceToTemperatureSource, 0.0, 1.0);
320
321 float dryValue = 0;
322
324 {
325 dryValue = (-1 * m_ExecuteInterval * nearestItem.GetDryingIncrement(
"groundHeatSource")) * pSettings.
m_ItemDryModifier * distanceToTemperatureSource;
326 Math.
Clamp(dryValue, nearestItem.GetWetMin(), nearestItem.GetWetMax());
327 nearestItem.AddWet(dryValue);
328 }
329
332 foreach (
EntityAI cargoEntity : cargoEntities)
333 {
335 if (cargoItem)
336 {
337 dryValue = 0;
339 {
340 dryValue = (-1 * m_ExecuteInterval * cargoItem.GetDryingIncrement(
"groundHeatSource")) * pSettings.
m_ItemDryModifier * distanceToTemperatureSource;
341 Math.
Clamp(dryValue, cargoItem.GetWetMin(), cargoItem.GetWetMax());
342 cargoItem.AddWet(dryValue);
343 }
344 }
345 }
346 }
347 }
348 }
349
351 {
352 float distanceToTemperatureSource;
355
356 foreach (
Object nearestObject : nearestObjects)
357 {
358 if (
Class.
CastTo(nearestEntity,nearestObject) && nearestEntity != pSettings.
m_Parent && !nearestEntity.IsSelfAdjustingTemperature())
359 {
360 float temperatureDifference = tempTarget - nearestEntity.GetTemperature();
361
362 distanceToTemperatureSource =
vector.
Distance(nearestEntity.GetPosition(), position);
363 distanceToTemperatureSource =
Math.
Max(distanceToTemperatureSource, 0.1);
364
365 float time = m_ExecuteInterval;
366 if (m_ExecuteInterval == -1)
367 time = 1;
368
369 float distFactor = 1;
371 {
373 distFactor =
Math.
Max(distFactor, 0.0);
374 }
375
377
378 if (nearestEntity.GetInventory())
379 {
381 }
382 else if (nearestEntity.CanHaveTemperature() && !nearestEntity.IsSelfAdjustingTemperature())
383 {
384 dta.m_HeatPermeabilityCoef = nearestEntity.GetHeatPermeabilityCoef();
385
387 nearestEntity.SetTemperatureEx(dta);
388 else
389 nearestEntity.RefreshTemperatureAccess(dta);
390 }
391 }
392 }
393 }
394
396 {
397 float heatPermCoef = heatPermeabilityCoef;
398 heatPermCoef *= ent.GetHeatPermeabilityCoef();
400
401
402 if (ent.CanHaveTemperature() && !ent.IsSelfAdjustingTemperature())
403 {
406 ent.SetTemperatureEx(dta);
407 else
408 ent.RefreshTemperatureAccess(dta);
409 }
410
411
412 int inventoryAttCount = ent.GetInventory().AttachmentCount();
413 for (int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
414 {
416 if (
Class.
CastTo(attachmentEnt,ent.GetInventory().GetAttachmentFromIndex(inAttIdx)))
417 {
419 }
420 }
421
422 CargoBase cargo = ent.GetInventory().GetCargo();
423 if (cargo)
424 {
426 for (int j = 0; j < inventoryItemCount; ++j)
427 {
430 {
432 }
433 }
434 }
435 }
436
438 {
441
444 pos = pSettings.
m_Parent.GetPosition();
445
446
448
449
450 vector minPos = pos -
Vector(halfRange, halfRange / 2, halfRange);
451 vector maxPos = pos +
Vector(halfRange, halfRange / 2, halfRange);
452
455
456 for (int i = nearestObjects.Count() - 1; i >= 0; --i)
457 {
458 EntityAI entity = nearestObjects[i];
459 if (entity)
460 {
461 vector objPos = entity.GetPosition();
464 nearestObjects.Remove(i);
465 }
466 }
467
468 if (nearestObjects.Count() > 0)
469 {
472 }
473 }
474
477 {
480 pos = pSettings.
m_Parent.GetPosition();
481
482
484
485
486 vector minPos = pos -
Vector(halfRange, halfRange / 2, halfRange);
487 vector maxPos = pos +
Vector(halfRange, halfRange / 2, halfRange);
488
491
492 for (int i = nearestObjects.Count() - 1; i >= 0; --i)
493 {
494 EntityAI entity = nearestObjects[i];
495 if (entity)
496 {
497 vector objPos = entity.GetPosition();
500 nearestObjects.Remove(i);
501 }
502 }
503
505 }
506}
507
510{
512 {
513 m_AffectsPlayer = false;
514 }
515}
516
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.