Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionpulloutplug.c
Go to the documentation of this file.
1
class
ActionPullOutPlug
:
ActionInteractBase
2
{
3
void
ActionPullOutPlug
()
4
{
5
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONMOD_INTERACTONCE;
6
7
m_Text
=
"#pull_out_plug"
;
8
}
9
10
override
bool
DisplayTargetInActionText
()
11
{
12
return
true
;
13
}
14
15
override
string
GetTargetName
(
PlayerBase
player,
ActionTarget
target)
16
{
17
ItemBase
targetItem =
ItemBase
.Cast(target.GetObject());
18
if
(targetItem && targetItem.HasEnergyManager())
19
{
20
string
selection = targetItem.GetActionComponentName(target.GetComponentIndex());
21
22
if
(targetItem.GetCompEM() && targetItem.GetCompEM().GetPlugOwner(selection))
23
return
targetItem.GetCompEM().GetPlugOwner(selection).GetDisplayName();
24
}
25
26
return
super.GetTargetName(player, target);
27
}
28
29
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item)
30
{
31
EntityAI
targetEntity =
EntityAI
.Cast(target.GetObject());
32
33
if
(targetEntity.HasEnergyManager())
34
{
35
string
selection = targetEntity.GetActionComponentName(target.GetComponentIndex());
36
37
if
(
g_Game
.IsServer())
38
return
targetEntity.GetCompEM().GetPlugOwner(selection) != null;
39
else
40
return
targetEntity.GetCompEM().IsSelectionAPlug(selection);
41
}
42
43
return
false
;
44
}
45
46
override
void
OnExecuteServer
(
ActionData
action_data)
47
{
48
Object
targetObject = action_data.m_Target.GetObject();
49
if
(targetObject)
50
{
51
EntityAI
targetEntity =
EntityAI
.Cast(targetObject);
52
string
selection = targetObject.GetActionComponentName(action_data.m_Target.GetComponentIndex());
53
54
EntityAI
device =
EntityAI
.Cast(targetEntity.GetCompEM().GetPlugOwner(selection));
55
if
(device)
56
device.GetCompEM().UnplugThis();
57
58
// Disable Advanced Placement
59
if
(action_data.m_Player.IsPlacingServer())
60
action_data.m_Player.PlacingCancelServer();
61
}
62
}
63
}
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionInteractBase::ActionInteractBase
void ActionInteractBase()
Definition
actioninteractbase.c:43
ActionPullOutPlug::ActionPullOutPlug
void ActionPullOutPlug()
Definition
actionpulloutplug.c:3
ActionPullOutPlug::OnExecuteServer
override void OnExecuteServer(ActionData action_data)
Definition
actionpulloutplug.c:46
ActionPullOutPlug::GetTargetName
override string GetTargetName(PlayerBase player, ActionTarget target)
Definition
actionpulloutplug.c:15
ActionPullOutPlug::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionpulloutplug.c:29
ActionPullOutPlug::DisplayTargetInActionText
override bool DisplayTargetInActionText()
Definition
actionpulloutplug.c:10
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
EntityAI
Definition
inventoryitem.c:2
ItemBase
Definition
inventoryitem.c:742
Object
Definition
objecttyped.c:2
PlayerBase
Definition
playerbaseclient.c:2
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
interact
actionpulloutplug.c
Generated by
1.17.0