Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionunplugthisbycord.c
Go to the documentation of this file.
2 {
4  {
5  m_Text = "#unplug_by_cord";
6  }
7 
8  override bool HasProgress()
9  {
10  return false;
11  }
12 
13  override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
14  {
15  ItemBase targetItem = ItemBase.Cast(target.GetObject());
16 
17  if (targetItem && targetItem.HasEnergyManager())
18  {
19  string selection = targetItem.GetActionComponentName(target.GetComponentIndex());
20  if (selection == ComponentEnergyManager.SEL_CORD_PLUGGED)
21  {
22  return true;
23  }
24 
25  // Special case for unfolded spotlight
26  if (selection == Spotlight.SEL_CORD_PLUGGED_U)
27  {
28  return true;
29  }
30  }
31 
32  return false;
33  }
34 
35  override void OnExecuteServer(ActionData action_data)
36  {
37  ItemBase targetItem = ItemBase.Cast(action_data.m_Target.GetObject());
38  targetItem.GetCompEM().UnplugThis();
39 
40  if (targetItem.IsInherited(Spotlight))
41  {
42  targetItem.HideSelection(Spotlight.SEL_CORD_PLUGGED_U);
43  targetItem.ShowSelection(Spotlight.SEL_CORD_FOLDED_U);
44  }
45  }
46 };
ItemBase
Definition: inventoryitem.c:730
ComponentEnergyManager
Definition: componentenergymanager.c:18
ActionInteractBase
Definition: actioninteractbase.c:54
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
ActionUnplugThisByCord
Definition: actionunplugthisbycord.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49