DayZ 1.24
Loading...
Searching...
No Matches
ActionAttach.c File Reference

Go to the source code of this file.

Classes

class  AttachActionData
 

Functions

AttachActionData ActionData ActionAttach ()
 
override void CreateConditionComponents ()
 
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)
 
void AttachItem (AttachActionData action_data)
 
override bool CanBeSetFromInventory ()
 

Variables

int m_AttSlot
 

Function Documentation

◆ ActionAttach()

AttachActionData ActionData ActionAttach ( )

Definition at line 1 of file ActionAttach.c.

10 {
11 m_Text = "#attach";
12 }
string m_Text
Definition ActionBase.c:49

◆ ActionCondition()

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

Definition at line 57 of file ActionAttach.c.

58 {
59 EntityAI targetEntity = EntityAI.Cast(target.GetObject());
60 if (targetEntity && item)
61 return targetEntity.GetInventory() && targetEntity.GetInventory().CanAddAttachment(item) && !targetEntity.CanUseConstruction());
62
63 return false;
64 }

◆ AttachItem()

void AttachItem ( AttachActionData action_data)
protected

Definition at line 84 of file ActionAttach.c.

85 {
87 if (action_data.m_Target.IsProxy())
88 entity = EntityAI.Cast(action_data.m_Target.GetParent());
89 else
90 entity = EntityAI.Cast(action_data.m_Target.GetObject());
91
92 if (entity && action_data.m_MainItem)
93 action_data.m_Player.PredictiveTakeEntityToTargetAttachmentEx(entity, action_data.m_MainItem, action_data.m_AttSlot);
94 }

◆ CanBeSetFromInventory()

override bool CanBeSetFromInventory ( )
protected

Definition at line 96 of file ActionAttach.c.

97 {
98 return false;
99 }

◆ CreateActionData()

override ActionData CreateActionData ( )

Definition at line 22 of file ActionAttach.c.

◆ CreateConditionComponents()

override void CreateConditionComponents ( )

Definition at line 14 of file ActionAttach.c.

15 {
18 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_ATTACHITEM;
19 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
20 }
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.

◆ OnExecuteClient()

override void OnExecuteClient ( ActionData action_data)

Definition at line 76 of file ActionAttach.c.

77 {
79
82 }
void AttachItem(AttachActionData action_data)
void ClearInventoryReservationEx(ActionData action_data)
Definition ActionBase.c:790

References AttachItem(), and ClearInventoryReservationEx().

◆ OnExecuteServer()

override void OnExecuteServer ( ActionData action_data)

Definition at line 66 of file ActionAttach.c.

67 {
68 if (GetGame().IsMultiplayer())
69 return;
70
74 }
proto native CGame GetGame()

References AttachItem(), ClearInventoryReservationEx(), and GetGame().

◆ SetupAction()

override bool SetupAction ( PlayerBase player,
ActionTarget target,
ItemBase item,
out ActionData action_data,
Param extra_data = null )

Definition at line 28 of file ActionAttach.c.

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

References GetGame().

Variable Documentation

◆ m_AttSlot

int m_AttSlot

Definition at line 10 of file ActionAttach.c.