8 static const string START_SOUND =
"powerGeneratorTurnOn_SoundSet";
9 static const string LOOP_SOUND =
"powerGeneratorLoop_SoundSet";
10 static const string STOP_SOUND =
"powerGeneratorTurnOff_SoundSet";
11 static const string SPARKPLUG_ATTACH_SOUND =
"sparkplug_attach_SoundSet";
12 static const string SPARKPLUG_DETACH_SOUND =
"sparkplug_detach_SoundSet";
31 m_FuelPercentage = 50;
32 RegisterNetSyncVariableInt(
"m_FuelPercentage");
33 RegisterNetSyncVariableBool(
"m_IsSoundSynchRemote");
34 RegisterNetSyncVariableBool(
"m_IsPlaceSound");
65 m_FuelPercentage = GetCompEM().GetEnergy0To100();
82 if (GetCompEM().IsWorking())
84 PlaySoundSetLoop(m_EngineLoop, LOOP_SOUND, 0, 0);
87 vector local_pos =
"0.3 0.21 0.4";
88 vector local_ori =
"270 0 0";
98 if (!super.CanPutInCargo(parent))
109 if(!super.CanPutIntoHands(parent))
119 return GetCompEM().GetPluggedDevicesCount() == 0 && !GetCompEM().IsWorking();
142 PlaySoundSet(m_EngineStart, START_SOUND, 0, 0);
145 if (!m_SoundLoopStartTimer)
150 if (!m_SoundLoopStartTimer.IsRunning())
152 m_SoundLoopStartTimer.Run(1.5,
this,
"StartLoopSound", NULL,
false);
163 override void OnWork(
float consumed_energy)
172 m_FuelPercentage = GetCompEM().GetEnergy0To100();
185 PlaySoundSet(m_EngineStop, STOP_SOUND, 0, 0);
186 StopSoundSet(m_EngineLoop);
204 super.OnItemLocationChanged(old_owner, new_owner);
210 super.EEItemAttached(item, slot_name);
211 GetCompEM().InteractBranch(
this);
217 ShowSelection(
"sparkplug_installed");
228 super.EEItemDetached(item, slot_name);
230 GetCompEM().InteractBranch(
this);
234 if (item_IB.IsKindOf(
"Sparkplug"))
236 HideSelection(
"sparkplug_installed");
237 GetCompEM().SwitchOff();
254 SetAnimationPhase(
"dial_fuel", m_FuelPercentage * 0.01);
261 if (m_FuelTankCapacity > 0)
264 GetCompEM().SetEnergy(fuel_amount * m_FuelToEnergyRatio);
265 m_FuelPercentage = GetCompEM().GetEnergy0To100();
271 string error =
string.Format(
"ERROR! Item %1 has fuel tank with 0 capacity! Add parameter 'fuelTankCapacity' to its config and set it to more than 0!", this.
GetType());
280 if (available_fuel == 0)
284 GetCompEM().InteractBranch(
this);
287 if (needed_fuel > available_fuel)
290 return available_fuel;
305 int liquid_type = container.GetLiquidType();
308 if ( container.GetQuantity() > 0 && GetCompEM().
GetEnergy() < GetCompEM().GetEnergyMax() && (liquid_type &
LIQUID_GASOLINE))
333 EntityAI ent = GetInventory().FindAttachment(slot);
335 return ent && !ent.IsRuined();
340 super.OnVariablesSynchronized();
356 super.OnPlacementComplete(player, position, orientation);
363 return "placePowerGenerator_SoundSet";
383 entity.GetInventory().CreateInInventory(
"SparkPlug");
eBleedingSourceType GetType()
void AddAction(typename actionName)
protected ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
override bool IsInitialized()
protected ref UniversalTemperatureSourceSettings m_UTSSettings
protected ref UniversalTemperatureSource m_UTSource
void SetIsPlaceSound(bool is_place_sound)
class JsonUndergroundAreaTriggerData GetPosition
proto native float ConfigGetFloat(string path)
Get float value from config on path.
Super root of all classes in Enforce script.
Wrapper class for managing sound through SEffectManager.
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
protected ref UniversalTemperatureSourceSettings m_UTSSettings
override void OnDebugSpawn()
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
protected EffectSound m_EngineStart
override void OnInitEnergy()
void SetFuel(float fuel_amount)
static private float m_FuelToEnergyRatio
static private float m_FuelTankCapacity
override bool CanPutIntoHands(EntityAI player)
override bool CanPutInCargo(EntityAI parent)
override void OnWorkStop()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void EEItemDetached(EntityAI item, string slot_name)
override string GetPlaceSoundset()
float AddFuel(float available_fuel)
override void OnWork(float consumed_energy)
protected ref UniversalTemperatureSource m_UTSource
DEPRECATED Attached spark plug item.
ref Timer m_SoundLoopStartTimer
bool CanAddFuel(ItemBase container)
private int m_FuelPercentage
override void EOnInit(IEntity other, int extra)
override void OnWorkStart()
override void EEItemAttached(EntityAI item, string slot_name)
protected EffectSound m_EngineStop
override void OnVariablesSynchronized()
protected EffectSound m_EngineLoop
override float GetLiquidThroughputCoef()
protected ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
ref protected Effect m_Smoke
override void SetActions()
Manager class for managing Effect (EffectParticle, EffectSound)
static int PlayOnObject(notnull Effect eff, Object obj, vector local_pos="0 0 0", vector local_ori="0 0 0", bool force_rotation_relative_to_world=false)
Play an Effect.
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
original Timer deletes m_params which is unwanted
float m_TemperatureMax
min temperature you can get from the TemperatureSource
float m_RangeFull
temperature cap that will limit the return value from GetTemperature method
bool m_ManualUpdate
if the Update is running periodically
float m_TemperatureMin
how often the Update is ticking
float m_RangeMax
range where the full temperature is given to receiver
float m_TemperatureCap
max temperature you can get from the TemperatureSource
proto native CGame GetGame()
proto void DPrint(string var)
Prints content of variable to console/log. Should be used for critical messages so it will appear in ...
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
EntityEvent
Entity events for event-mask, or throwing event from code.
const float LIQUID_THROUGHPUT_GENERATOR
const int LIQUID_GASOLINE