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

Private Member Functions

void ActionAttachWithSwitch ()
 
override void CreateConditionComponents ()
 
override GetInputType ()
 
override bool CanBePerformedFromInventory ()
 
override ActionData CreateActionData ()
 
override bool SetupAction (PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnExecuteServer (ActionData action_data)
 
override void OnExecuteClient (ActionData action_data)
 

Detailed Description

Definition at line 1 of file ActionAttachWithSwich.c.

Constructor & Destructor Documentation

◆ ActionAttachWithSwitch()

void ActionAttachWithSwitch::ActionAttachWithSwitch ( )
inlineprivate

Definition at line 3 of file ActionAttachWithSwich.c.

4 {
5 }

Member Function Documentation

◆ ActionCondition()

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

Definition at line 60 of file ActionAttachWithSwich.c.

61 {
62 EntityAI target_entity = EntityAI.Cast(target.GetObject());
63 if (!item.CanSwitchDuringAttach(target_entity))
64 return false;
65
66 if (target_entity && item)
67 {
68 if (target_entity.GetInventory() && target_entity.GetInventory().CanAddAttachment(item))
69 return true;
70 }
71 return false;
72 }

◆ CanBePerformedFromInventory()

override bool ActionAttachWithSwitch::CanBePerformedFromInventory ( )
inlineprivate

Definition at line 20 of file ActionAttachWithSwich.c.

21 {
22 return true;
23 }

◆ CreateActionData()

override ActionData ActionAttachWithSwitch::CreateActionData ( )
inlineprivate

Definition at line 25 of file ActionAttachWithSwich.c.

◆ CreateConditionComponents()

override void ActionAttachWithSwitch::CreateConditionComponents ( )
inlineprivate

Definition at line 7 of file ActionAttachWithSwich.c.

8 {
11 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_ATTACHITEM;
12 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
13 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
const float DEFAULT
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References UAMaxDistances::DEFAULT, m_ConditionItem, m_ConditionTarget, and m_StanceMask.

◆ GetInputType()

override ActionAttachWithSwitch::GetInputType ( )
inlineprivate

Definition at line 15 of file ActionAttachWithSwich.c.

◆ OnExecuteClient()

override void ActionAttachWithSwitch::OnExecuteClient ( ActionData action_data)
inlineprivate

Definition at line 96 of file ActionAttachWithSwich.c.

97 {
100
102
103 if (action_data.m_Target.IsProxy())
104 target_EAI = EntityAI.Cast(action_data_a.m_Target.GetParent());
105 else
106 target_EAI = EntityAI.Cast(action_data_a.m_Target.GetObject());
107
108 if (target_EAI && action_data_a.m_MainItem)
109 {
111 il.SetAttachment(target_EAI, action_data.m_MainItem, action_data_a.m_AttSlot);
112 action_data.m_Player.PredictiveForceSwapEntities(target_EAI, action_data.m_MainItem, il);
113 }
114 }
void ClearInventoryReservationEx(ActionData action_data)
Definition ActionBase.c:790
InventoryLocation.

References ClearInventoryReservationEx().

◆ OnExecuteServer()

override void ActionAttachWithSwitch::OnExecuteServer ( ActionData action_data)
inlineprivate

Definition at line 74 of file ActionAttachWithSwich.c.

75 {
76 if (GetGame().IsMultiplayer())
77 return;
78
82
83 if (action_data.m_Target.IsProxy())
84 target_EAI = EntityAI.Cast(action_data_a.m_Target.GetParent());
85 else
86 target_EAI = EntityAI.Cast(action_data_a.m_Target.GetObject());
87
88 if (target_EAI && action_data_a.m_MainItem)
89 {
91 il.SetAttachment(target_EAI, action_data.m_MainItem, action_data_a.m_AttSlot);
92 action_data.m_Player.PredictiveForceSwapEntities(target_EAI, action_data.m_MainItem, il);
93 }
94 }
proto native CGame GetGame()

References ClearInventoryReservationEx(), and GetGame().

◆ SetupAction()

override bool ActionAttachWithSwitch::SetupAction ( PlayerBase player,
ActionTarget target,
ItemBase item,
out ActionData action_data,
Param extra_data = NULL )
inlineprivate

Definition at line 31 of file ActionAttachWithSwich.c.

32 {
34 if (!GetGame().IsDedicatedServer())
35 {
37
38 if (target.IsProxy())
39 target_entity = EntityAI.Cast(target.GetParent());
40 else
41 target_entity = EntityAI.Cast(target.GetObject());
42
43 if (!target_entity.GetInventory().FindFreeLocationFor(item, FindInventoryLocationType.ATTACHMENT, il))
44 return false;
45 }
46
47 if (super.SetupAction(player, target, item, action_data, extra_data))
48 {
49 if (!GetGame().IsDedicatedServer())
50 {
52 action_data_a.m_AttSlot = il.GetSlot();
53 }
54 return true;
55 }
56 return false;
57 }
FindInventoryLocationType
flags for searching locations in inventory

References GetGame().


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