Dayz Explorer 1.29.162510
Loading...
Searching...
No Matches
actiondropitem.c
Go to the documentation of this file.
2{
3 override void CreateActionComponent()
4 {
5 super.CreateActionComponent();
6 EnableCancelCondition(true);
7 }
8
9 override void EndActionComponent()
10 {
11 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
12 m_ActionData.m_State = UA_FINISHED;
13 }
14
15 bool CancelCondition()
16 {
17 HumanMovementState ms = new HumanMovementState();
18 m_ActionData.m_Player.GetMovementState(ms);
19 if (ms.m_CommandTypeId == DayZPlayerConstants.COMMANDID_MOVE)
20 {
21 // Cancel action, if hands are raised
22 if (ms.IsRaised())
23 return true;
24 }
25
26 return false;
27 }
28}
29
31{
32 string m_ItemName = "";
33
35 {
36 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_DROPITEM_HANDS;
37 m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_DROPITEM_HANDS;
38 m_CallbackClass = ActionDropItemCB;
39 m_Text = "#drop_item";
40 }
41
43 {
44 m_ConditionItem = new CCINone();
45 m_ConditionTarget = new CCTNone();
46 }
47
48 override typename GetInputType()
49 {
50 return DropActionInput;
51 }
52
53 override bool HasProneException()
54 {
55 return true;
56 }
57
58 override bool CanBeUsedThrowing()
59 {
60 return true;
61 }
62
63 override bool HasTarget()
64 {
65 return false;
66 }
67
68 override bool UseAcknowledgment()
69 {
70 return false;
71 }
72
73 override bool ActionConditionContinue(ActionData action_data)
74 {
75 return true;
76 }
77
78 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
79 {
80 HumanCommandMove hcm = player.GetCommand_Move();
81 if (hcm && hcm.IsChangingStance())
82 return false;
83
84 return player && item;
85 }
86
87 override void OnExecuteServer(ActionData action_data)
88 {
89 if (action_data.m_Player.IsPlacingServer())
90 action_data.m_Player.PlacingCancelServer();
91
92 ClearInventoryReservationEx(action_data);
93
94 if (g_Game.IsServer() && g_Game.IsMultiplayer())
95 {
96 action_data.m_Player.ServerDropEntity(action_data.m_Player.GetItemInHands()); // multiplayer server side
97 }
98 else
99 {
100 PhysicalDropItem(action_data); // single player or multiplayer client side
101 }
102 }
103
104 void PhysicalDropItem(ActionData action_data)
105 {
106 action_data.m_Player.PhysicalPredictiveDropItem(action_data.m_Player.GetItemInHands());
107 }
108}
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override bool ActionConditionContinue(ActionData action_data)
int m_CommandUIDProne
Definition actionbase.c:32
int m_CommandUID
Definition actionbase.c:31
ActionBase ActionData
Definition actionbase.c:30
DetachActionData m_ItemName
override bool HasProneException()
override void OnExecuteServer(ActionData action_data)
void PhysicalDropItem(ActionData action_data)
void ActionDropItem()
override bool CanBeUsedThrowing()
override bool UseAcknowledgment()
override bool HasTarget()
override GetInputType()
void CreateActionComponent()
void SetCommand(int command_uid)
ActionData m_ActionData
DayZGame g_Game
Definition dayzgame.c:3942
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
const int UA_FINISHED
Definition constants.c:469