Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionemptybottlebase.c
Go to the documentation of this file.
2 {
3  bool m_RPCStopAlreadySent;//since stopping contains a sound tail, we need to stop it only once, this bool ensures that
4  override void CreateActionComponent()
5  {
6  float EmptiedQuantity;
7  Bottle_Base bottle = Bottle_Base.Cast(m_ActionData.m_MainItem);
8  if (bottle)
9  EmptiedQuantity = bottle.GetLiquidEmptyRate() * bottle.GetLiquidThroughputCoef();
10  m_ActionData.m_ActionComponent = new CAContinuousEmpty(EmptiedQuantity);
11  }
12 };
13 
15 {
17  {
18  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_EMPTY_VESSEL;
20 
21  m_CallbackClass = ActionEmptyBottleBaseCB;
22  m_FullBody = false;
23  m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
24  m_Text = "#empty";
25  }
26 
27  override void CreateConditionComponents()
28  {
31  }
32 
33  override bool HasTarget()
34  {
35  return false;
36  }
37 
38  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
39  {
40  if ( GetGame().IsServer() && GetGame().IsMultiplayer() )
41  return true;
42 
43  if (item.IsLiquidPresent())
44  {
45  return true;
46  }
47  return false;
48  }
49 
50  override bool ActionConditionContinue( ActionData action_data )
51  {
52  if (action_data.m_MainItem.GetQuantity() > action_data.m_MainItem.GetQuantityMin())
53  {
54  return true;
55  }
56  return false;
57  }
58 
59  override void OnStartAnimationLoop( ActionData action_data )
60  {
61  SendRPC(action_data,true);
62  }
63 
64  override void OnEndAnimationLoop( ActionData action_data )
65  {
66  SendRPC(action_data,false);
67  }
68 
69  override void OnEndServer( ActionData action_data )
70  {
71  SendRPC(action_data,false);
72  }
73 
74  protected void SendRPC(ActionData actionData, bool enable)
75  {
76  if ( !GetGame().IsMultiplayer() || GetGame().IsServer() )
77  {
78  ActionEmptyBottleBaseCB comp = ActionEmptyBottleBaseCB.Cast(actionData.m_Callback);
79  if (comp.m_RPCStopAlreadySent)
80  return;
81 
82  Bottle_Base target_vessel = Bottle_Base.Cast( actionData.m_MainItem );
83  Param1<bool> play = new Param1<bool>( enable );
84  GetGame().RPCSingleParam( target_vessel, SoundTypeBottle.EMPTYING, play, true );
85  if (!enable)
86  comp.m_RPCStopAlreadySent = true;
87  }
88  }
89 };
ItemBase
Definition: inventoryitem.c:730
GetGame
proto native CGame GetGame()
UASoftSkillsWeight
Definition: actionconstants.c:118
CCTNone
Definition: cctnone.c:1
Bottle_Base
Definition: canistergasoline.c:1
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
ActionEmptyBottleBaseCB
Definition: actionemptybottlebase.c:1
CAContinuousEmpty
Definition: cacontinuousempty.c:1
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
CCINotRuinedAndEmpty
Definition: ccinotruinedandempty.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49
SoundTypeBottle
SoundTypeBottle
Definition: bottle_base.c:1
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionContinuousBase
Definition: actioncontinuousbase.c:132
ActionEmptyBottleBase
Definition: actionemptybottlebase.c:14
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53