Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionturnoffspotlight.c
Go to the documentation of this file.
2 {
4  {
5  m_Text = "#switch_off";
6  }
7 
8  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
9  {
10  Object targetObject = target.GetObject();
11  string selection = targetObject.GetActionComponentName(target.GetComponentIndex());
12  ItemBase target_IB = ItemBase.Cast( target.GetObject() );
13 
14  if ( selection == Spotlight.SEL_REFLECTOR_COMP_U && target_IB.HasEnergyManager() && target_IB.GetCompEM().CanSwitchOff() )
15  {
16  return true;
17  }
18 
19  return false;
20  }
21 
22  override void OnExecuteServer( ActionData action_data )
23  {
24  Object targetObject = action_data.m_Target.GetObject();
25  if ( targetObject )
26  {
27  EntityAI target_EAI = EntityAI.Cast( targetObject );
28  target_EAI.GetCompEM().SwitchOff();
29  }
30  }
31 };
ItemBase
Definition: inventoryitem.c:730
ActionTurnOffSpotlight
Definition: actionturnoffspotlight.c:1
ActionInteractBase
Definition: actioninteractbase.c:54
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
Object
Definition: objecttyped.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49
EntityAI
Definition: building.c:5