Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
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 override void EndActionComponent()
14 {
16 if (action.UseAlternativeInterrupt(m_ActionData))
17 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_FINISH);
18 else
19 SetCommand(DayZPlayerConstants.CMD_ACTIONINT_END);
20 }
21};
22
24{
26 {
27 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_EMPTY_VESSEL;
28 m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_LOW;
29
31 m_FullBody = false;
32 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
33 m_Text = "#empty";
34 }
35
36 override void CreateConditionComponents()
37 {
40 }
41
42 override bool HasTarget()
43 {
44 return false;
45 }
46
47 override bool HasAlternativeInterrupt()
48 {
49 return true;
50 }
51
52 override bool UseAlternativeInterrupt(ActionData action_data)
53 {
54 return HasAlternativeInterrupt() && (action_data.m_ActionComponent.GetProgress() >= 1);
55 }
56
57 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
58 {
59 if ( GetGame().IsServer() && GetGame().IsMultiplayer() )
60 return true;
61
62 return item.IsLiquidPresent() && item.GetQuantity() > item.GetQuantityMin() && !item.GetIsFrozen();
63 }
64
65 override bool ActionConditionContinue( ActionData action_data )
66 {
67 return true;
68 }
69
70 override void OnStartAnimationLoop( ActionData action_data )
71 {
72 SendRPC(action_data,true);
73 }
74
75 override void OnEndAnimationLoop( ActionData action_data )
76 {
77 SendRPC(action_data,false);
78 }
79
80 override void OnEndServer( ActionData action_data )
81 {
82 SendRPC(action_data,false);
83
84 super.OnEndServer(action_data);
85 }
86
87 protected void SendRPC(ActionData actionData, bool enable)
88 {
89 if ( !GetGame().IsMultiplayer() || GetGame().IsServer() )
90 {
91 ActionEmptyBottleBaseCB comp = ActionEmptyBottleBaseCB.Cast(actionData.m_Callback);
92 if (comp.m_RPCStopAlreadySent)
93 return;
94
95 Bottle_Base target_vessel = Bottle_Base.Cast( actionData.m_MainItem );
96 Param1<bool> play = new Param1<bool>( enable );
97 GetGame().RPCSingleParam( target_vessel, SoundTypeBottle.EMPTYING, play, true );
98 if (!enable)
99 comp.m_RPCStopAlreadySent = true;
100 }
101 }
102};
SoundTypeBottle
Definition bottle_base.c:2
void SetCommand(int command_uid)
ActionData m_ActionData
float m_SpecialtyWeight
Definition actionbase.c:77
int m_StanceMask
Definition actionbase.c:62
string m_Text
Definition actionbase.c:58
ref CCIBase m_ConditionItem
Definition actionbase.c:64
bool m_FullBody
Definition actionbase.c:61
ref CCTBase m_ConditionTarget
Definition actionbase.c:65
void SendRPC(ActionData actionData, bool enable)
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
void SendRPC()
proto native CGame GetGame()