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

Go to the source code of this file.

Classes

class  DetachActionData
 

Functions

void ActionDetach ()
 
override void CreateConditionComponents ()
 
override bool HasProneException ()
 
override GetInputType ()
 
override bool HasProgress ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnExecuteServer (ActionData action_data)
 
override void OnExecuteClient (ActionData action_data)
 
override void CreateAndSetupActionCallback (ActionData action_data)
 

Variables

DetachActionData m_ItemName = ""
 

Function Documentation

◆ ActionCondition()

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

Definition at line 38 of file ActionDetach.c.

39 {
40 ItemBase tgt_item = ItemBase.Cast(target.GetObject());
41 EntityAI tgt_parent = EntityAI.Cast(target.GetParent());
42 EntityAI tgt_entity = EntityAI.Cast(target.GetObject());
43
44 if (!tgt_item || !tgt_entity || !tgt_parent)
45 return false;
46
47 if (!tgt_parent || !tgt_item.IsItemBase() || !tgt_item.IsTakeable() || tgt_item.IsBeingPlaced())
48 return false;
49
50 if (player.GetCommand_Vehicle())
51 return false;
52
53 if (player.GetInventory().CanAddEntityIntoHands(tgt_entity)) //&& !player.GetInventory().CanAddEntityIntoInventory(tgt_entity) )
54 {
55 if (tgt_entity.GetHierarchyRootPlayer() != player)
56 {
57 if (tgt_entity.CanDetachAttachment(tgt_parent) && tgt_parent.CanReleaseAttachment(tgt_entity))
58 return true;
59 }
60 }
61
62 return false;
63 }

◆ ActionDetach()

void ActionDetach ( )

Definition at line 10 of file ActionDetach.c.

11 {
12 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_PICKUP_HANDS;
13 m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HANDS;
14 m_Text = "#take_to_hands";
15 }
string m_Text
Definition ActionBase.c:49
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References m_Text.

Referenced by ActionConstructor::RegisterActions(), InventoryItemSuper::SetActions(), CarDoor::SetActions(), ItemBase::SetActions(), SetActions(), Edible_Base::SetActions(), EyeMask_ColorBase::SetActions(), Inventory_Base::SetActions(), Roadflare::SetActions(), TripodBase::SetActions(), VehicleBattery::SetActions(), and WoodenStick::SetActions().

◆ CreateAndSetupActionCallback()

override void CreateAndSetupActionCallback ( ActionData action_data)

Definition at line 87 of file ActionDetach.c.

88 {
89 EntityAI target = EntityAI.Cast(action_data.m_Target.GetObject());
91 if (!target)
92 return;
93
94 if (target.IsHeavyBehaviour())
95 Class.CastTo(callback, action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HEAVY, GetCallbackClassTypename(), DayZPlayerConstants.STANCEMASK_ERECT));
96 else
97 {
98 if (action_data.m_Player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT))
99 Class.CastTo(callback, action_data.m_Player.AddCommandModifier_Action(DayZPlayerConstants.CMD_ACTIONMOD_PICKUP_HANDS, GetCallbackClassTypename()));
100 else
101 Class.CastTo(callback, action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HANDS, GetCallbackClassTypename(), DayZPlayerConstants.STANCEMASK_PRONE));
102 }
103 callback.SetActionData(action_data);
104 callback.InitActionComponent();
105 action_data.m_Callback = callback;
106 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo().

◆ CreateConditionComponents()

override void CreateConditionComponents ( )

Definition at line 17 of file ActionDetach.c.

18 {
21 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ GetInputType()

override GetInputType ( )

Definition at line 28 of file ActionDetach.c.

◆ HasProgress()

override bool HasProgress ( )

Definition at line 33 of file ActionDetach.c.

34 {
35 return false;
36 }

◆ HasProneException()

override bool HasProneException ( )

Definition at line 23 of file ActionDetach.c.

24 {
25 return true;
26 }

◆ OnExecuteClient()

override void OnExecuteClient ( ActionData action_data)

Definition at line 78 of file ActionDetach.c.

79 {
80 ActionManagerClient am = ActionManagerClient.Cast(action_data.m_Player.GetActionManager());
81 am.UnlockInventory(action_data);
82
83 EntityAI ntarget = EntityAI.Cast(action_data.m_Target.GetObject());
84 action_data.m_Player.PredictiveTakeEntityToHands(ntarget);
85 }

◆ OnExecuteServer()

override void OnExecuteServer ( ActionData action_data)

Definition at line 65 of file ActionDetach.c.

66 {
67 if (GetGame().IsMultiplayer())
68 return;
69
70 ActionManagerClient am = ActionManagerClient.Cast(action_data.m_Player.GetActionManager());
71 am.UnlockInventory(action_data);
72
73 EntityAI ntarget = EntityAI.Cast(action_data.m_Target.GetObject());
74 action_data.m_Player.PredictiveTakeEntityToHands(ntarget);
75
76 }
proto native CGame GetGame()

References GetGame().

Variable Documentation

◆ m_ItemName