Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
universaltemperaturesourcelambdabaseimpl.c
Go to the documentation of this file.
2 {
3  override void DryItemsInVicinity(UniversalTemperatureSourceSettings pSettings)
4  {
5  float distance;
6  array<Object> nearestObjects = new array<Object>();
7 
8  vector pos = pSettings.m_Position;
9  if (pSettings.m_Parent != null)
10  pos = pSettings.m_Parent.GetPosition();
11 
12  GetGame().GetObjectsAtPosition(pos, pSettings.m_RangeMax, nearestObjects, null);
13  foreach (Object nearestObject : nearestObjects)
14  {
15  ItemBase nearestItem = ItemBase.Cast(nearestObject);
17  if (nearestItem && nearestItem.HasWetness() && nearestItem != pSettings.m_Parent && !nearestItem.IsInherited(Man))
18  {
19  distance = vector.Distance(nearestItem.GetPosition(), pSettings.m_Position);
20  distance = Math.Max(distance, 0.1); //min distance cannot be 0 (division by zero)
21 
22  float dryModifier = 0;
23 
24  if (nearestItem.GetWet() >= GameConstants.STATE_DAMP)
25  {
26  dryModifier = (-1 * pSettings.m_UpdateInterval * nearestItem.GetDryingIncrement("groundHeatSource")) / distance;
27  Math.Clamp(dryModifier, nearestItem.GetWetMin(), nearestItem.GetWetMax());
28  nearestItem.AddWet(dryModifier);
29  }
30 
31  array<EntityAI> cargoEntities = new array<EntityAI>();
32  nearestItem.GetInventory().EnumerateInventory(InventoryTraversalType.INORDER, cargoEntities);
33  foreach (EntityAI cargoEntity : cargoEntities)
34  {
35  ItemBase cargoItem = ItemBase.Cast(cargoEntity);
36  if (cargoItem)
37  {
38  dryModifier = 0;
39  if (cargoItem.GetWet() >= GameConstants.STATE_DAMP)
40  {
41  dryModifier = (-1 * pSettings.m_UpdateInterval * cargoItem.GetDryingIncrement("groundHeatSource")) / distance;
42  Math.Clamp(dryModifier, cargoItem.GetWetMin(), cargoItem.GetWetMax());
43  cargoItem.AddWet(dryModifier);
44  }
45  }
46  }
47  }
48  }
49  }
50 }
51 
52 class UniversalTemperatureSourceLambdaConstant : UniversalTemperatureSourceLambdaBaseImpl
53 {
54  override void Execute(UniversalTemperatureSourceSettings pSettings, UniversalTemperatureSourceResult resultValues)
55  {
56  resultValues.m_Temperature = pSettings.m_TemperatureMax;
57 
58  DryItemsInVicinity(pSettings);
59  }
60 }
61 
63 {
64  override void Execute(UniversalTemperatureSourceSettings pSettings, UniversalTemperatureSourceResult resultValues)
65  {
66  resultValues.m_Temperature = pSettings.m_TemperatureMax;
67  }
68 }
ItemBase
Definition: inventoryitem.c:730
GetGame
proto native CGame GetGame()
Execute
UniversalTemperatureSourceLambdaBaseImpl UniversalTemperatureSourceLambdaBase Execute(UniversalTemperatureSourceSettings pSettings, UniversalTemperatureSourceResult resultValues)
Definition: universaltemperaturesourcelambdabaseimpl.c:54
UniversalTemperatureSourceLambdaEngine
Definition: universaltemperaturesourcelambdabaseimpl.c:62
UniversalTemperatureSourceLambdaBase
Definition: universaltemperaturesourcelambdabase.c:1
UniversalTemperatureSourceLambdaBaseImpl
Definition: universaltemperaturesourcelambdabaseimpl.c:1
DryItemsInVicinity
override void DryItemsInVicinity(UniversalTemperatureSourceSettings pSettings)
Definition: universaltemperaturesourcelambdabaseimpl.c:2
vector
Definition: enconvert.c:105
UniversalTemperatureSourceSettings
Definition: universaltemperaturesource.c:1
Object
Definition: objecttyped.c:1
array< Object >
GameConstants
Definition: constants.c:612
InventoryTraversalType
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Definition: gameplay.c:5
Math
Definition: enmath.c:6
EntityAI
Definition: building.c:5