DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionPullOutPlug.c
См. документацию.
2{
4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_INTERACTONCE;
6
7 m_Text = "#pull_out_plug";
8 }
9
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 (GetGame().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}
ActionBase ActionData
Определения ActionBase.c:30
class ActionTargets ActionTarget
string m_Text
Определения ActionBase.c:58
void ActionInteractBase()
Определения ActionInteractBase.c:43
override string GetTargetName(PlayerBase player, ActionTarget target)
Определения ActionPullOutPlug.c:15
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionPullOutPlug.c:29
void ActionPullOutPlug()
Определения ActionPullOutPlug.c:3
override void OnExecuteServer(ActionData action_data)
Определения ActionPullOutPlug.c:46
override bool DisplayTargetInActionText()
Определения ActionPullOutPlug.c:10
int m_CommandUID
Определения AnimatedActionBase.c:143
Определения Building.c:6
Определения InventoryItem.c:731
Определения ObjectTyped.c:2
Определения PlayerBaseClient.c:2
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
proto native CGame GetGame()