DayZ 1.24
Loading...
Searching...
No Matches
ActionPullOutPlug.c
Go to the documentation of this file.
2{
4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_INTERACTONCE;
6
7 m_Text = "#pull_out_plug";
8 }
9
10 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
11 {
12 EntityAI targetEntity = EntityAI.Cast(target.GetObject());
13
14 if (targetEntity.HasEnergyManager())
15 {
16 string selection = targetEntity.GetActionComponentName(target.GetComponentIndex());
17
18
19 if (GetGame().IsServer())
20 return targetEntity.GetCompEM().GetPlugOwner(selection) != null;
21 else
22 return targetEntity.GetCompEM().IsSelectionAPlug(selection);
23 }
24
25 return false;
26 }
27
29 {
30 Object targetObject = action_data.m_Target.GetObject();
31 if (targetObject)
32 {
34 string selection = targetObject.GetActionComponentName(action_data.m_Target.GetComponentIndex());
35
36 EntityAI device = EntityAI.Cast(targetEntity.GetCompEM().GetPlugOwner(selection));
37 if (device)
38 device.GetCompEM().UnplugThis();
39
40 // Disable Advanced Placement
41 if (action_data.m_Player.IsPlacingServer())
42 action_data.m_Player.PlacingCancelServer();
43 }
44 }
45}
string m_Text
Definition ActionBase.c:49
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void OnExecuteServer(ActionData action_data)
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()