176 {
178 string cfg_energy_manager = cfg_item + " EnergyManager ";
179
180
186
192
196
199
201
203
204
205
207
209 {
210 string error =
"Error! Item " +
m_ThisEntityAI.GetType() +
" has invalid configuration of the energy->quantity conversion feature. To fix this, add 'varQuantityMax' parameter with value higher than 0 to the item's config. Then make sure to re-build the PBO containing this item!";
213 }
214 else
215 {
217 {
220
222 }
223 }
224
225
226 if ( update_interval <= 0 )
228
230
231
232 string cfg_check_energy_limit = cfg_energy_manager + "energyStorageMax";
233
234 if ( !
GetGame().ConfigIsExisting (cfg_check_energy_limit) &&
m_Energy > 0 )
235 {
237 }
238
239
240 string cfg_check_plug_types = cfg_energy_manager + "compatiblePlugTypes";
241
242 if (
GetGame().ConfigIsExisting (cfg_check_plug_types) )
243 {
246 }
247
250
252 {
254 string error_message_cord =
"Warning! " +
m_ThisEntityAI.GetType() +
": config parameter 'cordLength' is less than 0! Cord length should not be negative!";
255 DPrint(error_message_cord);
256 }
257
259 {
261
262 string cfg_animation_sources =
"cfgVehicles " +
m_ThisEntityAI.GetType() +
" " +
"AnimationSources ";
264
265 for (int i_selection = 0; i_selection < animation_sources_count; i_selection++)
266 {
267
268 string selection;
271 }
272 }
273
274
275
276
278 {
280 string error_message_sockets =
"Error! " +
m_ThisEntityAI.GetType() +
": config parameter 'powerSocketsCount' is higher than the current limit (" +
MAX_SOCKETS_COUNT.ToString() +
")! Raise the limit (constant MAX_SOCKETS_COUNT) or decrease the powerSocketsCount parameter for this device!";
281 DPrint(error_message_sockets);
282 }
283
285
287
288 if ( switch_on )
289 {
291 }
292
294 {
296 }
297
298
301 {
303 }
304
306
308
309
310 #ifdef DIAG_DEVELOPER
311 GetGame().m_EnergyManagerArray.Insert(
this );
312 #endif
313 }
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
proto native void ConfigGetIntArray(string path, out TIntArray values)
Get array of integers from config on path.
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
void SwitchOn()
Energy manager: Switches ON the device so it starts doing its work if it has enough energy.
static const string SOCKET_
bool m_ConvertEnergyToQuantity
ref Timer m_UpdateQuantityTimer
bool m_HasElectricityIcon
static const string _PLUGGED
void SetUpdateInterval(float value)
Energy manager: Sets the interval of the OnWork(...) calls. Changing this value does not change the r...
const float DEFAULT_UPDATE_INTERVAL
ref array< EntityAI > m_PluggedDevices
const int MAX_SOCKETS_COUNT
float m_ReduceMaxEnergyByDamageCoef
ref TIntArray m_CompatiblePlugTypes
EntityAI m_Sockets[MAX_SOCKETS_COUNT]
ref map< string, EntityAI > m_DeviceByPlugSelection
int m_AttachmentActionType
bool m_ShowSocketsInInventory
static const string SEL_CORD_PLUGGED
bool m_AutoSwitchOffWhenInCargo
bool IsPlugCompatible(int plug_ID)
Energy manager: Checks if the given plug is compatible with this device's socket. Used by CanReceiveP...
int GetSocketsCount()
Energy manager: Returns the count of power sockets (whenever used or not)
bool HasEnoughStoredEnergy()
Energy manager: Returns true if this device has enough of stored energy for its own use.
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
proto void DPrint(string var)
Prints content of variable to console/log. Should be used for critical messages so it will appear in ...