DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Bottle_Base.c
См. документацию.
2{
3 POURING = 1,
4 EMPTYING = 0,
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
40 private const float QUANTITY_EMPTIED_PER_SEC_DEFAULT = 200; //default
41
43 {
44 RegisterNetSyncVariableInt("m_CookingMethod", CookingMethodType.NONE, CookingMethodType.COUNT);
45 RegisterNetSyncVariableBool("m_CookingIsDone");
46 RegisterNetSyncVariableBool("m_CookingIsEmpty");
47 RegisterNetSyncVariableBool("m_CookingIsBurned");
48
50 }
51
57
58 override void EEDelete( EntityAI parent )
59 {
60 super.EEDelete( parent );
61
62 //remove audio visuals
64 }
65
66 override void EECargoIn(EntityAI item)
67 {
68 super.EECargoIn(item);
69
70 MiscGameplayFunctions.SoakItemInsideParentContainingLiquidAboveThreshold(ItemBase.Cast(item), this);
71 }
72
74 {
75 super.OnFreezeStateChangeServer();
76
77 //soak CARGO items on unfreeze
78 CargoBase cargo;
79 if (!GetIsFrozen() && GetLiquidType() != 0 && Class.CastTo(cargo,GetInventory().GetCargo()))
80 {
81 int count = cargo.GetItemCount();
82 for (int i = 0; i < count; ++i)
83 {
84 MiscGameplayFunctions.SoakItemInsideParentContainingLiquidAboveThreshold(ItemBase.Cast(cargo.GetItem(i)), this);
85 }
86 }
87 }
88
90 {
93 }
94
95 //================================================================
96 // PARTICLES & SOUNDS
97 //================================================================
98 //Refreshes the audio and partcile effects on cooking pot
99 //is_done - is the food baked, boiled, dried?
100 //is_empty - is cooking quipment (cargo) empty?
101 //is_burned - is any of the food items in the cargo in burned food stage?
102 override void Synchronize()
103 {
104 SetSynchDirty();
105 }
106
107 override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
108 {
109 super.OnRPC(sender, rpc_type, ctx);
110
111 Param1<bool> p = new Param1<bool>(false);
112
113 if (!ctx.Read(p))
114 return;
115
116 bool play = p.param1;
117 switch (rpc_type)
118 {
119 case SoundTypeBottle.POURING:
120 if (play)
122 else
124
125 break;
126
127 case SoundTypeBottle.EMPTYING:
128 if (play)
130 else
132
133 break;
134 }
135 }
136
138 {
139 super.OnVariablesSynchronized();
140
142 {
144 }
145 else
146 {
148 }
149 }
150
152 {
154
155 Synchronize();
156 }
157
158 override void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned )
159 {
160 m_CookingMethod = cooking_method;
161 m_CookingIsDone = is_done;
162 m_CookingIsEmpty = is_empty;
163 m_CookingIsBurned = is_burned;
164
165 Synchronize();
166 }
167
169 void RefreshAudioVisuals(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
170 {
171 string soundName = "";
172 int particleId;
173
174 switch (cooking_method)
175 {
176 case CookingMethodType.BOILING:
177 soundName = SOUND_BOILING_EMPTY;
178
179 if (is_empty)
180 {
181 particleId = PARTICLE_BOILING_EMPTY;
182 }
183 else
184 {
185 if (is_done)
186 particleId = PARTICLE_BOILING_DONE;
187 else
188 particleId = PARTICLE_BOILING_START;
189 }
190
191 break;
192
193 case CookingMethodType.BAKING:
194 if (is_done)
195 particleId = PARTICLE_BAKING_DONE;
196 else
197 particleId = PARTICLE_BAKING_START;
198
199 break;
200
201 case CookingMethodType.DRYING:
202 if (is_done)
203 particleId = PARTICLE_DRYING_DONE;
204 else
205 particleId = PARTICLE_DRYING_START;
206
207 break;
208
209 default:
210 soundName = "";
211 particleId = ParticleList.NONE;
212
213 break;
214 }
215
216 //if at least one of the food items is burned
217 if (is_burned)
218 {
219 particleId = PARTICLE_BURNING_DONE;
220 }
221
222 //play effects
223 ParticleCookingStart(particleId);
224 SoundCookingStart(soundName);
225 }
226
232
233 //particles
235 {
236 #ifndef SERVER
238 {
239 //stop previous particles
241
242 //create new
243 vector localPos = MiscGameplayFunctions.GetSteamPosition(GetHierarchyParent());
244 m_ParticleCooking = ParticleManager.GetInstance().PlayInWorld(particle_id, localPos);
246
247 }
248 #endif
249 }
250
252 {
253 if (m_ParticleCooking && GetGame() && !GetGame().IsDedicatedServer())
254 {
255 m_ParticleCooking.Stop();
256 m_ParticleCooking = null;
258 }
259 }
260
262 {
263 if (!m_PouringLoopSound || !m_PouringLoopSound.IsSoundPlaying())
264 {
266 }
267 }
268
270 {
272 m_PouringLoopSound.SoundStop();
273 }
274
276 {
277 if (!m_EmptyingLoopSound || !m_EmptyingLoopSound.IsSoundPlaying())
278 {
280 }
281 }
282
284 {
286 m_EmptyingLoopSound.SoundStop();
287
289 sound.SetAutodestroy(true);
290 }
291
293 {
294 vector pos = GetPosition();
295 string surfaceType = GetGame().GetPlayer().GetSurfaceType();
296 string soundSet = "";
297
298 bool diggable = GetGame().IsSurfaceDigable(surfaceType);
299
300 if (!diggable)
301 {
302 soundSet = GetEmptyingLoopSoundsetHard();
303 }
304 else if (diggable)
305 {
306 soundSet = GetEmptyingLoopSoundsetSoft();
307 }
308 else if (GetGame().SurfaceIsPond(pos[0], pos[2]) || GetGame().SurfaceIsSea(pos[0], pos[2]))
309 {
310 soundSet = GetEmptyingLoopSoundsetWater();
311 }
312
313 return soundSet;
314 }
315
317 {
318 vector pos = GetPosition();
319 string surfaceType = GetGame().GetPlayer().GetSurfaceType();
320 string soundSet = "";
321
322 bool diggable = GetGame().IsSurfaceDigable(surfaceType);
323
324 if (!diggable)
325 {
326 soundSet = GetEmptyingEndSoundsetHard();
327 }
328 else if (diggable)
329 {
330 soundSet = GetEmptyingEndSoundsetSoft();
331 }
332 else if (GetGame().SurfaceIsPond(pos[0], pos[2]) || GetGame().SurfaceIsSea(pos[0], pos[2]))
333 {
334 soundSet = GetEmptyingEndSoundsetWater();
335 }
336
337 return soundSet;
338 }
339
347
350 {
351 return m_LiquidEmptyRate;
352 }
353
373
374 override void OnDebugSpawn()
375 {
377 }
378}
ActionExtinguishFireplaceByLiquidCB ActionContinuousBaseCB ActionExtinguishFireplaceByLiquid()
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void SetActions()
Определения AdvancedCommunication.c:213
override void OnVariablesSynchronized()
Определения AnniversaryMusicSource.c:42
override void OnFreezeStateChangeServer()
Определения Bottle_Base.c:73
override void EECargoIn(EntityAI item)
Определения Bottle_Base.c:66
int PARTICLE_BAKING_DONE
Определения Bottle_Base.c:19
SoundTypeBottle
Определения Bottle_Base.c:2
@ POURING
Определения Bottle_Base.c:3
@ EMPTYING
Определения Bottle_Base.c:4
EffectSound m_PouringLoopSound
Определения Bottle_Base.c:27
void StopEmptyingLoopSound()
Определения Bottle_Base.c:283
void StopPouringLoopSound()
Определения Bottle_Base.c:269
float m_LiquidEmptyRate
Определения Bottle_Base.c:39
int PARTICLE_DRYING_DONE
Определения Bottle_Base.c:22
bool m_CookingIsBurned
Определения Bottle_Base.c:34
bool m_CookingIsEmpty
Определения Bottle_Base.c:33
int PARTICLE_BOILING_DONE
Определения Bottle_Base.c:16
string GetEmptyingEndSoundset()
Определения Bottle_Base.c:316
EffectSound m_EmptyingLoopSound
Определения Bottle_Base.c:28
int PARTICLE_DRYING_START
Определения Bottle_Base.c:21
void RemoveAudioVisuals()
Определения Bottle_Base.c:227
int PARTICLE_BAKING_START
Определения Bottle_Base.c:18
const float QUANTITY_EMPTIED_PER_SEC_DEFAULT
Определения Bottle_Base.c:40
void ParticleCookingStart(int particle_id)
Определения Bottle_Base.c:234
void PlayEmptyingLoopSound()
Определения Bottle_Base.c:275
void RefreshAudioVisuals(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
Remnants of old, responsible for particles and some (empty) sounds. Cooked items take care of the res...
Определения Bottle_Base.c:169
int PARTICLE_BURNING_DONE
Определения Bottle_Base.c:24
string GetEmptyingLoopSoundset()
Определения Bottle_Base.c:292
bool m_CookingIsDone
Определения Bottle_Base.c:32
CookingMethodType m_CookingMethod
Определения Bottle_Base.c:31
void ~Bottle_Base()
Определения Bottle_Base.c:52
int PARTICLE_BOILING_EMPTY
Определения Bottle_Base.c:14
void Bottle_Base()
Определения Bottle_Base.c:42
float GetLiquidEmptyRate()
Returns base liquid empty rate (absolute)..preferrably use the 'GetLiquidThroughputCoef' instead.
Определения Bottle_Base.c:349
enum SoundTypeBottle m_ParticleCooking
int m_ParticlePlaying
Определения Bottle_Base.c:11
void ParticleCookingStop()
Определения Bottle_Base.c:251
void PlayPouringLoopSound()
Определения Bottle_Base.c:261
int PARTICLE_BOILING_START
Определения Bottle_Base.c:15
const string SOUND_BOILING_EMPTY
Определения Bottle_Base.c:37
void Synchronize()
Определения CombinationLock.c:151
override void EEDelete(EntityAI parent)
Определения ContaminatedArea.c:57
CookingMethodType
Определения Cooking.c:2
EConsumptionPenaltyContext
Определения EConsumptionPenaltyContext.c:2
void SoundCookingStop()
Определения Edible_Base.c:1825
void SoundCookingStart(string sound_name)
Определения Edible_Base.c:1812
int GetConsumptionPenaltyContext()
Определения Edible_Base.c:1799
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
Определения Bottle_Base.c:158
void SetQuantityMax()
Определения ItemBase.c:8065
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
override int GetLiquidType()
Определения ItemBase.c:8547
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
override void OnRPC(ParamsReadContext ctx)
Определения PlayerStatBase.c:69
int particle_id
Определения SmokeSimulation.c:28
Определения ActionDrink.c:10
Определения ActionFillFuel.c:12
override string GetEmptyingEndSoundsetWater()
Определения Canteen.c:43
override void OnDebugSpawn()
Определения WaterBottle.c:75
override string GetEmptyingLoopSoundsetWater()
Определения Canteen.c:28
override string GetEmptyingLoopSoundsetHard()
Определения Canteen.c:18
override string GetEmptyingEndSoundsetSoft()
Определения Canteen.c:38
override string GetEmptyingLoopSoundsetSoft()
Определения Canteen.c:23
override string GetEmptyingEndSoundsetHard()
Определения Canteen.c:33
override string GetPouringSoundset()
Определения Canteen.c:13
Определения Canteen.c:2
bool IsSurfaceDigable(string surface)
Checks if the surface is digable.
Определения Game.c:1156
proto native DayZPlayer GetPlayer()
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
represents base for cargo storage for entities
Определения Cargo.c:7
Super root of all classes in Enforce script.
Определения EnScript.c:11
string GetSurfaceType(SurfaceAnimationBone limbType)
Определения DayZPlayerImplement.c:3137
Определения Edible_Base.c:2
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
Wrapper class for managing sound through SEffectManager.
Определения EffectSound.c:5
Определения Building.c:6
Определения InventoryItem.c:731
Legacy way of using particles in the game.
Определения Particle.c:7
static const int COOKING_DRYING_DONE
Определения ParticleList.c:68
static const int COOKING_BOILING_DONE
Определения ParticleList.c:64
static const int NONE
Определения ParticleList.c:21
static const int COOKING_BOILING_EMPTY
Определения ParticleList.c:62
static const int INVALID
Определения ParticleList.c:20
static const int COOKING_DRYING_START
Определения ParticleList.c:67
static const int COOKING_BOILING_START
Определения ParticleList.c:63
static const int COOKING_BAKING_START
Определения ParticleList.c:65
static const int COOKING_BURNING_DONE
Определения ParticleList.c:69
static const int COOKING_BAKING_DONE
Определения ParticleList.c:66
Определения ParticleList.c:12
The class that will be instanced (moddable)
Определения gameplay.c:389
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.
Определения EffectManager.c:247
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
Определения EffectManager.c:271
Manager class for managing Effect (EffectParticle, EffectSound)
Определения EffectManager.c:6
proto bool Read(void value_in)
Определения EnConvert.c:106
Serializer ParamsReadContext
Определения gameplay.c:15
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9