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

Go to the source code of this file.

Classes

class  ActionForceConsumeSingleCB
 

Functions

void ActionForceConsumeSingle ()
 
override void CreateConditionComponents ()
 
int GetConsumedQuantity ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnEndServer (ActionData action_data)
 
override void OnExecuteServer (ActionData action_data)
 

Variables

ActionForceConsumeSingleCB DEFAULT_CONSUMED_QUANTITY = 1
 

Function Documentation

◆ ActionCondition()

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

Definition at line 33 of file ActionForceConsumeSingle.c.

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 }

◆ ActionForceConsumeSingle()

void ActionForceConsumeSingle ( )

Definition at line 13 of file ActionForceConsumeSingle.c.

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 }
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
int m_StanceMask
Definition ActionBase.c:53
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References m_FullBody, m_StanceMask, and m_Text.

◆ CreateConditionComponents()

override void CreateConditionComponents ( )

Definition at line 22 of file ActionForceConsumeSingle.c.

23 {
26 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
Definition CCTMan.c:2
const float DEFAULT

References UAMaxDistances::DEFAULT, m_ConditionItem, and m_ConditionTarget.

◆ GetConsumedQuantity()

int GetConsumedQuantity ( )

Definition at line 28 of file ActionForceConsumeSingle.c.

29 {
31 }
ActionForceConsumeSingleCB DEFAULT_CONSUMED_QUANTITY

References DEFAULT_CONSUMED_QUANTITY.

Referenced by OnExecuteServer().

◆ OnEndServer()

override void OnEndServer ( ActionData action_data)

Definition at line 45 of file ActionForceConsumeSingle.c.

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 }
provides access to slot configuration

◆ OnExecuteServer()

override void OnExecuteServer ( ActionData action_data)

Definition at line 58 of file ActionForceConsumeSingle.c.

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 }
int GetConsumedQuantity()
EConsumeType
Definition EConsumeType.c:2

References GetConsumedQuantity().

Variable Documentation

◆ DEFAULT_CONSUMED_QUANTITY

ActionForceConsumeSingleCB DEFAULT_CONSUMED_QUANTITY = 1

Referenced by GetConsumedQuantity().