Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionpulloutplug.c
Go to the documentation of this file.
2 {
3  void ActionPullOutPlug()
4  {
5  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_INTERACTONCE;
6 
7  m_Text = "#pull_out_plug";
8  }
9 
10  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
11  {
12  EntityAI targetEntity = EntityAI.Cast(target.GetObject());
13 
14  if (targetEntity.HasEnergyManager())
15  {
16  string selection = targetEntity.GetActionComponentName(target.GetComponentIndex());
17 
18 
19  if (GetGame().IsServer())
20  return targetEntity.GetCompEM().GetPlugOwner(selection) != null;
21  else
22  return targetEntity.GetCompEM().IsSelectionAPlug(selection);
23  }
24 
25  return false;
26  }
27 
28  override void OnExecuteServer(ActionData action_data)
29  {
30  Object targetObject = action_data.m_Target.GetObject();
31  if (targetObject)
32  {
33  EntityAI targetEntity = EntityAI.Cast(targetObject);
34  string selection = targetObject.GetActionComponentName(action_data.m_Target.GetComponentIndex());
35 
36  EntityAI device = EntityAI.Cast(targetEntity.GetCompEM().GetPlugOwner(selection));
37  if (device)
38  device.GetCompEM().UnplugThis();
39 
40  // Disable Advanced Placement
41  if (action_data.m_Player.IsPlacingServer())
42  action_data.m_Player.PlacingCancelServer();
43  }
44  }
45 }
ItemBase
Definition: inventoryitem.c:730
GetGame
proto native CGame GetGame()
ActionPullOutPlug
Definition: actionpulloutplug.c:1
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
EntityAI
Definition: building.c:5