257{
259 {
260 float distanceToTemperatureSource;
261
262 foreach (
Object nearestObject : nearestObjects)
263 {
265
267 if (nearestItem && nearestItem.HasWetness() && nearestItem != pSettings.
m_Parent && !nearestItem.IsInherited(Man) && !nearestItem.IsUniversalTemperatureSource())
268 {
269 distanceToTemperatureSource =
vector.
Distance(nearestItem.GetPosition(), position);
270 distanceToTemperatureSource =
Math.
Max(distanceToTemperatureSource, 0.3);
271
272 float dryModifier = 0;
273
275 {
276 dryModifier = (-1 * m_ExecuteInterval * nearestItem.GetDryingIncrement("groundHeatSource")) / distanceToTemperatureSource;
277 Math.
Clamp(dryModifier, nearestItem.GetWetMin(), nearestItem.GetWetMax());
278 nearestItem.AddWet(dryModifier);
279 }
280
283 foreach (
EntityAI cargoEntity : cargoEntities)
284 {
286 if (cargoItem)
287 {
288 dryModifier = 0;
290 {
291 dryModifier = (-1 * m_ExecuteInterval * cargoItem.GetDryingIncrement("groundHeatSource")) / distanceToTemperatureSource;
292 Math.
Clamp(dryModifier, cargoItem.GetWetMin(), cargoItem.GetWetMax());
293 cargoItem.AddWet(dryModifier);
294 }
295 }
296 }
297 }
298 }
299 }
300
302 {
303 float distanceToTemperatureSource;
306
307 foreach (
Object nearestObject : nearestObjects)
308 {
309 if (
Class.
CastTo(nearestEntity,nearestObject) && nearestEntity != pSettings.
m_Parent && !nearestEntity.IsSelfAdjustingTemperature())
310 {
311 float temperatureDifference = tempTarget - nearestEntity.GetTemperature();
312
313 distanceToTemperatureSource =
vector.
Distance(nearestEntity.GetPosition(), position);
314 distanceToTemperatureSource =
Math.
Max(distanceToTemperatureSource, 0.1);
315
316 float time = m_ExecuteInterval;
317 if (m_ExecuteInterval == -1)
318 time = 1;
319
320 float distFactor = 1;
322 {
324 distFactor =
Math.
Max(distFactor, 0.0);
325 }
326
328
329 if (nearestEntity.GetInventory())
330 {
332 }
333 else if (nearestEntity.CanHaveTemperature() && !nearestEntity.IsSelfAdjustingTemperature())
334 {
335 dta.m_HeatPermeabilityCoef = nearestEntity.GetHeatPermeabilityCoef();
336
338 nearestEntity.SetTemperatureEx(dta);
339 else
340 nearestEntity.RefreshTemperatureAccess(dta);
341 }
342 }
343 }
344 }
345
347 {
348 float heatPermCoef = heatPermeabilityCoef;
349 heatPermCoef *= ent.GetHeatPermeabilityCoef();
351
352
353 if (ent.CanHaveTemperature() && !ent.IsSelfAdjustingTemperature())
354 {
357 ent.SetTemperatureEx(dta);
358 else
359 ent.RefreshTemperatureAccess(dta);
360 }
361
362
363 int inventoryAttCount = ent.GetInventory().AttachmentCount();
364 if (inventoryAttCount > 0)
365 {
367 for (int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
368 {
369 if (
Class.
CastTo(attachmentEnt,ent.GetInventory().GetAttachmentFromIndex(inAttIdx)))
370 {
372 }
373 }
374 }
375
376 if (ent.GetInventory().GetCargo())
377 {
378 int inventoryItemCount = ent.GetInventory().GetCargo().GetItemCount();
379 if (inventoryItemCount > 0)
380 {
382 for (int j = 0; j < inventoryItemCount; ++j)
383 {
384 if (
Class.
CastTo(cargoEnt,ent.GetInventory().GetCargo().GetItem(j)))
385 {
387 }
388 }
389 }
390 }
391 }
392
394 {
397
400 pos = pSettings.
m_Parent.GetPosition();
401
402
404
405
406 vector minPos = pos -
Vector(halfRange, halfRange / 2, halfRange);
407 vector maxPos = pos +
Vector(halfRange, halfRange / 2, halfRange);
408
411
412 for (int i = nearestObjects.Count() - 1; i >= 0; --i)
413 {
414 EntityAI entity = nearestObjects[i];
415 if (entity)
416 {
417 vector objPos = entity.GetPosition();
420 nearestObjects.Remove(i);
421 }
422 }
423
424 if (nearestObjects.Count() > 0)
425 {
428 }
429 }
430
433 {
436 pos = pSettings.
m_Parent.GetPosition();
437
438
440
441
442 vector minPos = pos -
Vector(halfRange, halfRange / 2, halfRange);
443 vector maxPos = pos +
Vector(halfRange, halfRange / 2, halfRange);
444
447
448 for (int i = nearestObjects.Count() - 1; i >= 0; --i)
449 {
450 EntityAI entity = nearestObjects[i];
451 if (entity)
452 {
453 vector objPos = entity.GetPosition();
456 nearestObjects.Remove(i);
457 }
458 }
459
461 }
462}
463
466{
468 {
469 m_AffectsPlayer = false;
470 }
471}
472
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.