DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ Transfer()

static void Transfer ( ItemBase source_ent,
ItemBase target_ent,
float quantity = -1 )
static

См. определение в файле Liquid.c строка 85

86 {
87 if (!Liquid.CanTransfer(source_ent, target_ent))
88 return;
89
90 float source_quantity = source_ent.GetQuantity();
91 float target_quantity = target_ent.GetQuantity();
92 float targetCfgWeight = target_ent.m_ConfigWeight;
93 int source_liquid_type = source_ent.GetLiquidType();
94
95 float available_capacity = target_ent.GetQuantityMax() - target_quantity;
96 float quantity_to_transfer;
97 //transfers all
98 if (quantity == -1)
99 {
100 quantity_to_transfer = Math.Clamp(source_quantity,0,available_capacity);
101 }
102 //transfers exact ammount
103 else
104 {
105 quantity_to_transfer = Math.Clamp(Math.Min(source_quantity,quantity),0,available_capacity);
106 }
107
108 PluginTransmissionAgents m_mta = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
109 m_mta.TransmitAgents(source_ent, target_ent, AGT_TRANSFER_COPY);
110
111 source_ent.AddQuantity(-quantity_to_transfer);
112
113 float retultTemp = (source_ent.GetTemperature() * quantity_to_transfer + target_ent.GetTemperature() * (targetCfgWeight + target_quantity)) / (targetCfgWeight + target_quantity + quantity_to_transfer);
114 target_ent.SetTemperature(retultTemp);
115
116 AffectContainerOnTransfer(target_ent,source_liquid_type,quantity_to_transfer,source_ent.GetTemperature());
117
118 Liquid.FillContainer(target_ent,source_liquid_type,quantity_to_transfer);
119 }
static void AffectContainerOnTransfer(ItemBase container, int liquidType, float amount, float sourceLiquidTransfer)
Определения Liquid.c:213
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
Определения EnMath.c:7
const int AGT_TRANSFER_COPY
Определения constants.c:498
static proto float Min(float x, float y)
Returns smaller 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'.

Перекрестные ссылки AffectContainerOnTransfer(), AGT_TRANSFER_COPY, Math::Clamp(), GetPlugin() и Math::Min().