DayZ 1.24
Loading...
Searching...
No Matches
ActionPlugIn Class Reference
Inheritance diagram for ActionPlugIn:
[legend]
Collaboration diagram for ActionPlugIn:
[legend]

Private Member Functions

void ActionPlugIn ()
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnExecuteServer (ActionData action_data)
 
void Process (ActionData action_data)
 
override void OnExecuteClient (ActionData action_data)
 
ItemBase GetAttachedDevice (ItemBase parent)
 

Detailed Description

Definition at line 1 of file ActionPlugIn.c.

Constructor & Destructor Documentation

◆ ActionPlugIn()

void ActionPlugIn::ActionPlugIn ( )
inlineprivate

Definition at line 3 of file ActionPlugIn.c.

4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_INTERACTONCE;
6 m_Text = "#plug_in";
7 }
string m_Text
Definition ActionBase.c:49
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References AnimatedActionBase::m_CommandUID, and m_Text.

Member Function Documentation

◆ ActionCondition()

override bool ActionPlugIn::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 15 of file ActionPlugIn.c.

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 }
ItemBase GetAttachedDevice(ItemBase parent)

References GetAttachedDevice().

◆ CreateConditionComponents()

override void ActionPlugIn::CreateConditionComponents ( )
inlineprivate

Definition at line 9 of file ActionPlugIn.c.

10 {
13 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
const float DEFAULT

References UAMaxDistances::DEFAULT, m_ConditionItem, and m_ConditionTarget.

◆ GetAttachedDevice()

ItemBase ActionPlugIn::GetAttachedDevice ( ItemBase parent)
inlineprivate

Definition at line 73 of file ActionPlugIn.c.

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 }

Referenced by ActionCondition(), and OnExecuteServer().

◆ OnExecuteClient()

override void ActionPlugIn::OnExecuteClient ( ActionData action_data)
inlineprivate

Definition at line 65 of file ActionPlugIn.c.

66 {
67 if (!action_data.m_Player.IsPlacingLocal())
68 action_data.m_Player.TogglePlacingLocal();
69 else
71 }
void Process(ActionData action_data)

References Process().

◆ OnExecuteServer()

override void ActionPlugIn::OnExecuteServer ( ActionData action_data)
inlineprivate

Definition at line 37 of file ActionPlugIn.c.

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 }

References GetAttachedDevice(), and Process().

◆ Process()

void ActionPlugIn::Process ( ActionData action_data)
inlineprivate

Definition at line 58 of file ActionPlugIn.c.

59 {
60 ItemBase targetIB = ItemBase.Cast(action_data.m_Target.GetObject());
61
62 targetIB.GetInventory().TakeEntityAsAttachment(InventoryMode.LOCAL, action_data.m_MainItem);
63 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22

Referenced by OnExecuteClient(), and OnExecuteServer().


The documentation for this class was generated from the following file: