Dayz Explorer 1.28.160049
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 DisplayTargetInActionText()
14 {
15 return true;
16 }
17
18 override string GetTargetName(PlayerBase player, ActionTarget target)
19 {
20 ItemBase targetItem = ItemBase.Cast(target.GetObject());
21 if (targetItem && targetItem.HasEnergyManager())
22 {
23 string selection = targetItem.GetActionComponentName(target.GetComponentIndex());
24
25 if (targetItem.GetCompEM() && targetItem.GetCompEM().GetPlugOwner(selection))
26 return targetItem.GetCompEM().GetPlugOwner(selection).GetDisplayName();
27 }
28
29 return super.GetTargetName(player, target);
30 }
31
32 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
33 {
34 ItemBase targetItem = ItemBase.Cast(target.GetObject());
35
36 if (targetItem && targetItem.HasEnergyManager())
37 {
38 string selection = targetItem.GetActionComponentName(target.GetComponentIndex());
39
41 return true;
42
43 // Special case for unfolded spotlight
44 if (selection == Spotlight.SEL_CORD_PLUGGED_U)
45 return true;
46 }
47
48 return false;
49 }
50
51 override void OnExecuteServer(ActionData action_data)
52 {
53 ItemBase targetItem = ItemBase.Cast(action_data.m_Target.GetObject());
54 targetItem.GetCompEM().UnplugThis();
55
56 if (targetItem.IsInherited(Spotlight))
57 {
58 targetItem.HideSelection(Spotlight.SEL_CORD_PLUGGED_U);
59 targetItem.ShowSelection(Spotlight.SEL_CORD_FOLDED_U);
60 }
61 }
62}
string m_Text
Definition actionbase.c:58
static const string SEL_CORD_PLUGGED