1 class PortableGasStove
extends ItemBase
5 protected const string FLAME_BUTANE_ON =
"dz\\gear\\cooking\\data\\flame_butane_ca.paa";
6 protected const string FLAME_BUTANE_OFF =
"";
15 protected const float PARAM_COOKING_TIME_INC_COEF = 0.5;
17 private float m_TimeFactor;
23 const string SOUND_BURNING =
"portablegasstove_burn_SoundSet";
24 const string SOUND_TURN_ON =
"portablegasstove_turn_on_SoundSet";
25 const string SOUND_TURN_OFF =
"portablegasstove_turn_off_SoundSet";
33 protected ref UniversalTemperatureSourceLambdaConstant m_UTSLConst;
77 m_UTSLConst =
new UniversalTemperatureSourceLambdaConstant();
85 super.EEItemAttached(item, slot_name);
94 RefreshFlameVisual(m_EM.IsSwitchedOn(),
true);
101 super.EEItemDetached(item, slot_name);
109 RemoveCookingAudioVisuals();
112 RefreshFlameVisual(m_EM.IsSwitchedOn(),
false);
118 override void OnSwitchOn()
131 override void OnSwitchOff()
154 m_Light.AttachOnMemoryPoint(
this,
"light");
174 RefreshFlameVisual(
false,
false);
176 RemoveCookingAudioVisuals();
182 override void OnWork(
float consumed_energy)
199 m_TimeFactor = consumed_energy;
223 protected void RefreshFlameVisual(
bool working =
false,
bool hasAttachment =
false)
227 SetObjectTexture(0, FLAME_BUTANE_OFF);
228 SetObjectTexture(1, FLAME_BUTANE_OFF);
236 SetObjectTexture(0, FLAME_BUTANE_ON);
237 SetObjectTexture(1, FLAME_BUTANE_OFF);
242 SetObjectTexture(0, FLAME_BUTANE_OFF);
243 SetObjectTexture(1, FLAME_BUTANE_ON);
251 protected void RemoveCookingAudioVisuals()
256 switch (cookEquipment.Type())
261 cookingPot.RemoveAudioVisualsOnClient();
264 FryingPan fryingPan = FryingPan.Cast(cookEquipment);
265 fryingPan.RemoveAudioVisualsOnClient();
274 protected void SoundBurningStart()
276 PlaySoundSetLoop(m_SoundBurningLoop, SOUND_BURNING, 0.1, 0.3);
279 protected void SoundBurningStop()
281 StopSoundSet(m_SoundBurningLoop);
284 protected void SoundTurnOn()
286 PlaySoundSet(m_SoundTurnOn, SOUND_TURN_ON, 0.1, 0.1);
289 protected void SoundTurnOff()
291 PlaySoundSet(m_SoundTurnOff, SOUND_TURN_OFF, 0.1, 0.1);
300 if (!super.CanPutInCargo(parent))
303 if (GetCompEM().IsSwitchedOn())
310 for (
int i = 0; i < GetInventory().GetAttachmentSlotsCount(); i++)
312 slotId = GetInventory().GetAttachmentSlotId(i);
313 if (parent.GetInventory().HasInventorySlot(slotId))
336 if (ent.GetInventory().GetCurrentInventoryLocation(loc) && loc.IsValid())
340 parent = ent.GetHierarchyParent();
341 if (parent && parent.GetInventory().HasInventorySlot(slotId))
349 ent = ent.GetHierarchyParent();
352 return super.CanReceiveAttachment(attachment, slotId);
358 for (
int i = 0; i < attachment.GetInventory().GetSlotIdCount(); i++)
360 slotId = attachment.GetInventory().GetSlotId(i);
361 if (GetInventory().HasAttachmentSlot(slotId))
368 if (ent.GetInventory().GetCurrentInventoryLocation(loc) && loc.IsValid())
372 parent = ent.GetHierarchyParent();
373 if (parent.GetInventory().HasInventorySlot(slotId))
381 ent = ent.GetHierarchyParent();
386 return super.CanLoadAttachment(attachment);
392 if (!super.CanPutIntoHands(parent))
397 return !GetCompEM().IsSwitchedOn();
404 override bool IsIgnited()
406 return GetCompEM().IsWorking();
409 override bool CanIgniteItem(
EntityAI ignite_target = NULL)
411 return GetCompEM().IsWorking();
427 if (
Class.CastTo(entity,
this) )
429 GetInventory().CreateInInventory(
"LargeGasCanister");
430 GetInventory().CreateInInventory(
"Pot");
432 SpawnEntityOnGroundPos(
"WaterBottle", entity.GetPosition() +
Vector(0.2, 0, 0));