DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
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 Object targetObject = target.GetObject();
16 ItemBase target_IB = ItemBase.Cast( targetObject );
17
18 if ( target_IB && target_IB.HasEnergyManager() )
19 {
20 string selection = targetObject.GetActionComponentName(target.GetComponentIndex());
22 {
23 return true;
24 }
25
26 // Special case for unfolded spotlight
27 if ( selection == Spotlight.SEL_CORD_PLUGGED_U )
28 {
29 return true;
30 }
31 }
32
33 return false;
34 }
35
36 override void OnExecuteServer( ActionData action_data )
37 {
38 ItemBase target_IB = ItemBase.Cast( action_data.m_Target.GetObject() ); // cast to ItemBase
39 target_IB.GetCompEM().UnplugThis();
40
41 if ( target_IB.IsInherited(Spotlight) )
42 {
43 target_IB.HideSelection ( Spotlight.SEL_CORD_PLUGGED_U );
44 target_IB.ShowSelection ( Spotlight.SEL_CORD_FOLDED_U );
45 }
46 }
47};
protected string m_Text
Definition ActionBase.c:49
class ActionTargets ActionTarget
ref ActionTarget m_Target
Definition ActionBase.c:32
override void OnExecuteServer(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
static const string SEL_CORD_PLUGGED