DayZ 1.24
Loading...
Searching...
No Matches
Bottle_Base.c
Go to the documentation of this file.
2{
3 POURING = 1,
5}
6
7class Bottle_Base extends Edible_Base
8{
9 //Particles
12 //Boiling
13 //waiting for proper particle effects
17 //Baking
20 //Drying
23 //Burning
25
26 //Sounds
29
30 //cooking data
32 protected bool m_CookingIsDone;
33 protected bool m_CookingIsEmpty;
34 protected bool m_CookingIsBurned;
35
36 //Boiling
37 const string SOUND_BOILING_EMPTY = "Boiling_SoundSet";
38 const string SOUND_BOILING_START = "Boiling_SoundSet";
39 const string SOUND_BOILING_DONE = "Boiling_Done_SoundSet";
40 const string SOUND_DRYING_START = "Drying_SoundSet";
41 const string SOUND_DRYING_DONE = "Drying_Done_SoundSet";
42
44 private const float QUANTITY_EMPTIED_PER_SEC_DEFAULT = 200; //default
45
47 {
48 RegisterNetSyncVariableInt("m_CookingMethod", CookingMethodType.NONE, CookingMethodType.COUNT);
49 RegisterNetSyncVariableBool("m_CookingIsDone");
50 RegisterNetSyncVariableBool("m_CookingIsEmpty");
51 RegisterNetSyncVariableBool("m_CookingIsBurned");
52
54 }
55
61
62 override void EEDelete(EntityAI parent)
63 {
64 super.EEDelete(parent);
65
66 //remove audio visuals
68 }
69
70 override void EECargoIn(EntityAI item)
71 {
72 super.EECargoIn(item);
73
74 MiscGameplayFunctions.SoakItemInsideParentContainingLiquidAboveThreshold(ItemBase.Cast(item), this);
75 }
76
77 //================================================================
78 // PARTICLES & SOUNDS
79 //================================================================
80 //Refreshes the audio and partcile effects on cooking pot
81 //is_done - is the food baked, boiled, dried?
82 //is_empty - is cooking quipment (cargo) empty?
83 //is_burned - is any of the food items in the cargo in burned food stage?
84 override void Synchronize()
85 {
86 SetSynchDirty();
87 }
88
90 {
91 super.OnRPC(sender, rpc_type, ctx);
92
93 Param1<bool> p = new Param1<bool>(false);
94
95 if (!ctx.Read(p))
96 return;
97
98 bool play = p.param1;
99 switch (rpc_type)
100 {
101 case SoundTypeBottle.POURING:
102 if (play)
104 else
106
107 break;
108
109 case SoundTypeBottle.EMPTYING:
110 if (play)
112 else
114
115 break;
116 }
117 }
118
120 {
121 super.OnVariablesSynchronized();
122
125 else
127 }
128
135
145
147 {
148 string soundName;
149 int particleId;
150
151 //if at least one of the food items is burned
152 if (is_burned)
153 {
156 }
157 //proper cooking methods
158 else
159 {
160 switch (cooking_method)
161 {
162 case CookingMethodType.BOILING:
163 if (is_empty)
164 {
167 }
168 else
169 {
170 if (is_done)
171 {
174 }
175 else
176 {
179 }
180 }
181
182 break;
183
184 case CookingMethodType.BAKING:
185 if (is_done)
186 {
189 }
190 else
191 {
194 }
195
196 break;
197
198 case CookingMethodType.DRYING:
199 if (is_done)
200 {
203 }
204 else
205 {
208 }
209
210 break;
211
212 default:
213 soundName = "";
215
216 break;
217 }
218 }
219
220 //play effects
223 }
224
230
231 //particles
233 {
234#ifndef SERVER
236 {
237 //stop previous particles
239
240 //create new
241 vector localPos = MiscGameplayFunctions.GetSteamPosition(GetHierarchyParent());
242 m_ParticleCooking = ParticleManager.GetInstance().PlayInWorld(particle_id, localPos);
244
245 }
246#endif
247 }
248
250 {
251 if (m_ParticleCooking && GetGame() && !GetGame().IsDedicatedServer())
252 {
253 m_ParticleCooking.Stop();
256 }
257 }
258
264
270
276
285
287 {
288 vector pos = GetPosition();
289 string surfaceType = GetGame().GetPlayer().GetSurfaceType();
290 string soundSet = "";
291
292 bool diggable = GetGame().IsSurfaceDigable(surfaceType);
293
294 if (!diggable)
296 else if (diggable)
298 else if (GetGame().SurfaceIsPond(pos[0], pos[2]) || GetGame().SurfaceIsSea(pos[0], pos[2]))
300
301 return soundSet;
302 }
303
305 {
306 vector pos = GetPosition();
307 string surfaceType = GetGame().GetPlayer().GetSurfaceType();
308 string soundSet = "";
309
310 bool diggable = GetGame().IsSurfaceDigable(surfaceType);
311
312 if (!diggable)
314 else if (diggable)
316 else if (GetGame().SurfaceIsPond(pos[0], pos[2]) || GetGame().SurfaceIsSea(pos[0], pos[2]))
318
319 return soundSet;
320 }
321
329
332 {
333 return m_LiquidEmptyRate;
334 }
335
354
355 override void OnDebugSpawn()
356 {
358 }
359}
ActionExtinguishFireplaceByLiquidCB ActionContinuousBaseCB ActionExtinguishFireplaceByLiquid()
void AddAction(typename actionName)
override void OnVariablesSynchronized()
override void EECargoIn(EntityAI item)
Definition Bottle_Base.c:70
int PARTICLE_BAKING_DONE
Definition Bottle_Base.c:19
SoundTypeBottle
Definition Bottle_Base.c:2
@ POURING
Definition Bottle_Base.c:3
@ EMPTYING
Definition Bottle_Base.c:4
EffectSound m_PouringLoopSound
Definition Bottle_Base.c:27
void StopEmptyingLoopSound()
void StopPouringLoopSound()
float m_LiquidEmptyRate
Definition Bottle_Base.c:43
int PARTICLE_DRYING_DONE
Definition Bottle_Base.c:22
bool m_CookingIsBurned
Definition Bottle_Base.c:34
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
bool m_CookingIsEmpty
Definition Bottle_Base.c:33
int PARTICLE_BOILING_DONE
Definition Bottle_Base.c:16
string GetEmptyingEndSoundset()
EffectSound m_EmptyingLoopSound
Definition Bottle_Base.c:28
int PARTICLE_DRYING_START
Definition Bottle_Base.c:21
void RemoveAudioVisuals()
int PARTICLE_BAKING_START
Definition Bottle_Base.c:18
const float QUANTITY_EMPTIED_PER_SEC_DEFAULT
Definition Bottle_Base.c:44
void ParticleCookingStart(int particle_id)
void PlayEmptyingLoopSound()
void RefreshAudioVisuals(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
int PARTICLE_BURNING_DONE
Definition Bottle_Base.c:24
void RemoveAudioVisualsOnClient()
string GetEmptyingLoopSoundset()
const string SOUND_DRYING_START
Definition Bottle_Base.c:40
bool m_CookingIsDone
Definition Bottle_Base.c:32
CookingMethodType m_CookingMethod
Definition Bottle_Base.c:31
void ~Bottle_Base()
Definition Bottle_Base.c:56
int PARTICLE_BOILING_EMPTY
Definition Bottle_Base.c:14
void Bottle_Base()
Definition Bottle_Base.c:46
float GetLiquidEmptyRate()
Returns base liquid empty rate (absolute)..preferrably use the 'GetLiquidThroughputCoef' instead.
const string SOUND_DRYING_DONE
Definition Bottle_Base.c:41
const string SOUND_BOILING_DONE
Definition Bottle_Base.c:39
const string SOUND_BOILING_START
Definition Bottle_Base.c:38
enum SoundTypeBottle m_ParticleCooking
int m_ParticlePlaying
Definition Bottle_Base.c:11
void ParticleCookingStop()
void PlayPouringLoopSound()
int PARTICLE_BOILING_START
Definition Bottle_Base.c:15
const string SOUND_BOILING_EMPTY
Definition Bottle_Base.c:37
void Synchronize()
override void EEDelete(EntityAI parent)
CookingMethodType
Definition Cooking.c:2
void OnRPC(ParamsReadContext ctx)
const string SOUND_BURNING_DONE
void SoundCookingStop()
const string SOUND_BAKING_DONE
void SoundCookingStart(string sound_name)
const string SOUND_BAKING_START
class Hatchback_02_Blue extends Hatchback_02 OnDebugSpawn
void SetQuantityMax()
Definition ItemBase.c:7905
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
int particle_id
class JsonUndergroundAreaTriggerData GetPosition
override string GetEmptyingEndSoundsetWater()
override void SetActions()
Definition Cauldron.c:104
override string GetEmptyingLoopSoundsetWater()
override string GetEmptyingLoopSoundsetHard()
override string GetEmptyingEndSoundsetSoft()
override string GetEmptyingLoopSoundsetSoft()
override string GetEmptyingEndSoundsetHard()
override string GetPouringSoundset()
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
void SoundStop()
Stops sound.
Legacy way of using particles in the game.
Definition Particle.c:7
static const int COOKING_DRYING_DONE
static const int COOKING_BOILING_DONE
static const int NONE
static const int COOKING_BOILING_EMPTY
static const int INVALID
static const int COOKING_DRYING_START
static const int COOKING_BOILING_START
static const int COOKING_BAKING_START
static const int COOKING_BURNING_DONE
static const int COOKING_BAKING_DONE
The class that will be instanced (moddable)
Definition gameplay.c:376
Manager class for managing Effect (EffectParticle, EffectSound)
static EffectSound PlaySoundOnObject(string sound_set, Object parent_object, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto native CGame GetGame()