DayZ 1.24
Loading...
Searching...
No Matches
ActionDefibrilateBase Class Reference
Inheritance diagram for ActionDefibrilateBase:
[legend]
Collaboration diagram for ActionDefibrilateBase:
[legend]

Private Member Functions

override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
bool CanDefibrillate (Defibrillator defib)
 
void DefibrillateClient (PlayerBase player, Defibrillator defib)
 
void DefibrillateServer (PlayerBase player, Defibrillator defib)
 
- Private Member Functions inherited from ActionContinuousBase
void OnStartAnimationLoopServer (ActionData action_data)
 
void OnStartAnimationLoopClient (ActionData action_data)
 
void OnEndAnimationLoopServer (ActionData action_data)
 
void OnEndAnimationLoopClient (ActionData action_data)
 
void OnFinishProgressServer (ActionData action_data)
 
void OnFinishProgressClient (ActionData action_data)
 

Detailed Description

Definition at line 1 of file ActionDefibrilateBase.c.

Member Function Documentation

◆ ActionCondition()

override bool ActionDefibrilateBase::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 3 of file ActionDefibrilateBase.c.

4 {
5 Defibrillator defib;
7
9 }
bool CanDefibrillate(Defibrillator defib)
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References CanDefibrillate(), and Class::CastTo().

◆ CanDefibrillate()

bool ActionDefibrilateBase::CanDefibrillate ( Defibrillator defib)
inlineprivate

Definition at line 11 of file ActionDefibrilateBase.c.

12 {
13 if (defib.IsCharged())
14 return true;
15 else
16 return false;
17 }

Referenced by ActionCondition().

◆ DefibrillateClient()

void ActionDefibrilateBase::DefibrillateClient ( PlayerBase player,
Defibrillator defib )
inlineprivate

◆ DefibrillateServer()

void ActionDefibrilateBase::DefibrillateServer ( PlayerBase player,
Defibrillator defib )
inlineprivate

Definition at line 24 of file ActionDefibrilateBase.c.

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 }
float m_SpecialtyWeight
Definition ActionBase.c:68
proto void DPrint(string var)
Prints content of variable to console/log. Should be used for critical messages so it will appear in ...

References Class::CastTo(), DPrint(), and m_SpecialtyWeight.

Referenced by ActionDefibrilateSelf::OnFinishProgressServer(), and ActionDefibrilateTarget::OnFinishProgressServer().


The documentation for this class was generated from the following file: