34 RegisterNetSyncVariableInt(
"m_BatteryEnergy0To100");
53 override void OnWork(
float consumed_energy )
62 float battery_capacity = battery.GetCompEM().GetEnergyMax();
64 if ( battery.GetCompEM().GetEnergy() < battery_capacity )
66 float charger_health = GetHealth(
"",
"");
70 if (FeatureTimeAccel.GetFeatureTimeAccelEnabled(ETimeAccelCategories.ENERGY_RECHARGE))
72 float timeAccel = FeatureTimeAccel.GetFeatureTimeAccelValue();
73 energy_add *= timeAccel;
77 if ( GetCompEM().ConsumeEnergy(energy_add) )
80 energy_add = energy_add * ( 0.5 + charger_health*0.005 );
88 battery.GetCompEM().AddEnergy( energy_add );
92 battery.GetCompEM().SetEnergy( battery_capacity );
122 if (GetCompEM().IsWorking())
193 if( !super.CanPutInCargo(parent) ) {
return false;}
195 if ( !GetCompEM().IsPlugged() && !GetCompEM().GetPluggedDevice() )
205 if( !super.CanPutIntoHands( parent ) )
210 if ( !GetCompEM().IsPlugged() && !GetCompEM().GetPluggedDevice() )
220 string att_type = device.GetType();
222 if ( att_type ==
"CarBattery" )
228 if ( att_type ==
"TruckBattery" )
246 if ( !super.CanReceiveAttachment(attachment, slotId) )
258 if ( GetCompEM().GetPluggedDevice() )
261 if ( ibase.HasEnergyManager() && ibase.GetCompEM().GetPluggedDevicesCount() >= 1 )
269 if ( !super.CanLoadAttachment(attachment) )
276 if ( GetCompEM().GetPluggedDevice() )
279 if ( ibase.HasEnergyManager() && ibase.GetCompEM().GetPluggedDevicesCount() >= 1 )
290 HideSelection(selection);
349 super.OnInventoryExit(player);
358 super.OnInventoryEnter(player);
367 super.RefreshPhysics();
371 RemoveProxyPhysics(
"battery" );
372 AddProxyPhysics(
"battery" );
375 RemoveProxyPhysics(
"battery" );
384 super.OnPlacementStarted(player);
402 foreach (
string selection : selections)
405 playerPB.GetHologramServer().SetSelectionToRefresh(selection);
407 playerPB.GetHologramLocal().SetSelectionToRefresh(selection);
eBleedingSourceType GetType()
ActionPlaceObjectCB ActiondeployObjectCB ActionPlaceObject()
void AddAction(typename actionName)
Super root of all classes in Enforce script.
override void OnSwitchOn()
override void OnInventoryEnter(Man player)
static const string SEL_CORD_PLUGGED
float m_BlinkingStatusLightInterval
static const string SEL_LIGHT_CHARGING_ON
override void OnWork(float consumed_energy)
override void OnWorkStart()
static const string SEL_SWITCH_OFF
override void OnOwnSocketReleased(EntityAI device)
override void OnOwnSocketTaken(EntityAI device)
static const string SEL_LIGHT_STATE_2
override void OnPlacementStarted(Man player)
override bool CanPutIntoHands(EntityAI parent)
override bool IsElectricAppliance()
override void SetActions()
override bool CanLoadAttachment(EntityAI attachment)
static const string SEL_STANDBY_LIGHT
void UpdateStatusLights()
override void OnWorkStop()
int m_BatteryEnergy0To100
static const string SEL_CLIPS_TRUCK
void HideAttachedClipsStates()
ref Timer m_UpdateStatusLightsTimer
float m_ChargeEnergyPerSecond
static const string SEL_LIGHT_STATE_1
const string ATTACHED_CLIPS_STATES[]
static const string SEL_SWITCH_ON
override void RefreshPhysics()
bool m_BlinkingStatusLightIsOn
override void OnSwitchOff()
static const string SEL_LIGHT_STATE_3
const int ATTACHED_CLIPS_STATES_COUNT
static const string SEL_SWITCH_LIGHT_ON
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
static const string SEL_CLIPS_DETACHED
static const string SEL_CORD_FOLDED
override void OnInventoryExit(Man player)
static const string SEL_CLIPS_FOLDED
static const string SEL_CLIPS_CAR
override bool IsDeployable()
static const string SEL_LIGHT_CHARGED_ON
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.