Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
actiondropitem.c
Go to the documentation of this file.
2{
3 override void CreateActionComponent()
4 {
5 super.CreateActionComponent();
7 }
8
9 override void EndActionComponent()
10 {
11 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
12 m_ActionData.m_State = UA_FINISHED;
13 }
14
16 {
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
65 {
66 return false;
67 }
68
69 override bool HasTarget()
70 {
71 return false;
72 }
73
74 override bool UseAcknowledgment()
75 {
76 return false;
77 }
78
79 override bool ActionConditionContinue(ActionData action_data)
80 {
81 return true;
82 }
83
84 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
85 {
86 if (!player || !item)
87 return false;
88
89 HumanInputController hic = player.GetInputController();
90 HumanCommandMove hcm = player.GetCommand_Move();
91
93 if (hic && (hic.IsStanceChange() || hic.IsThrowingModeChange()))
94 return false;
95
97 if (hcm && (hcm.IsChangingStance() || hcm.IsStandingFromBack()))
98 return false;
99
100 return true;
101 }
102
103 override void OnExecuteServer(ActionData action_data)
104 {
105 if (action_data.m_Player.IsPlacingServer())
106 action_data.m_Player.PlacingCancelServer();
107
108 ClearInventoryReservationEx(action_data);
109
110 if (g_Game.IsServer() && g_Game.IsMultiplayer())
111 {
112 action_data.m_Player.ServerDropEntity(action_data.m_Player.GetItemInHands()); // multiplayer server side
113 }
114 else
115 {
116 PhysicalDropItem(action_data); // single player or multiplayer client side
117 }
118 }
119
120 void PhysicalDropItem(ActionData action_data)
121 {
122 action_data.m_Player.PhysicalPredictiveDropItem(action_data.m_Player.GetItemInHands());
123 }
124}
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 CanBePerformedWhileChangingStance()
Prevent this action from beeing performed while changing stance.
override bool HasTarget()
override GetInputType()
class ActionTargets ActionTarget
void SetCommand(int command_uid)
ActionData m_ActionData
override void CreateActionComponent()
override void EndActionComponent()
proto native bool IsStandingFromBack()
return true if prone on back is chaning to crounch/stand
proto native bool IsChangingStance()
returns true if character is changing stance
proto native bool IsStanceChange()
stance change button was pressed
proto native bool IsThrowingModeChange()
returns true if change of throwing mode has been requested
DayZGame g_Game
Definition dayzgame.c:3942
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
const int UA_FINISHED
Definition constants.c:469
proto native void EnableCancelCondition(bool pEnable)
enables calling cancel condition default is disabled when enabled - there must be a function "bool Ca...