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

Private Member Functions

void ActionPlugTargetIntoThis ()
 
override void CreateConditionComponents ()
 
override bool Can (PlayerBase player, ActionTarget target, ItemBase item)
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override bool IsDeploymentAction ()
 
override void OnExecuteServer (ActionData action_data)
 
override void OnExecuteClient (ActionData action_data)
 
void Process (ActionData action_data)
 

Private Attributes

bool m_Retoggle
 

Detailed Description

Definition at line 1 of file ActionPlugTargetIntoThis.c.

Constructor & Destructor Documentation

◆ ActionPlugTargetIntoThis()

void ActionPlugTargetIntoThis::ActionPlugTargetIntoThis ( )
inlineprivate

Definition at line 5 of file ActionPlugTargetIntoThis.c.

6 {
7 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_INTERACTONCE;
8 m_Retoggle = false;
9 m_Text = "#connect_together";
10 }
string m_Text
Definition ActionBase.c:49
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References AnimatedActionBase::m_CommandUID, m_Retoggle, and m_Text.

Member Function Documentation

◆ ActionCondition()

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

Definition at line 45 of file ActionPlugTargetIntoThis.c.

46 {
47 ItemBase targetIB = ItemBase.Cast(target.GetObject());
48
49 //Prevent plugging to items in inventory
50 if (targetIB && targetIB.GetHierarchyRoot() == targetIB && item && targetIB.HasEnergyManager() && item.HasEnergyManager())
51 {
52 if (!targetIB.GetCompEM().IsPlugged() && item.GetCompEM().CanReceivePlugFrom(targetIB))
53 {
54 //hotfix, re-work entire action!
55 return targetIB.IsElectricAppliance();
56 }
57
58 // Special case for vehicle batteries
59 if (item.IsInherited(VehicleBattery))
60 {
61 MetalWire metalWire = MetalWire.Cast(item.GetCompEM().GetPluggedDevice());
62
63 if (metalWire && metalWire.GetCompEM().CanReceivePlugFrom(targetIB))
64 {
65 return true; // We can power the action_data.m_Target from vehicle battery because it has metal wire attached.
66 }
67 }
68 }
69
70 return false;
71 }

◆ Can()

override bool ActionPlugTargetIntoThis::Can ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 18 of file ActionPlugTargetIntoThis.c.

19 {
20 if (super.Can(player, target, item))
21 {
22 if (player.IsPlacingLocal())
23 {
24 m_Retoggle = true;
25
26 player.GetHologramLocal().SetIsHidden(true);
27 player.GetHologramLocal().GetProjectionEntity().HideAllSelections();
28 }
29 }
30
31 if (!super.Can(player, target, item))
32 {
33 if (m_Retoggle)
34 {
35 m_Retoggle = false;
36
37 player.GetHologramLocal().SetIsHidden(false);
38 player.GetHologramLocal().GetProjectionEntity().ShowAllSelections();
39 }
40 }
41
42 return super.Can(player, target, item);
43 }

References m_Retoggle.

◆ CreateConditionComponents()

override void ActionPlugTargetIntoThis::CreateConditionComponents ( )
inlineprivate

Definition at line 12 of file ActionPlugTargetIntoThis.c.

13 {
16 }
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.

◆ IsDeploymentAction()

override bool ActionPlugTargetIntoThis::IsDeploymentAction ( )
inlineprivate

Definition at line 73 of file ActionPlugTargetIntoThis.c.

74 {
75 return true;
76 }

◆ OnExecuteClient()

override void ActionPlugTargetIntoThis::OnExecuteClient ( ActionData action_data)
inlineprivate

Definition at line 83 of file ActionPlugTargetIntoThis.c.

84 {
85 m_Retoggle = false;
86 }

References m_Retoggle.

◆ OnExecuteServer()

override void ActionPlugTargetIntoThis::OnExecuteServer ( ActionData action_data)
inlineprivate

Definition at line 78 of file ActionPlugTargetIntoThis.c.

79 {
81 }
void Process(ActionData action_data)

References Process().

◆ Process()

void ActionPlugTargetIntoThis::Process ( ActionData action_data)
inlineprivate

Definition at line 88 of file ActionPlugTargetIntoThis.c.

89 {
90 ItemBase targetIB = ItemBase.Cast(action_data.m_Target.GetObject());
91
92 if (action_data.m_MainItem.IsInherited(VehicleBattery))
93 {
94 // Car/truck batteries can have a metal wire attached through which they can power common electric appliances
95 MetalWire metalWire = MetalWire.Cast(action_data.m_MainItem.GetCompEM().GetPluggedDevice());
96 if (metalWire)
97 targetIB.GetCompEM().PlugThisInto(metalWire);
98 }
99 else
100 {
101 // Everything else in general
102 targetIB.GetCompEM().PlugThisInto(action_data.m_MainItem);
103 }
104
105 Spotlight spotlight;
106 if (Spotlight.CastTo(spotlight, targetIB))
107 spotlight.Unfold();
108
109 targetIB.GetInventory().TakeEntityAsAttachment(InventoryMode.LOCAL, action_data.m_MainItem);
110 action_data.m_Player.ServerDropEntity(action_data.m_MainItem);
111 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22

Referenced by OnExecuteServer().

Member Data Documentation

◆ m_Retoggle

bool ActionPlugTargetIntoThis::m_Retoggle
private

Definition at line 3 of file ActionPlugTargetIntoThis.c.

Referenced by ActionPlugTargetIntoThis(), Can(), and OnExecuteClient().


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