5 float distanceToTemperatureSource;
7 foreach (
Object nearestObject : nearestObjects)
12 if (nearestItem && nearestItem.HasWetness() && nearestItem != pSettings.
m_Parent && !nearestItem.IsInherited(Man) && !nearestItem.IsUniversalTemperatureSource())
14 distanceToTemperatureSource =
vector.
Distance(nearestItem.GetPosition(), position);
15 distanceToTemperatureSource =
Math.
Max(distanceToTemperatureSource, 0.3);
17 float dryModifier = 0;
21 dryModifier = (-1 *
m_ExecuteInterval * nearestItem.GetDryingIncrement(
"groundHeatSource")) / distanceToTemperatureSource;
22 Math.
Clamp(dryModifier, nearestItem.GetWetMin(), nearestItem.GetWetMax());
23 nearestItem.AddWet(dryModifier);
28 foreach (
EntityAI cargoEntity : cargoEntities)
36 dryModifier = (-1 *
m_ExecuteInterval * cargoItem.GetDryingIncrement(
"groundHeatSource")) / distanceToTemperatureSource;
37 Math.
Clamp(dryModifier, cargoItem.GetWetMin(), cargoItem.GetWetMax());
38 cargoItem.AddWet(dryModifier);
48 float distanceToTemperatureSource;
52 foreach (
Object nearestObject : nearestObjects)
54 if (
Class.
CastTo(nearestEntity,nearestObject) && nearestEntity != pSettings.
m_Parent && !nearestEntity.IsSelfAdjustingTemperature())
56 float temperatureDifference = tempTarget - nearestEntity.GetTemperature();
58 distanceToTemperatureSource =
vector.
Distance(nearestEntity.GetPosition(), position);
59 distanceToTemperatureSource =
Math.
Max(distanceToTemperatureSource, 0.1);
69 distFactor =
Math.
Max(distFactor, 0.0);
74 if (nearestEntity.GetInventory())
78 else if (nearestEntity.CanHaveTemperature() && !nearestEntity.IsSelfAdjustingTemperature())
80 dta.m_HeatPermeabilityCoef = nearestEntity.GetHeatPermeabilityCoef();
83 nearestEntity.SetTemperatureEx(dta);
85 nearestEntity.RefreshTemperatureAccess(dta);
93 float heatPermCoef = heatPermeabilityCoef;
94 heatPermCoef *= ent.GetHeatPermeabilityCoef();
98 if (ent.CanHaveTemperature() && !ent.IsSelfAdjustingTemperature())
102 ent.SetTemperatureEx(dta);
104 ent.RefreshTemperatureAccess(dta);
108 int inventoryAttCount = ent.GetInventory().AttachmentCount();
109 if (inventoryAttCount > 0)
112 for (
int inAttIdx = 0; inAttIdx < inventoryAttCount; ++inAttIdx)
114 if (
Class.
CastTo(attachmentEnt,ent.GetInventory().GetAttachmentFromIndex(inAttIdx)))
121 if (ent.GetInventory().GetCargo())
123 int inventoryItemCount = ent.GetInventory().GetCargo().GetItemCount();
124 if (inventoryItemCount > 0)
127 for (
int j = 0; j < inventoryItemCount; ++j)
129 if (
Class.
CastTo(cargoEnt,ent.GetInventory().GetCargo().GetItem(j)))
147 pos = pSettings.
m_Parent.GetPosition();
150 if (nearestObjects.Count() > 0)
164 pos = pSettings.
m_Parent.GetPosition();
177 m_AffectsPlayer =
false;
UniversalTemperatureSourceLambdaBaseImpl UniversalTemperatureSourceLambdaBase UniversalTemperatureSourceLambdaEngine()
proto native void GetObjectsAtPosition(vector pos, float radius, out array< Object > objects, out array< CargoBase > proxyCargos)
Returns list of all objects in circle "radius" around position "pos".
Super root of all classes in Enforce script.
float m_HeatPermeabilityCoef
void UniversalTemperatureSourceLambdaBase()
override void DryItemsInVicinity(UniversalTemperatureSourceSettings pSettings)
DEPRECATED.
override void WarmAndCoolItemsInVicinity(UniversalTemperatureSourceSettings pSettings, vector position, out notnull array< Object > nearestObjects)
override void DryItemsInVicinity(UniversalTemperatureSourceSettings pSettings, vector position, out notnull array< Object > nearestObjects)
void UpdateVicinityTemperatureRecursive(EntityAI ent, TemperatureData dta, float heatPermeabilityCoef=1.0)
override void Execute(UniversalTemperatureSourceSettings pSettings, UniversalTemperatureSourceResult resultValues)
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
proto native CGame GetGame()
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
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.