DayZ 1.24
Loading...
Searching...
No Matches
ActionPlugIn.c
Go to the documentation of this file.
2{
4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_INTERACTONCE;
6 m_Text = "#plug_in";
7 }
8
14
15 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
16 {
17 if (player.IsPlacingLocal())
18 return false;
19
20 ItemBase targetIB = ItemBase.Cast(target.GetObject());
21
22 //Prevent plugging to items in inventory
23 if (targetIB && targetIB.GetHierarchyRoot() == targetIB && item)
24 {
25 if (item.HasEnergyManager() && !item.GetCompEM().IsPlugged() && targetIB.HasEnergyManager() && targetIB.GetCompEM().CanReceivePlugFrom(item))
26 return true;
27
29 //Will only ever affect batteries
31 return attachedDevice.GetCompEM().HasFreeSocket();
32 }
33
34 return false;
35 }
36
38 {
39 ItemBase targetIB = ItemBase.Cast(action_data.m_Target.GetObject());
40
41 if (targetIB.HasEnergyManager())
42 {
46
47 action_data.m_MainItem.GetCompEM().PlugThisInto(targetIB);
48
49 if (!action_data.m_Player.IsPlacingServer())
50 {
51 action_data.m_Player.PlacingStartServer(action_data.m_MainItem);
52
54 }
55 }
56 }
57
59 {
60 ItemBase targetIB = ItemBase.Cast(action_data.m_Target.GetObject());
61
62 targetIB.GetInventory().TakeEntityAsAttachment(InventoryMode.LOCAL, action_data.m_MainItem);
63 }
64
66 {
67 if (!action_data.m_Player.IsPlacingLocal())
68 action_data.m_Player.TogglePlacingLocal();
69 else
71 }
72
74 {
75 if (parent.IsInherited(CarBattery) || parent.IsInherited(TruckBattery))
76 {
77 ItemBase parentAttachment = ItemBase.Cast(parent.GetAttachmentByType(MetalWire));
79 parentAttachment = ItemBase.Cast(parent.GetAttachmentByType(BarbedWire));
80
81 return parentAttachment;
82 }
83
84 return null;
85 }
86};
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
ItemBase GetAttachedDevice(ItemBase parent)
override void OnExecuteServer(ActionData action_data)
override void OnExecuteClient(ActionData action_data)
override void CreateConditionComponents()
Definition ActionPlugIn.c:9
void ActionPlugIn()
Definition ActionPlugIn.c:3
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
void Process(ActionData action_data)
const float DEFAULT
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597