DayZ 1.24
Loading...
Searching...
No Matches
FryingPan.c
Go to the documentation of this file.
1class 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
12
18
19 // Sounds
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
65 {
66 if (!super.CanReceiveItemIntoCargo(item))
67 return false;
68
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
92 {
93 if (!super.CanLoadItemIntoCargo(item))
94 return false;
95
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
120 AddAction(ActionAttach);
122 }
123
124 override void EEDelete(EntityAI parent)
125 {
126 super.EEDelete(parent);
127
128 //remove audio visuals
130 }
131
133 {
134 if (GetGame() && GetGame().IsServer())
135 SetSynchDirty();
136 }
137
139 {
140 super.OnVariablesSynchronized();
141
142 //refresh audio visuals
145 else
147 }
148
155
165
167 {
168 int particleId;
169
170 //if at least one of the food items is burned
171 if (is_burned)
173 //proper cooking methods
174 else
175 {
176 if (cooking_method == CookingMethodType.BAKING)
177 {
178 if (is_done)
180 else
182 }
183 else if (cooking_method == CookingMethodType.DRYING)
184 {
185 if (is_done)
187 else
189 }
190 }
191
193 }
194
196 {
198 }
199
201 {
203 {
204 //stop previous particles
206
207 //create new
208 if (GetGame() && (!GetGame().IsDedicatedServer()))
209 {
210 vector local_pos = MiscGameplayFunctions.GetSteamPosition(GetHierarchyParent());
211 //TODO set steam position to pot (proxy) memory point (new hierarchy needed)
212 //m_ParticleCooking = Particle.Create( particle_id, this, local_pos );
213 m_ParticleCooking = ParticleManager.GetInstance().PlayInWorld(particle_id, local_pos);
215 }
216 }
217 }
219 {
220 if (m_ParticleCooking && GetGame() && (!GetGame().IsDedicatedServer()))
221 {
222 m_ParticleCooking.Stop();
225 }
226 }
227
229 protected void SoundCookingStart(string sound_name);
230 protected void SoundCookingStop();
231}
void ActionDetach()
void AddAction(typename actionName)
int PARTICLE_BAKING_DONE
Definition Bottle_Base.c:19
int PARTICLE_DRYING_DONE
Definition Bottle_Base.c:22
bool m_CookingIsBurned
Definition Bottle_Base.c:34
bool m_CookingIsEmpty
Definition Bottle_Base.c:33
int PARTICLE_DRYING_START
Definition Bottle_Base.c:21
int PARTICLE_BAKING_START
Definition Bottle_Base.c:18
int PARTICLE_BURNING_DONE
Definition Bottle_Base.c:24
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
const string SOUND_DRYING_DONE
Definition Bottle_Base.c:41
enum SoundTypeBottle m_ParticleCooking
int m_ParticlePlaying
Definition Bottle_Base.c:11
CookingMethodType
Definition Cooking.c:2
string m_SoundPlaying
const string SOUND_BURNING_DONE
const string SOUND_BAKING_DONE
const string SOUND_BAKING_START
bool IsCargoException4x3(EntityAI item)
Definition ItemBase.c:9270
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
int particle_id
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
SoundOnVehicle m_SoundCooking
Definition FryingPan.c:20
void RemoveAudioVisualsOnClient()
Definition FryingPan.c:149
void SoundCookingStart(string sound_name)
DEPRECATED.
override bool CanPutInCargo(EntityAI parent)
Definition FryingPan.c:49
int PARTICLE_BURNING_DONE
Definition FryingPan.c:17
int PARTICLE_DRYING_START
Definition FryingPan.c:15
void RemoveAudioVisuals()
Definition FryingPan.c:195
override bool IsContainer()
Definition FryingPan.c:39
int PARTICLE_DRYING_DONE
Definition FryingPan.c:16
bool m_CookingIsDone
Definition FryingPan.c:5
EffectSound m_SoundEffectCooking
DEPRECATED.
Definition FryingPan.c:21
override bool CanReceiveItemIntoCargo(EntityAI item)
Definition FryingPan.c:64
void Synchronize()
Definition FryingPan.c:132
override void OnVariablesSynchronized()
Definition FryingPan.c:138
bool m_CookingIsBurned
Definition FryingPan.c:7
void ParticleCookingStart(int particle_id)
Definition FryingPan.c:200
override void EEDelete(EntityAI parent)
Definition FryingPan.c:124
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
Definition FryingPan.c:156
CookingMethodType m_CookingMethod
Definition FryingPan.c:4
override bool CanLoadItemIntoCargo(EntityAI item)
Definition FryingPan.c:91
bool m_CookingIsEmpty
Definition FryingPan.c:6
Particle m_ParticleCooking
Definition FryingPan.c:10
void RefreshAudioVisuals(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
Definition FryingPan.c:166
void ParticleCookingStop()
Definition FryingPan.c:218
override void SetActions()
Definition FryingPan.c:114
int PARTICLE_BAKING_START
Definition FryingPan.c:13
override bool CanHaveTemperature()
Definition FryingPan.c:44
void ~FryingPan()
Definition FryingPan.c:37
void SoundCookingStop()
void FryingPan()
DEPRECATED.
Definition FryingPan.c:30
int PARTICLE_BAKING_DONE
Definition FryingPan.c:14
Legacy way of using particles in the game.
Definition Particle.c:7
static const int COOKING_DRYING_DONE
static const int INVALID
static const int COOKING_DRYING_START
static const int COOKING_BAKING_START
static const int COOKING_BURNING_DONE
static const int COOKING_BAKING_DONE
proto native CGame GetGame()