3 static const string CHARGING_SOUND =
"defibrillator_charge_SoundSet";
4 static const string CHARGED_AND_READY_SOUND =
"defibrillator_ready_SoundSet";
5 static const string SHOCK_SOUND =
"defibrillator_shock_SoundSet";
7 bool m_IsCharged =
false;
9 static float m_ChargeTime = 5;
10 static float m_EnergyNeededToCharge = 20;
12 ref Timer m_ChargingTimer;
13 EffectSound m_ChargedAlarm;
14 EffectSound m_ChargingSound;
20 m_EnergyNeededToCharge = GetEnergyNeededToCharge();
25 SEffectManager.DestroyEffect(m_ChargedAlarm);
26 SEffectManager.DestroyEffect(m_ChargingSound);
29 float GetTimeNeededToCharge()
31 string cfg_path =
"CfgVehicles " +
GetType() +
" ";
32 return g_Game.ConfigGetFloat (cfg_path +
"defibChargeTime");
35 float GetEnergyNeededToCharge()
37 string cfg_path =
"CfgVehicles " +
GetType() +
" ";
38 return g_Game.ConfigGetFloat (cfg_path +
"defibEnergyNeededPerCharge");
43 if ( !
g_Game.IsDedicatedServer() )
44 m_ChargingSound = SEffectManager.PlaySoundOnObject(CHARGING_SOUND,
this, 0, 0.15);
46 float energy_needed = m_EnergyNeededToCharge / m_ChargeTime;
47 GetCompEM().SetEnergyUsage(energy_needed);
52 if ( !m_ChargingTimer.IsRunning() )
54 m_ChargingTimer.Run(m_ChargeTime,
this,
"OnIsCharged", NULL,
false);
60 GetCompEM().SwitchOff();
61 GetCompEM().ResetEnergyUsage();
71 if ( GetCompEM().IsWorking() )
76 m_ChargedAlarm = SEffectManager.PlaySoundOnObject(CHARGED_AND_READY_SOUND,
this);
79 GetCompEM().ResetEnergyUsage();
84 void StopChargedAlarm()
90 m_ChargedAlarm = NULL;
94 void StopChargingSound()
102 void StopChargingTimer()
106 m_ChargingTimer.Stop();
107 m_ChargingTimer = NULL;
116 void DischargeServer(PlayerBase victim)
136 victim.SetPulseType(!victim.GetPulseType());
137 victim.SetHealth(
"",
"Shock",0);
139 GetCompEM().SwitchOff();
142 void DischargeClient(PlayerBase victim)
144 SEffectManager.PlaySoundOnObject(SHOCK_SOUND,
this);
eBleedingSourceType GetType()
void AddAction(typename actionName)
void SoundStop()
Stops sound.
override void OnWorkStart()
override void SetActions()
override void OnWorkStop()