DayZ 1.24
Loading...
Searching...
No Matches
ActionTransferLiquid.c
Go to the documentation of this file.
1class TransferLiquidActionReciveData : ActionReciveData
2{
4}
5
7{
9};
10
23
25{
33
39
40 override bool HasProneException()
41 {
42 return true;
43 }
44
45 override string GetText()
46 {
48 if (player.GetLiquidTendencyDrain())
49 return "#drain_liquid";
50 else
51 return "#pour_liquid";
52 }
53
54 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
55 {
56 ItemBase target_item = ItemBase.Cast(target.GetObject());
57
58 if (target_item && item)
59 {
62
63 if (can_drain && can_pour)
64 return true;
65 else if (!can_pour && can_drain)
66 {
67 if ((!GetGame().IsDedicatedServer()) && !player.GetLiquidTendencyDrain())
68 {
69 player.SetLiquidTendencyDrain(true);
70 return false;
71 }
72 else
73 return true;
74 }
75 else if (!can_drain && can_pour)
76 {
77 if ((!GetGame().IsDedicatedServer()) && player.GetLiquidTendencyDrain())
78 {
79 player.SetLiquidTendencyDrain(false);
80 return false;
81 }
82 else
83 return true;
84 }
85 }
86 return false;
87 }
88
90 {
91 TransferLiquidActionData.Cast(action_data).m_Tendency = action_data.m_Player.GetLiquidTendencyDrain();
92 }
93
95 {
96 if (!GetGame().IsMultiplayer())
97 TransferLiquidActionData.Cast(action_data).m_Tendency = action_data.m_Player.GetLiquidTendencyDrain();
98 }
99
101 {
102 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_SpecialtyWeight);
103 }
104
110
112 {
113 super.WriteToContext(ctx, action_data);
114
115 ctx.Write(action_data.m_Player.GetLiquidTendencyDrain());
116 }
117
119 {
123
124 super.ReadFromContext(ctx, action_recive_data);
125
126 bool tendency_drain;
127 if (!ctx.Read(tendency_drain))
128 return false;
129 recive_data_transfer.m_TendencyRecived = tendency_drain;
130 return true;
131 }
132
140
142 {
143 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
144 {
145 Bottle_Base vessel_in_hands = Bottle_Base.Cast(action_data.m_Target.GetObject());
146 Param1<bool> play = new Param1<bool>(true);
148 {
149 if (TransferLiquidActionData.Cast(action_data).m_Tendency == true)
150 GetGame().RPCSingleParam(vessel_in_hands, SoundTypeBottle.EMPTYING, play, true);
151 else if (!TransferLiquidActionData.Cast(action_data).m_Tendency == false)
152 GetGame().RPCSingleParam(vessel_in_hands, SoundTypeBottle.POURING, play, true);
153 }
154 }
155 }
156
158 {
159 if (!GetGame().IsMultiplayer() || GetGame().IsServer())
160 {
161 Bottle_Base target_vessel = Bottle_Base.Cast(action_data.m_Target.GetObject());
162 Param1<bool> play = new Param1<bool>(false);
163 if (TransferLiquidActionData.Cast(action_data).m_Tendency)
164 GetGame().RPCSingleParam(target_vessel, SoundTypeBottle.EMPTYING, play, true);
165 else
166 GetGame().RPCSingleParam(target_vessel, SoundTypeBottle.POURING, play, true);
167 }
168 }
169};
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
TransferLiquidActionReciveData m_Tendency
SoundTypeBottle
Definition Bottle_Base.c:2
PlayerBase GetPlayer()
ActionData m_ActionData
ref CABase m_ActionComponent
Definition ActionBase.c:30
override void CreateActionComponent()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
override void OnFinishProgressServer(ActionData action_data)
override void OnStartAnimationLoop(ActionData action_data)
override void CreateConditionComponents()
override void OnEndAnimationLoop(ActionData action_data)
override void OnStartServer(ActionData action_data)
override bool HasProneException()
override string GetText()
override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
override void OnStartClient(ActionData action_data)
override ActionData CreateActionData()
override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
Definition Liquid.c:2
static bool CanTransfer(ItemBase source_ent, ItemBase target_ent)
Definition Liquid.c:79
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
const float DEFAULT
const float DRAIN_LIQUID
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()