Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
fryingpan.c
Go to the documentation of this file.
1 class FryingPan extends Inventory_Base
2 {
3  // Cooking data
5  protected bool m_CookingIsDone;
6  protected bool m_CookingIsEmpty;
7  protected bool m_CookingIsBurned;
8 
9  // Particles
10  protected Particle m_ParticleCooking;
11  protected int m_ParticlePlaying = ParticleList.INVALID;
12 
13  protected int PARTICLE_BAKING_START = ParticleList.COOKING_BAKING_START;
14  protected int PARTICLE_BAKING_DONE = ParticleList.COOKING_BAKING_DONE;
15  protected int PARTICLE_DRYING_START = ParticleList.COOKING_DRYING_START;
16  protected int PARTICLE_DRYING_DONE = ParticleList.COOKING_DRYING_DONE;
17  protected int PARTICLE_BURNING_DONE = ParticleList.COOKING_BURNING_DONE;
18 
19  // Sounds
20  protected SoundOnVehicle m_SoundCooking;
22  protected string m_SoundPlaying = "";
23 
24  const string SOUND_BAKING_START = "Baking_SoundSet";
25  const string SOUND_BAKING_DONE = "Baking_Done_SoundSet";
26  const string SOUND_DRYING_START = "Drying_SoundSet";
27  const string SOUND_DRYING_DONE = "Drying_Done_SoundSet";
28  const string SOUND_BURNING_DONE = "Food_Burning_SoundSet";
29 
30  void FryingPan()
31  {
32  RegisterNetSyncVariableInt( "m_CookingMethod", CookingMethodType.NONE, CookingMethodType.COUNT );
33  RegisterNetSyncVariableBool( "m_CookingIsDone" );
34  RegisterNetSyncVariableBool( "m_CookingIsEmpty" );
35  RegisterNetSyncVariableBool( "m_CookingIsBurned" );
36  }
37  void ~FryingPan() {}
38 
39  override bool IsContainer()
40  {
41  return true;
42  }
43 
44  override bool CanHaveTemperature()
45  {
46  return true;
47  }
48 
49  override bool CanPutInCargo( EntityAI parent )
50  {
51  if ( !super.CanPutInCargo( parent ) )
52  return false;
53 
54  if ( parent && IsCargoException4x3( parent ) )
55  return false;
56 
57  //is 'parent' somewhere in cargo?
58  if (parent && parent.GetInventory().IsCargoInHiearchy())
59  return false;
60 
61  return true;
62  }
63 
64  override bool CanReceiveItemIntoCargo( EntityAI item )
65  {
66  if ( !super.CanReceiveItemIntoCargo( item ) )
67  return false;
68 
69  if ( IsCargoException4x3( item ) )
70  return false;
71 
72  //is 'this' somewhere in cargo?
73  if (GetInventory().IsCargoInHiearchy())
74  return false;
75 
76  //can 'this' be attached to the item (->assumed smaller size than item)?
77  int slotId;
78  for (int i = 0; i < GetInventory().GetSlotIdCount(); i++)
79  {
80  slotId = GetInventory().GetSlotId(i);
81  if (item.GetInventory().HasAttachmentSlot(slotId))
82  {
83  //Print("CanReceiveItemIntoCargo | item " + item + " matches in slot name: " + InventorySlots.GetSlotName(slotId) + " of " + this);
84  return false;
85  }
86  }
87 
88  return true;
89  }
90 
91  override bool CanLoadItemIntoCargo( EntityAI item )
92  {
93  if ( !super.CanLoadItemIntoCargo( item ) )
94  return false;
95 
96  if ( IsCargoException4x3( item ) )
97  return false;
98 
99  //can 'this' be attached to the item (->assumed smaller size than item)?
100  int slotId;
101  for (int i = 0; i < GetInventory().GetSlotIdCount(); i++)
102  {
103  slotId = GetInventory().GetSlotId(i);
104  if (item.GetInventory().HasAttachmentSlot(slotId))
105  {
106  //Print("CanLoadItemIntoCargo | item " + item + " matches in slot name: " + InventorySlots.GetSlotName(slotId) + " of " + this);
107  return false;
108  }
109  }
110 
111  return true;
112  }
113 
114  override void SetActions()
115  {
116  super.SetActions();
117 
122  }
123 
124  override void EEDelete( EntityAI parent )
125  {
126  super.EEDelete( parent );
127 
128  //remove audio visuals
130  }
131 
132  void Synchronize()
133  {
134  if ( GetGame() && GetGame().IsServer() )
135  {
136  SetSynchDirty();
137  }
138  }
139 
140  override void OnVariablesSynchronized()
141  {
142  super.OnVariablesSynchronized();
143 
144  //refresh audio visuals
145  if ( m_CookingMethod != CookingMethodType.NONE )
146  {
148  }
149  else
150  {
152  }
153  }
154 
156  {
158 
159  Synchronize();
160  }
161 
162  void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned )
163  {
164  m_CookingMethod = cooking_method;
165  m_CookingIsDone = is_done;
166  m_CookingIsEmpty = is_empty;
167  m_CookingIsBurned = is_burned;
168 
169  Synchronize();
170  }
171 
172  void RefreshAudioVisuals( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned )
173  {
174  int particleId;
175 
176  //if at least one of the food items is burned
177  if (is_burned)
178  {
179  particleId = PARTICLE_BURNING_DONE;
180  }
181  //proper cooking methods
182  else
183  {
184  if (cooking_method == CookingMethodType.BAKING)
185  {
186  if (is_done)
187  particleId = PARTICLE_BAKING_DONE;
188  else
189  particleId = PARTICLE_BAKING_START;
190  }
191  else if (cooking_method == CookingMethodType.DRYING)
192  {
193  if (is_done)
194  particleId = PARTICLE_DRYING_DONE;
195  else
196  particleId = PARTICLE_DRYING_START;
197  }
198  }
199 
200  ParticleCookingStart(particleId);
201  }
202 
203  void RemoveAudioVisuals()
204  {
206  }
207 
209  {
211  {
212  //stop previous particles
214 
215  //create new
216  if ( GetGame() && ( !GetGame().IsDedicatedServer() ) )
217  {
218  vector local_pos = MiscGameplayFunctions.GetSteamPosition( GetHierarchyParent() );
219  //TODO set steam position to pot (proxy) memory point (new hierarchy needed)
220  //m_ParticleCooking = Particle.Create( particle_id, this, local_pos );
221  m_ParticleCooking = ParticleManager.GetInstance().PlayInWorld( particle_id, local_pos );
223  }
224  }
225  }
226  void ParticleCookingStop()
227  {
228  if ( m_ParticleCooking && GetGame() && ( !GetGame().IsDedicatedServer() ) )
229  {
230  m_ParticleCooking.Stop();
231  m_ParticleCooking = NULL;
233  }
234  }
235 
237  protected void SoundCookingStart(string sound_name);
238  protected void SoundCookingStop();
239 }
GetGame
proto native CGame GetGame()
PARTICLE_BAKING_DONE
protected int PARTICLE_BAKING_DONE
Definition: bottle_base.c:19
m_ParticlePlaying
protected int m_ParticlePlaying
Definition: bottle_base.c:11
RemoveAudioVisuals
void RemoveAudioVisuals()
Definition: bottle_base.c:229
m_CookingMethod
protected CookingMethodType m_CookingMethod
Definition: bottle_base.c:31
particle_id
int particle_id
Definition: smokesimulation.c:3
PARTICLE_DRYING_DONE
protected int PARTICLE_DRYING_DONE
Definition: bottle_base.c:22
m_SoundEffectCooking
protected EffectSound m_SoundEffectCooking
DEPRECATED.
Definition: edible_base.c:10
Particle
Legacy way of using particles in the game.
Definition: particle.c:6
PARTICLE_BAKING_START
protected int PARTICLE_BAKING_START
Definition: bottle_base.c:18
SOUND_BAKING_DONE
const string SOUND_BAKING_DONE
Definition: edible_base.c:5
m_CookingIsEmpty
protected bool m_CookingIsEmpty
Definition: bottle_base.c:33
ActionDetach
void ActionDetach()
Definition: actiondetach.c:10
CanHaveTemperature
override bool CanHaveTemperature()
Definition: edible_base.c:539
IsCargoException4x3
bool IsCargoException4x3(EntityAI item)
Definition: itembase.c:4591
CanReceiveItemIntoCargo
override bool CanReceiveItemIntoCargo(EntityAI item)
Definition: container_base.c:72
Synchronize
void Synchronize(eInjuryHandlerLevels level)
Definition: injuryhandler.c:173
RefreshAudioVisualsOnClient
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
Definition: bottle_base.c:140
SOUND_DRYING_DONE
const string SOUND_DRYING_DONE
Definition: bottle_base.c:41
OnVariablesSynchronized
override void OnVariablesSynchronized()
Definition: anniversarymusicsource.c:42
SoundCookingStart
protected void SoundCookingStart(string sound_name)
Definition: edible_base.c:514
m_SoundCooking
protected SoundOnVehicle m_SoundCooking
Definition: edible_base.c:9
EEDelete
override void EEDelete(EntityAI parent)
Definition: contaminatedarea.c:69
ParticleCookingStop
void ParticleCookingStop()
Definition: bottle_base.c:253
EffectSound
Wrapper class for managing sound through SEffectManager.
Definition: effectsound.c:4
ParticleList
Definition: particlelist.c:11
ParticleCookingStart
void ParticleCookingStart(int particle_id)
Definition: bottle_base.c:236
vector
Definition: enconvert.c:105
CanPutInCargo
override bool CanPutInCargo(EntityAI parent)
Definition: explosivesbase.c:247
PARTICLE_DRYING_START
protected int PARTICLE_DRYING_START
Definition: bottle_base.c:21
AddAction
void AddAction(typename actionName)
Definition: advancedcommunication.c:86
SetActions
void SetActions()
Definition: advancedcommunication.c:79
ActionCreateIndoorFireplace
Definition: actioncreateindoorfireplace.c:1
ActionCreateIndoorOven
Definition: actioncreateindooroven.c:1
ActionAttach
ActionAttachWheels ActionAttach
PARTICLE_BURNING_DONE
protected int PARTICLE_BURNING_DONE
Definition: bottle_base.c:24
RemoveAudioVisualsOnClient
void RemoveAudioVisualsOnClient()
Definition: bottle_base.c:133
SOUND_BAKING_START
const string SOUND_BAKING_START
Definition: edible_base.c:4
SoundCookingStop
protected void SoundCookingStop()
Definition: edible_base.c:527
SOUND_BURNING_DONE
const string SOUND_BURNING_DONE
Definition: edible_base.c:6
m_CookingIsBurned
protected bool m_CookingIsBurned
Definition: bottle_base.c:34
m_CookingIsDone
protected bool m_CookingIsDone
Definition: bottle_base.c:32
CookingMethodType
CookingMethodType
Definition: cooking.c:1
Inventory_Base
Definition: barbedbaseballbat.c:1
RefreshAudioVisuals
void RefreshAudioVisuals(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
Definition: bottle_base.c:150
ParticleManager
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Definition: particlemanager.c:84
CanLoadItemIntoCargo
override bool CanLoadItemIntoCargo(EntityAI item)
Definition: container_base.c:80
EntityAI
Definition: building.c:5
m_ParticleCooking
enum SoundTypeBottle m_ParticleCooking
SOUND_DRYING_START
const string SOUND_DRYING_START
Definition: bottle_base.c:40
m_SoundPlaying
protected string m_SoundPlaying
Definition: edible_base.c:11