258{
260 {
261 float distanceToTemperatureSource;
262
263 foreach (
Object nearestObject : nearestObjects)
264 {
267
269 if (nearestItem && nearestItem.HasWetness() && nearestItem != pSettings.
m_Parent && !nearestItem.IsInherited(Man) && !nearestItem.IsUniversalTemperatureSource())
270 {
271 distanceToTemperatureSource =
vector.
Distance(nearestItem.GetPosition(), position);
272 distanceToTemperatureSource =
Math.
Max(distanceToTemperatureSource, 0.001);
273 distanceToTemperatureSource = 1 / distanceToTemperatureSource;
274 distanceToTemperatureSource =
Math.
Clamp(distanceToTemperatureSource, 0.0, 1.0);
275
276 float dryValue = 0;
277
279 {
280 dryValue = (-1 * m_ExecuteInterval * nearestItem.GetDryingIncrement(
"groundHeatSource")) * pSettings.
m_ItemDryModifier * distanceToTemperatureSource;
281 Math.
Clamp(dryValue, nearestItem.GetWetMin(), nearestItem.GetWetMax());
282 nearestItem.AddWet(dryValue);
283 }
284
287 foreach (
EntityAI cargoEntity : cargoEntities)
288 {
290 if (cargoItem)
291 {
292 dryValue = 0;
294 {
295 dryValue = (-1 * m_ExecuteInterval * cargoItem.GetDryingIncrement(
"groundHeatSource")) * pSettings.
m_ItemDryModifier * distanceToTemperatureSource;
296 Math.
Clamp(dryValue, cargoItem.GetWetMin(), cargoItem.GetWetMax());
297 cargoItem.AddWet(dryValue);
298 }
299 }
300 }
301 }
302 }
303 }
304
306 {
307 float distanceToTemperatureSource;
310
311 foreach (
Object nearestObject : nearestObjects)
312 {
313 if (
Class.
CastTo(nearestEntity,nearestObject) && nearestEntity != pSettings.
m_Parent && !nearestEntity.IsSelfAdjustingTemperature())
314 {
315 float temperatureDifference = tempTarget - nearestEntity.GetTemperature();
316
317 distanceToTemperatureSource =
vector.
Distance(nearestEntity.GetPosition(), position);
318 distanceToTemperatureSource =
Math.
Max(distanceToTemperatureSource, 0.1);
319
320 float time = m_ExecuteInterval;
321 if (m_ExecuteInterval == -1)
322 time = 1;
323
324 float distFactor = 1;
326 {
328 distFactor =
Math.
Max(distFactor, 0.0);
329 }
330
332
333 if (nearestEntity.GetInventory())
334 {
336 }
337 else if (nearestEntity.CanHaveTemperature() && !nearestEntity.IsSelfAdjustingTemperature())
338 {
339 dta.m_HeatPermeabilityCoef = nearestEntity.GetHeatPermeabilityCoef();
340
342 nearestEntity.SetTemperatureEx(dta);
343 else
344 nearestEntity.RefreshTemperatureAccess(dta);
345 }
346 }
347 }
348 }
349
351 {
352 float heatPermCoef = heatPermeabilityCoef;
353 heatPermCoef *= ent.GetHeatPermeabilityCoef();
355
356
357 if (ent.CanHaveTemperature() && !ent.IsSelfAdjustingTemperature())
358 {
361 ent.SetTemperatureEx(dta);
362 else
363 ent.RefreshTemperatureAccess(dta);
364 }
365
366
367 int inventoryAttCount = ent.GetInventory().AttachmentCount();
368 for (int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
369 {
371 if (
Class.
CastTo(attachmentEnt,ent.GetInventory().GetAttachmentFromIndex(inAttIdx)))
372 {
374 }
375 }
376
377 CargoBase cargo = ent.GetInventory().GetCargo();
378 if (cargo)
379 {
381 for (int j = 0; j < inventoryItemCount; ++j)
382 {
385 {
387 }
388 }
389 }
390 }
391
393 {
396
399 pos = pSettings.
m_Parent.GetPosition();
400
401
403
404
405 vector minPos = pos -
Vector(halfRange, halfRange / 2, halfRange);
406 vector maxPos = pos +
Vector(halfRange, halfRange / 2, halfRange);
407
410
411 for (int i = nearestObjects.Count() - 1; i >= 0; --i)
412 {
413 EntityAI entity = nearestObjects[i];
414 if (entity)
415 {
416 vector objPos = entity.GetPosition();
419 nearestObjects.Remove(i);
420 }
421 }
422
423 if (nearestObjects.Count() > 0)
424 {
427 }
428 }
429
432 {
435 pos = pSettings.
m_Parent.GetPosition();
436
437
439
440
441 vector minPos = pos -
Vector(halfRange, halfRange / 2, halfRange);
442 vector maxPos = pos +
Vector(halfRange, halfRange / 2, halfRange);
443
446
447 for (int i = nearestObjects.Count() - 1; i >= 0; --i)
448 {
449 EntityAI entity = nearestObjects[i];
450 if (entity)
451 {
452 vector objPos = entity.GetPosition();
455 nearestObjects.Remove(i);
456 }
457 }
458
460 }
461}
462
465{
467 {
468 m_AffectsPlayer = false;
469 }
470}
471
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.