DayZ 1.24
Loading...
Searching...
No Matches
ActionDefibrilateBase.c
Go to the documentation of this file.
2{
3 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
4 {
5 Defibrillator defib;
7
9 }
10
11 bool CanDefibrillate(Defibrillator defib)
12 {
13 if (defib.IsCharged())
14 return true;
15 else
16 return false;
17 }
18
20 {
21 defib.DischargeClient(player);
22 }
23
25 {
26 if (defib.IsCharged())
27 {
28 defib.DischargeServer(player);
29
30
31 float regain_energy = player.GetSoftSkillsManager().SubtractSpecialtyBonus(defib.GetEnergyNeededToCharge(), this.GetSpecialtyWeight());
32 regain_energy = defib.GetEnergyNeededToCharge() - regain_energy;
33
35
36 if (Class.CastTo(battery, defib.GetCompEM().GetEnergySource()))
37 battery.GetCompEM().AddEnergy(regain_energy);
38 else
39 DPrint("ERROR! Defibrillator has no battery! Defibrillator softskill bonus can't be applied!");
40 }
41 player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
42 }
43};
float m_SpecialtyWeight
Definition ActionBase.c:68
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
void DefibrillateClient(PlayerBase player, Defibrillator defib)
void DefibrillateServer(PlayerBase player, Defibrillator defib)
bool CanDefibrillate(Defibrillator defib)
Super root of all classes in Enforce script.
Definition EnScript.c:11
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.