DayZ 1.24
Loading...
Searching...
No Matches
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());
21 return true;
22
23 // Special case for unfolded spotlight
24 if (selection == Spotlight.SEL_CORD_PLUGGED_U)
25 return true;
26 }
27
28 return false;
29 }
30
32 {
33 ItemBase targetItem = ItemBase.Cast(action_data.m_Target.GetObject());
34 targetItem.GetCompEM().UnplugThis();
35
36 if (targetItem.IsInherited(Spotlight))
37 {
38 targetItem.HideSelection(Spotlight.SEL_CORD_PLUGGED_U);
39 targetItem.ShowSelection(Spotlight.SEL_CORD_FOLDED_U);
40 }
41 }
42};
string m_Text
Definition ActionBase.c:49
override void OnExecuteServer(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
static const string SEL_CORD_PLUGGED