DayZ 1.24
Loading...
Searching...
No Matches
ActionForceConsumeSingle.c
Go to the documentation of this file.
8
9class ActionForceConsumeSingle : ActionSingleUseBase
10{
12
14 {
15 m_CallbackClass = ActionForceConsumeSingleCB;
16 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INJECTIONTARGET;
17 m_StanceMask = DayZPlayerConstants.STANCEIDX_ERECT | DayZPlayerConstants.STANCEIDX_CROUCH;
18 m_FullBody = true;
19 m_Text = "#feed";
20 }
21
27
32
33 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
34 {
35 if (!super.ActionCondition(player, target, item))
36 return false;
37
38 if (item.GetQuantity() <= item.GetQuantityMin())
39 return false;
40
41 PlayerBase targetPlayer = PlayerBase.Cast(target.GetObject());
42 return targetPlayer && targetPlayer.CanEatAndDrink();
43 }
44
46 {
47 if (action_data.m_MainItem && action_data.m_MainItem.GetQuantity() <= 0)
48 action_data.m_MainItem.SetQuantity(0);
49
50 if (action_data.m_Player.HasBloodyHands() && !action_data.m_Player.GetInventory().FindAttachment(InventorySlots.GLOVES))
51 {
52 PlayerBase target = PlayerBase.Cast(action_data.m_Target.GetObject());
53 if (target)
54 target.SetBloodyHandsPenalty();
55 }
56 }
57
59 {
60 PlayerBase target = PlayerBase.Cast(action_data.m_Target.GetObject());
61
62 if (target && action_data.m_MainItem)
63 target.Consume(action_data.m_MainItem, GetConsumedQuantity(), EConsumeType.ITEM_SINGLE_TIME);
64 }
65}
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
void CreateConditionComponents()
Definition ActionBase.c:196
void OnEndServer(ActionData action_data)
Definition ActionBase.c:962
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition ActionBase.c:350
int m_StanceMask
Definition ActionBase.c:53
override void OnExecuteServer(ActionData action_data)
void ActionForceConsumeSingle()
int GetConsumedQuantity()
ActionForceConsumeSingleCB DEFAULT_CONSUMED_QUANTITY
EConsumeType
Definition EConsumeType.c:2
ActionData m_ActionData
ref CABase m_ActionComponent
Definition ActionBase.c:30
Definition CCTMan.c:2
provides access to slot configuration
const float DEFAULT
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597