Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionturnoffpowergenerator.c
Go to the documentation of this file.
2 {
4  {
5  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_INTERACTONCE;
6  m_Text = "#switch_off";
7  }
8 
9  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
10  {
11  Object targetObject = target.GetObject();
12  ItemBase target_IB = ItemBase.Cast( targetObject );
13 
14  if ( target_IB.HasEnergyManager() && target_IB.GetCompEM().CanSwitchOff() )
15  {
16  return true;
17  }
18  else
19  {
20  return false;
21  }
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().SwitchOff();
31  target_IB.GetCompEM().InteractBranch(target_IB);
32  }
33  }
34 };
ItemBase
Definition: inventoryitem.c:730
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
ActionTurnOffPowerGenerator
Definition: actionturnoffpowergenerator.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49