Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionturnonpowergenerator.c
Go to the documentation of this file.
2 {
4  {
5  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_INTERACTONCE;
6  m_Text = "#switch_on";
7  }
8 
9  override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
10  {
11  PowerGeneratorBase pg = PowerGeneratorBase.Cast(target.GetObject());
12 
13  if (pg)
14  {
15  if (pg.HasEnergyManager() && pg.GetCompEM().CanSwitchOn() && pg.HasSparkplug() && pg.GetCompEM().CanWork())
16  {
17  return true;
18  }
19  }
20 
21  return false;
22  }
23 
24  override void OnExecuteServer(ActionData action_data)
25  {
26  Object targetObject = action_data.m_Target.GetObject();
27  if (targetObject)
28  {
29  ItemBase target_IB = ItemBase.Cast(targetObject);
30  target_IB.GetCompEM().SwitchOn();
31  target_IB.GetCompEM().InteractBranch(target_IB);
32  }
33  }
34 };
ItemBase
Definition: inventoryitem.c:730
ActionTurnOnPowerGenerator
Definition: actionturnonpowergenerator.c:1
PowerGeneratorBase
PumpkinHelmet PowerGeneratorBase
ActionInteractBase
Definition: actioninteractbase.c:54
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
Object
Definition: objecttyped.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49