Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
fireplacebase.c
Go to the documentation of this file.
14
15enum FirePlaceFailure
16{
17 WIND = 0,
18 WET = 1,
19}
20
22{
23 //State params
24 protected bool m_IsBurning = false;
25 protected bool m_HasAshes = false;
26 protected bool m_IsOven = false;
27 protected bool m_HasStoneCircle = false;
28 protected bool m_NoIgnite = false;
29 protected int m_OvenAttachmentsLockState = -1;
31 protected FireplaceFireState m_LastFireState = FireplaceFireState.NO_FIRE; //for synchronization purposes
33
34 //Fireplace params
35 protected float m_FuelBurnRateMP = 1.0;
36
37 //cooking
38 protected ref Cooking m_CookingProcess;
39
40 //temperature simulation constants
41 const float PARAM_SMALL_FIRE_TEMPERATURE = 150;
42 const float PARAM_NORMAL_FIRE_TEMPERATURE = 1000;
44 const float PARAM_MIN_FIRE_TEMPERATURE = 30;
45 const float PARAM_TEMPERATURE_INCREASE = 10;
47 const float PARAM_MAX_WET_TO_IGNITE = 0.2;
48 const float PARAM_MIN_TEMP_TO_REIGNITE = 30;
49 const float PARAM_IGNITE_RAIN_THRESHOLD = 0.1;
50 const float PARAM_BURN_WET_THRESHOLD = 0.40;
52 const float PARAM_WET_COOLING_DECREASE_COEF = 0.002;
54 const float PARAM_BURN_DAMAGE_COEF = 5.0;
55 const float PARAM_FULL_HEAT_RADIUS = 2.0;
56 const float PARAM_HEAT_RADIUS = 4.0;
58
59 //staging constants
61 const int MIN_STONES_TO_BUILD_OVEN = 16;
63 const float MIN_CEILING_HEIGHT = 5;
64
65 //fuel constants
66 const float FUEL_BURN_RATE_DEFAULT = 1.0;
67 const float FUEL_BURN_RATE_STONES = 0.92;
68 const float FUEL_BURN_RATE_OVEN = 0.85;
69
71 const float PARAM_COOKING_TEMP_THRESHOLD = 100;
77 const int SMOKING_SLOT_COUNT = 4;
78 const float SMOKING_SPEED = 1; // per second
79
80 // stage lifetimes
83
84 const float IGNITE_WIND_THRESHOLD = 0.8; //fireplace can not be ignited above this multiple of max wind
85
86 protected const float RAIN_EFFECT_LIMIT = 0.4;
87 protected const float SNOWFALL_EFFECT_LIMIT = 1.3;
88 protected const float RAIN_WETNESS_INCREASE = 0.02;
89 protected const float SNOWFALL_WETNESS_INCREASE = 0.01;
90
91 //Timers
92 protected ref Timer m_HeatingTimer;
93 protected ref Timer m_CoolingTimer;
94
95 // Light entity
96 protected FireplaceLight m_Light;
97 protected float m_LightDistance = 2000;
98
99 //Attachments
104
105 //Particles - default for FireplaceBase
106 protected int PARTICLE_FIRE_START = ParticleList.CAMP_FIRE_START;
107 protected int PARTICLE_OVEN_FIRE_START = ParticleList.CAMP_STOVE_FIRE_START;
108 protected int PARTICLE_SMALL_FIRE = ParticleList.CAMP_SMALL_FIRE;
109 protected int PARTICLE_NORMAL_FIRE = ParticleList.CAMP_NORMAL_FIRE;
110 protected int PARTICLE_OVEN_FIRE = ParticleList.CAMP_STOVE_FIRE;
111 protected int PARTICLE_SMALL_SMOKE = ParticleList.CAMP_SMALL_SMOKE;
112 protected int PARTICLE_NORMAL_SMOKE = ParticleList.CAMP_NORMAL_SMOKE;
113 protected int PARTICLE_FIRE_END = ParticleList.CAMP_FIRE_END;
114 protected int PARTICLE_OVEN_FIRE_END = ParticleList.CAMP_STOVE_FIRE_END;
115 protected int PARTICLE_STEAM_END = ParticleList.CAMP_STEAM_2END;
116 protected int PARTICLE_STEAM_EXTINGUISHING = ParticleList.CAMP_STEAM_EXTINGUISH_START;
117 protected int PARTICLE_NO_IGNITE_WIND = ParticleList.CAMP_NO_IGNITE_WIND;
118 //
127
128 //Sounds
129 const string SOUND_FIRE_HEAVY = "HeavyFire_SoundSet";
130 const string SOUND_FIRE_LIGHT = "LightFire_SoundSet";
131 const string SOUND_FIRE_NO_FIRE = "NoFuelFire_SoundSet";
132 const string SOUND_FIRE_EXTINGUISHING = "ExtinguishByWater_SoundSet";
133 const string SOUND_FIRE_EXTINGUISHED = "ExtinguishByWaterEnd_SoundSet";
134
135 //
138 //
139
140 //Fuel
141 //Kindling / Fuel item types
142 protected static ref map<typename, ref FireConsumableType> m_FireConsumableTypes;
144
145 //Player action / status messages
146 const string MESSAGE_IGNITE_IGNIT_ITEM_DAMAGED = "You cannot start fire. Fireplace is ruined.";
147 const string MESSAGE_IGNITE_NO_KINDLING = "There needs to be some kindling to start a fire.";
148 const string MESSAGE_IGNITE_TOO_WET = "The fireplace is too wet to be ignited.";
149 const string MESSAGE_IGNITE_RAIN = "The fire went out because of the rain.";
150 const string MESSAGE_IGNITE_WIND = "The fire went out because of the wind.";
151 const string MESSAGE_IGNITE_IN_WATER = "I cannot ignite the fireplace in the water.";
152 const string MESSAGE_IGNITE_UNDER_LOW_ROOF = "I cannot ignite the fireplace here, the is not enough room.";
153 const string MESSAGE_REIGNITE_NO_KINDLING = "There needs to be some kindling to start a fire.";
154 const string MESSAGE_REIGNITE_RAIN = "Cannot reignite fireplace in rain.";
155 const string MESSAGE_REIGNITE_TOO_WET = "The fireplace is too wet to be reignited.";
156 const string MESSAGE_BURY_ASHES_FAILED_NOT_EMPTY = "Cannot bury ashes. There are sill items in it.";
157 const string MESSAGE_BURY_ASHES_FAILED_SURFACE = "Cannot bury ashes on hard surface.";
158 const string MESSAGE_BURY_ASHES_FAILED_BURNING = "Cannot bury ashes, the fireplace is still burning.";
159 const string MESSAGE_BURY_ASHES_FAILED_TOO_HOT = "Cannot bury ashes, the fireplace is too hot.";
160 const string MESSAGE_CANNOT_BUILD_OVEN = "Cannot build oven.";
161 const string MESSAGE_CANNOT_DISMANTLE_OVEN = "Cannot dismantle oven.";
162
163 //Visual animations
164 const string ANIMATION_ASHES = "Ashes";
165 const string ANIMATION_KINDLING = "Kindling";
166 const string ANIMATION_STICKS = "Sticks";
167 const string ANIMATION_WOOD = "Wood";
168 const string ANIMATION_BURNT_WOOD = "BurntWood";
169 const string ANIMATION_STONE = "Stone";
170 const string ANIMATION_STONES = "StonesCircle";
171 const string ANIMATION_TRIPOD = "Tripod";
172 const string ANIMATION_OVEN = "Oven";
173 const string ANIMATION_INVENTORY = "Inventory";
174 const string ANIMATION_COOKWARE_HANDLE = "handleRotate";
175 const string ANIMATION_CAULDRON_HANDLE = "handle1Rotate";
176
177
178 //Visual textures and materials
179 const string MATERIAL_FIREPLACE_GLOW = "dz\\gear\\cooking\\data\\stoneground.rvmat";
180 const string MATERIAL_FIREPLACE_NOGLOW = "dz\\gear\\cooking\\data\\stonegroundnoemit.rvmat";
181
182 //Attachment types
183 //Fuel
185 typename ATTACHMENT_FIREWOOD = Firewood;
186 //Kindling
187 typename ATTACHMENT_RAGS = Rag;
188 typename ATTACHMENT_BANDAGE = BandageDressing;
189 typename ATTACHMENT_BOOK = ItemBook;
190 typename ATTACHMENT_BARK_OAK = Bark_Oak;
191 typename ATTACHMENT_BARK_BIRCH = Bark_Birch;
192 typename ATTACHMENT_PAPER = Paper;
193 typename ATTACHMENT_GIFTWRAP = GiftWrapPaper;
196 //Other
197 typename ATTACHMENT_TRIPOD = Tripod;
198 typename ATTACHMENT_COOKINGSTAND = CookingStand;
199 typename ATTACHMENT_STONES = Stone;
200 typename ATTACHMENT_COOKING_POT = Pot; //'IsCookware' used instead
201 typename ATTACHMENT_FRYING_PAN = FryingPan; //'IsCookware' used instead
202 typename ATTACHMENT_CAULDRON = Cauldron; //'IsCookware' used instead
203 //
204 protected const float PLACEMENT_HEIGHT_LIMIT = 0.1; // Y coord placement limit - this is important when server has collision checks disabled
205 const string OBJECT_CLUTTER_CUTTER = "ClutterCutterFireplace";
207
208 //area damage
209 protected ref AreaDamageManager m_AreaDamage;
210
211 //quantity
212 protected float m_TotalEnergy;
213
214 // Noise
216 private bool m_CanNoise = true; // Flip every fireplace update to limit amount of noise generation
217
218 // UniversalTemperatureSource
222
223 // surface wetness on heat modification
224 protected const float WET_SURFACE_INCREMENT = 0.06;
225 protected float m_SurfaceUnderWetnessModifier
226
229 protected ref UnderObjectDecalSpawnComponent m_UnderObjectDecalSpawnComponent;
230
231 //================================================================
232 // INIT / STORE LOAD-SAVE
233 //================================================================
234 //Constructor
235 protected void FireplaceBase()
236 {
237 //STATIC: define kindling types
238 if (!m_FireConsumableTypes)
239 {
240 m_FireConsumableTypes = new map<typename, ref FireConsumableType>();
241 m_FireConsumableTypes.Insert(ATTACHMENT_RAGS, new FireConsumableType(ATTACHMENT_RAGS, 8, true, "Rags"));
242 m_FireConsumableTypes.Insert(ATTACHMENT_BANDAGE, new FireConsumableType(ATTACHMENT_BANDAGE, 8, true, "MedicalBandage"));
243 m_FireConsumableTypes.Insert(ATTACHMENT_BOOK, new FireConsumableType(ATTACHMENT_BOOK, 20, true, "Book"));
244 m_FireConsumableTypes.Insert(ATTACHMENT_BARK_OAK, new FireConsumableType(ATTACHMENT_BARK_OAK, 10, true, "OakBark"));
245 m_FireConsumableTypes.Insert(ATTACHMENT_BARK_BIRCH, new FireConsumableType(ATTACHMENT_BARK_BIRCH, 8, true, "BirchBark"));
246 m_FireConsumableTypes.Insert(ATTACHMENT_PAPER, new FireConsumableType(ATTACHMENT_PAPER, 5, true, "Paper"));
247 m_FireConsumableTypes.Insert(ATTACHMENT_GIFTWRAP, new FireConsumableType(ATTACHMENT_GIFTWRAP, 5, true, "GiftWrapPaper"));
248 m_FireConsumableTypes.Insert(ATTACHMENT_PUNCHEDCARD, new FireConsumableType(ATTACHMENT_PUNCHEDCARD, 5, true, "PunchedCard"));
249 m_FireConsumableTypes.Insert(ATTACHMENT_EYEMASK_COLORBASE, new FireConsumableType(ATTACHMENT_EYEMASK_COLORBASE, 5, true, "EyeMask_ColorBase"));
250
251 //define fuel types
252 m_FireConsumableTypes.Insert(ATTACHMENT_STICKS, new FireConsumableType(ATTACHMENT_STICKS, 30, false, "WoodenStick"));
253 m_FireConsumableTypes.Insert(ATTACHMENT_FIREWOOD, new FireConsumableType(ATTACHMENT_FIREWOOD, 100, false, "Firewood"));
254 }
255
256 //calculate total energy
258
259 //define fuel / kindling items (fire consumables)
261
262 //default burning parameters
264
265 //synchronized variables
266 RegisterNetSyncVariableBool("m_IsBurning");
267 RegisterNetSyncVariableBool("m_HasAshes");
268 RegisterNetSyncVariableBool("m_IsOven");
269 RegisterNetSyncVariableBool("m_HasStoneCircle");
270 RegisterNetSyncVariableBool("m_RoofAbove");
271 RegisterNetSyncVariableInt("m_FireState", FireplaceFireState.NO_FIRE, FireplaceFireState.COUNT);
272 RegisterNetSyncVariableBool("m_NoIgnite");
273
274 m_HalfExtents = vector.Zero;
275
276 m_SurfaceUnderWetnessModifier = 0.0;
277
279 m_UTSSettings.m_ManualUpdate = true;
280 m_UTSSettings.m_TemperatureItemCap = GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE;
283 m_UTSSettings.m_RangeMax = PARAM_HEAT_RADIUS;
284
285 m_UTSSettings.m_EnableOnTemperatureControl = true;
286 m_UTSSettings.m_ActiveTemperatureThreshold = 250.0;
287 m_UTSSettings.m_InactiveTemperatureThreshold = 475.0;
288
290 m_UnderObjectDecalSpawnSettings.m_RandomizeRotation = true;
291 m_UnderObjectDecalSpawnSettings.m_PositionOffset = "0 0.05 0";
292 m_UnderObjectDecalSpawnSettings.m_ScaleMax = 1.0;
293 }
294
295 protected void ~FireplaceBase()
296 {
298
299 if (GetLightEntity())
300 GetLightEntity().FadeOut();
301
303 {
306 }
307 }
308
309 override void EEInit()
310 {
311 super.EEInit();
312
313 //refresh visual on init
315 if (m_CookingProcess == null)
316 m_CookingProcess = new Cooking();
317
318 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
319 {
321 }
322
324 {
325 m_UnderObjectDecalSpawnComponent = new UnderObjectDecalSpawnComponent(m_UnderObjectDecalSpawnSettings, this);
327 }
328 }
329
330 override void EEItemAttached(EntityAI item, string slot_name)
331 {
332 super.EEItemAttached(item, slot_name);
333
334 //cookware
335 if (item.IsCookware())
336 SetCookingEquipment(ItemBase.Cast(item));
337 }
338
339 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
340 {
341 super.OnItemLocationChanged(old_owner, new_owner);
342
343 //refresh physics after location change (with delay)
345
347 GetInventory().GetCurrentInventoryLocation(loc);
348 if (loc.GetType() == InventoryLocationType.GROUND)
349 {
350 if (IsOpen() && !IsOven())
351 CheckForRoofLimited(0); //roof check when moved to ground
352
354 {
355 m_UnderObjectDecalSpawnComponent = new UnderObjectDecalSpawnComponent(m_UnderObjectDecalSpawnSettings, this);
357 }
358 }
359 else
360 {
362 {
365 }
366
368 }
369
370 m_SurfaceUnderWetnessModifier = GetSurfaceWetnessOnHeatModifier(this);
371 }
372
373 override void OnAttachmentRuined(EntityAI attachment)
374 {
375 switch (attachment.Type())
376 {
379 int slot = InventorySlots.GetSlotIdFromString("CookingEquipment");
380 EntityAI ent = GetInventory().FindAttachment(slot);
381 if (ent && ent.IsCookware())
382 {
383 vector direction = ent.GetDirection();
384 float dot = vector.Dot(direction, vector.Forward);
385
386 float angle = Math.Acos(dot);
387 if (direction[0] < 0)
388 {
389 angle = -angle;
390 }
391
392 float cos = Math.Cos(angle);
393 float sin = Math.Sin(angle);
394 GetInventory().DropEntityInBounds(InventoryMode.SERVER, this, ent, "2 0 2", angle, cos, sin);
395 }
396
397 attachment.Delete();
398 break;
399 }
400 }
401
402 override void EEDelete(EntityAI parent)
403 {
404 super.EEDelete(parent);
405
407
408 // cleanup particles (for cases of leaving burning fplace and going back outside of network bubble)
409 #ifndef SERVER
411 #endif
412 }
413
414 //on store save/load
416 {
417 super.OnStoreSave(ctx);
418
419 //Save ashes state
420 ctx.Write(m_HasAshes);
421
422 //Save fuel burn rate MP
423 ctx.Write(m_FuelBurnRateMP);
424
425 //Save burning state
426 ctx.Write(m_IsBurning);
427 }
428
429 override bool OnStoreLoad(ParamsReadContext ctx, int version)
430 {
431 if (!super.OnStoreLoad(ctx, version))
432 return false;
433
434 //--- Fireplace data ---
435 //Load ashes state
436 if (!ctx.Read(m_HasAshes))
437 {
438 m_HasAshes = false; //set default
439 return false;
440 }
441
442 //Load temperature loss MP
443 if (version < 139 && !ctx.Read(m_TemperatureLossMP))
444 {
445 m_TemperatureLossMP = 1.0; //set default
446 return false;
447 }
448
449 //Load fuel burn rate MP
450 if (!ctx.Read(m_FuelBurnRateMP))
451 {
452 m_FuelBurnRateMP = 1.0; //set default
453 return false;
454 }
455
456 //Load burning state, if true start fire
457 if (!ctx.Read(m_IsBurning))
458 {
459 m_IsBurning = false; //set default
460 return false;
461 }
462 //---
463
464 return true;
465 }
466
467 override void AfterStoreLoad()
468 {
469 super.AfterStoreLoad();
470
471 Synchronize();
472
473 //start fire
474 if (IsBurning())
475 {
476 if (GetGame() && GetGame().IsServer())
477 {
478 StartFire(true); //will be auto-synchronized when starting fire
479 }
480 }
481 }
482
483 //================================================================
484 // SYNCHRONIZATION
485 //================================================================
487 {
488 if (GetGame() && GetGame().IsServer())
489 {
490 SetSynchDirty();
491
492 if (GetGame().IsMultiplayer() && GetGame().IsServer())
493 {
494 //Refresh visuals (on server)
496 }
497 }
498 }
499
501 {
502 super.OnVariablesSynchronized();
503
506
507 if (IsBaseFireplace() && !IsOven())
508 {
510 {
512 }
513 else if (!m_IsBurning && m_AreaDamage)
514 {
516 }
517 }
518
520 m_UnderObjectDecalSpawnComponent.UpdateSize(Math.InverseLerp(0.0, GetTemperatureMax() * 0.6, GetTemperature()));
521 }
522
523 //================================================================
524 // BASE
525 //================================================================
526
527 //States
528 //check fireplace types
529 override bool IsFireplace()
530 {
531 return true;
532 }
533
535 {
536 return false;
537 }
538
540 {
541 return false;
542 }
543
545 {
546 return false;
547 }
548
550 {
551 return false;
552 }
553
554 override bool CanHaveWetness()
555 {
556 return true;
557 }
558
559 override bool CanHaveTemperature()
560 {
561 return true;
562 }
563
564 override bool GetCookingTargetTemperature(out float temperature)
565 {
566 temperature = GetTemperature();
567 return true;
568 }
569
571 {
572 return m_IsBurning || (m_CoolingTimer && m_CoolingTimer.IsRunning()); //FireplaceFireState.NO_FIRE?
573 }
574
583
584 //cooking equipment
589
591 {
592 m_CookingEquipment = equipment;
593 }
594
596 {
598 {
599 m_CookingProcess.TerminateCookingSounds(pItem);
600 }
601
603 }
604
607 {
609 }
610
612 {
613 for (int i = 0; i < DIRECT_COOKING_SLOT_COUNT; i++)
614 {
616 {
617 return true;
618 }
619 }
620 return false;
621 }
622
624 {
625 for (int i = 0; i < SMOKING_SLOT_COUNT; i++)
626 {
627 if (m_SmokingSlots[i])
628 {
629 return true;
630 }
631 }
632 return false;
633 }
634
637 {
638 DeleteSafe();
639 }
640
641 override bool IsPrepareToDelete()
642 {
643 return IsEmpty() && !IsBurning() && !HasAshes();
644 }
645
647 {
648 super.OnChildItemRemoved(item);
650 }
651
652 override void CheckForDestroy()
653 {
654 if (IsPrepareToDelete())
655 {
656 MiscGameplayFunctions.DropAllItemsInInventoryInBounds(this, m_HalfExtents);
657 super.CheckForDestroy();
658 }
659 }
660
661 //================================================================
662 // VISUAL
663 //================================================================
664 //Fireplace visual
666 {
667 if (IsHologram())
668 {
669 return;
670 }
671
672 // Light
673 #ifndef SERVER
674 if (IsBurning())
675 {
676 //turn light on
677 if (!GetLightEntity())
678 {
679 SetLightEntity(FireplaceLight.Cast(ScriptedLightBase.CreateLight(FireplaceLight, GetPosition(), 20)));
680 GetLightEntity().AttachOnMemoryPoint(this, "light");
681 }
682
683 if (GetLightEntity() && GetLightEntity().GetBrightness() > 0)
684 {
685 // change brightness based on the distance of player to the fireplace
686 Object player = GetGame().GetPlayer();
687 float lightDist = m_LightDistance;
688
689 if (IsOven())
690 {
691 lightDist = 50;
692 }
693
694 if (player)
695 {
696 if (vector.DistanceSq(player.GetPosition(), this.GetPosition()) > lightDist * lightDist)
697 {
698 GetLightEntity().FadeBrightnessTo(0, 5);
699 }
700 else
701 {
702 GetLightEntity().FadeBrightnessTo(FireplaceLight.m_FireplaceBrightness, 5);
703 }
704 }
705
706 // The following solves an issue with the light point clipping through narrow geometry
708 {
709 GetLightEntity().SetInteriorMode();
710 }
711 else
712 {
713 GetLightEntity().SetExteriorMode();
714 }
715 }
716 }
717 else
718 {
719 //turn light off
720 if (GetLightEntity())
721 {
722 GetLightEntity().FadeOut();
723 }
724 }
725 #endif
726
727 //set default burn parameters based on fireplace type
729 {
731 }
732 else if (HasStoneCircle())
733 {
735 }
736 else
737 {
739 }
740
741 // Oven attachments
742 if (IsOven())
743 {
744 //lock attachment slots
746 {
748 }
749 }
750 else
751 {
752 //unlock attachment slots
754 {
755 LockOvenAttachments(false);
756 }
757 }
758
759 //VISUAL STATES
760 //Fuel state
761 if (GetGame().IsServer())
762 {
763 // Sticks state
765 SetAnimationPhase(ANIMATION_STICKS, 0);
766 else
767 SetAnimationPhase(ANIMATION_STICKS, 1);
768
769 // Firewood state
771 {
772 if (IsBurning() && HasAshes())
773 {
774 SetAnimationPhase(ANIMATION_BURNT_WOOD, 0); // Because this might not be set under certain circumstances
775 SetAnimationPhase(ANIMATION_WOOD, 1);
776 }
777 else if (IsWet() || !IsBurning())
778 {
779 SetAnimationPhase(ANIMATION_BURNT_WOOD, 1);
780 SetAnimationPhase(ANIMATION_WOOD, 0);
781 }
782 else
783 {
784 SetAnimationPhase(ANIMATION_BURNT_WOOD, 1);
785 SetAnimationPhase(ANIMATION_WOOD, 0);
786 }
787 }
788 else
789 {
790 SetAnimationPhase(ANIMATION_WOOD, 1);
791 SetAnimationPhase(ANIMATION_BURNT_WOOD, 1);
792 }
793
794 // Kindling state
795 if (GetKindlingCount() != 0)
796 SetAnimationPhase(ANIMATION_KINDLING, 0);
797 else
798 SetAnimationPhase(ANIMATION_KINDLING, 1);
799
800 // Ashes state
801 if (HasAshes())
802 SetAnimationPhase(ANIMATION_ASHES, 0);
803 else
804 SetAnimationPhase(ANIMATION_ASHES, 1);
805
806 // Stone variations
807 if (HasStones())
808 {
809 if (HasStoneCircle())
810 {
811 SetAnimationPhase(ANIMATION_STONES, 0);
812 SetAnimationPhase(ANIMATION_STONE, 1);
813 }
814 else if (IsOven())
815 {
816 SetAnimationPhase(ANIMATION_OVEN, 0);
817 SetAnimationPhase(ANIMATION_STONE, 1);
818 }
819 else
820 {
822 SetAnimationPhase(ANIMATION_STONES, 1);
823 SetAnimationPhase(ANIMATION_OVEN, 1);
824 SetAnimationPhase(ANIMATION_STONE, 0);
825 }
826 }
827 else
828 {
829 SetAnimationPhase(ANIMATION_STONE, 1);
830 }
831 }
832
833 //refresh physics (with delay)
835 }
836
838 protected void SetBurntFirewood()
839 {
840 if (GetGame().IsServer() && IsInAnimPhase(ANIMATION_WOOD))
841 {
842 SetAnimationPhase(ANIMATION_WOOD, 1);
843 SetAnimationPhase(ANIMATION_BURNT_WOOD, 0);
844 }
845 }
846
847 //Refresh fireplace object physics
849
850 protected void RefreshFireParticlesAndSounds(bool force_refresh)
851 {
852 FireplaceFireState fire_state = GetFireState();
853
854 if (m_LastFireState != fire_state || force_refresh)
855 {
856 switch (fire_state)
857 {
858 case FireplaceFireState.START_FIRE:
859 {
860 //particles
862
863 //sounds
866 break;
867 }
868 case FireplaceFireState.SMALL_FIRE:
869 {
870 //particles
872
874
875 if (CanShowSmoke())
877 else
879
882
884
885 //sounds
888 break;
889 }
890 case FireplaceFireState.NORMAL_FIRE:
891 {
892 //particles
894
897
899
900 if (CanShowSmoke())
902 else
904
906
907 //sounds
910 break;
911 }
912 case FireplaceFireState.END_FIRE:
913 {
914 //particles
916
919
922
924
925 //sounds
928 break;
929 }
930 case FireplaceFireState.EXTINGUISHING_FIRE: //TODO add steam particles when extinguishing
931 {
932 //particles
934
937
940
942
944
945 //sounds
948 break;
949 }
950 case FireplaceFireState.EXTINGUISHED_FIRE: //TODO add steam particles when fireplace is extinguished
951 {
952 //particles
954
957
960
962
964
965 if (CanShowSmoke())
967 else
969
970 //sounds
974 break;
975 }
976 case FireplaceFireState.REIGNITED_FIRE:
977 {
978 //particles
980
983
986
988
990
991 //sounds
993 break;
994 }
995 case FireplaceFireState.NO_FIRE:
996 {
997 //particles
999
1002
1005
1007
1010
1011 //sounds
1012 SoundFireStop();
1013 break;
1014 }
1015 }
1016
1017 m_LastFireState = fire_state;
1018 }
1019 }
1020
1022 {
1023 // go through all fireplace particles
1040
1041 // go through all fireplace sounds
1042 if (m_SoundFireLoop)
1043 StopSoundSet(m_SoundFireLoop);
1044 if (m_SoundFire)
1045 StopSoundSet(m_SoundFire);
1046 }
1047
1049 {
1050 return true;
1051 }
1052
1053 //Fireplace fire intensity
1055 {
1056 float temperature = GetTemperature();
1057
1058 //if it's burning
1059 if (IsBurning())
1060 {
1061 //Start fire
1062 if (temperature <= PARAM_MIN_FIRE_TEMPERATURE)
1063 {
1064 if (GetFireState() != FireplaceFireState.START_FIRE)
1065 {
1066 SetFireState(FireplaceFireState.START_FIRE);
1067 }
1068 }
1069 //Small fire
1070 else if (temperature <= PARAM_SMALL_FIRE_TEMPERATURE)
1071 {
1072 if (GetFireState() != FireplaceFireState.SMALL_FIRE)
1073 {
1074 SetFireState(FireplaceFireState.SMALL_FIRE);
1075 }
1076 }
1077 //Normal fire
1078 else if (temperature > PARAM_SMALL_FIRE_TEMPERATURE)
1079 {
1080 if (GetFireState() != FireplaceFireState.NORMAL_FIRE)
1081 {
1082 SetFireState(FireplaceFireState.NORMAL_FIRE);
1083 }
1084 }
1085 }
1086 }
1087
1088 //================================================================
1089 // PARTICLES & SOUNDS
1090 //================================================================
1091 //returns true if particle started, false if not
1092 protected bool PlayParticle(out Particle particle, int particle_type, vector pos, bool worldpos = false)
1093 {
1094 if (!particle && GetGame() && (!GetGame().IsDedicatedServer()))
1095 {
1096 if (!worldpos)
1097 {
1098 particle = ParticleManager.GetInstance().PlayOnObject(particle_type, this, pos);
1099 }
1100 else
1101 {
1102 particle = ParticleManager.GetInstance().PlayInWorld(particle_type, pos);
1103 }
1104
1105 return true;
1106 }
1107
1108 return false;
1109 }
1110
1111 //returns true if particle stopped, false if not
1112 protected bool StopParticle(out Particle particle)
1113 {
1114 if (particle && GetGame() && (!GetGame().IsDedicatedServer()))
1115 {
1116 particle.Stop();
1117 particle = NULL;
1118
1119 return true;
1120 }
1121
1122 return false;
1123 }
1124
1125 //start fire
1137
1138 protected void ParticleFireStartStop()
1139 {
1141 }
1142
1143 //small fire
1155
1156 protected void ParticleSmallFireStop()
1157 {
1159 }
1160
1161 //normal fire
1173
1174 protected void ParticleNormalFireStop()
1175 {
1177 }
1178
1179 //small smoke
1181 {
1183
1184 //calculate air resistance
1185 float actual_height;
1186 if (GetCeilingHeight(actual_height))
1187 {
1188 float air_resistance = GetAirResistanceForSmokeParticles(actual_height);
1189
1190 //alter smoke height
1191 m_ParticleSmallSmoke.SetParameter(-1, EmitorParam.AIR_RESISTANCE, air_resistance);
1192 }
1193
1194 if (IsRoofAbove() || !IsOpen() || IsOven())
1195 {
1196 m_ParticleSmallSmoke.SetParameter(-1, EmitorParam.WIND, false);
1197 }
1198 }
1199
1200 protected void ParticleSmallSmokeStop()
1201 {
1203 }
1204
1205 //normal smoke
1207 {
1209
1210 //calculate air resistance
1211 float actual_height;
1212 if (GetCeilingHeight(actual_height))
1213 {
1214 float air_resistance = GetAirResistanceForSmokeParticles(actual_height);
1215
1216 //alter smoke height
1217 m_ParticleNormalSmoke.SetParameter(-1, EmitorParam.AIR_RESISTANCE, air_resistance);
1218 }
1219
1220 if (IsRoofAbove() || !IsOpen() || IsOven())
1221 {
1222 m_ParticleNormalSmoke.SetParameter(-1, EmitorParam.WIND, false);
1223 }
1224 }
1225
1227 {
1229 }
1230
1231 //fire end
1232 protected void ParticleFireEndStart()
1233 {
1234 if (IsOven())
1235 {
1237 }
1238 else
1239 {
1241 }
1242 }
1243
1244 protected void ParticleFireEndStop()
1245 {
1247 }
1248
1260
1261 //steam extinguishing
1266
1271
1272 //steam end
1277
1278 protected void ParticleSteamEndStop()
1279 {
1281 }
1282
1287
1289 {
1291 }
1292
1293 bool GetCeilingHeight(out float actual_height)
1294 {
1295 vector from = this.GetPosition();
1296 vector to = this.GetPosition();
1297 from[1] = from[1] + 1.0;
1298 to[1] = to[1] + MIN_CEILING_HEIGHT;
1299 vector contactPos;
1300 vector contactDir;
1301 int contactComponent;
1302
1303 bool hit = DayZPhysics.RaycastRV(from, to, contactPos, contactDir, contactComponent, NULL, NULL, this);
1304 actual_height = vector.Distance(from, contactPos) + 1.0;
1305
1306 return hit;
1307 }
1308
1309 float GetAirResistanceForSmokeParticles(float actual_height)
1310 {
1311 float air_res;
1312 actual_height = Math.Clamp(actual_height, 0, 36);
1313
1314 air_res = (6 - actual_height) * 0.33;
1315 air_res = Math.Clamp(air_res, 0, 2);
1316
1317 return air_res;
1318 }
1319
1320 //Particle Positions
1321 //Get local fire and smoke effect position
1323 {
1324 return Vector(0, 0.05, 0);
1325 }
1326
1328 {
1329 return Vector(0, 0.05, 0);
1330 }
1331
1332 //================================================================
1333 // SOUNDS
1334 //================================================================
1335 //Burning
1336 //Start
1337 protected void SoundFireLightStart()
1338 {
1339 PlaySoundSetLoop(m_SoundFireLoop, SOUND_FIRE_LIGHT, 1.0, 1.0);
1340 }
1341
1342 protected void SoundFireHeavyStart()
1343 {
1344 PlaySoundSetLoop(m_SoundFireLoop, SOUND_FIRE_HEAVY, 1.0, 2.0);
1345 }
1346
1347 protected void SoundFireNoFireStart()
1348 {
1349 PlaySoundSetLoop(m_SoundFireLoop, SOUND_FIRE_NO_FIRE, 2.0, 2.0);
1350 }
1351
1353 {
1354 PlaySoundSet(m_SoundFire, SOUND_FIRE_EXTINGUISHED, 0.1, 0.1);
1355 }
1356
1358 {
1359 PlaySoundSet(m_SoundFire, SOUND_FIRE_EXTINGUISHED, 0.1, 0.1);
1360 }
1361
1363 {
1364 PlaySoundSetLoop(m_SoundFireLoop, SOUND_FIRE_EXTINGUISHING, 1.0, 0.5);
1365 }
1366
1368 {
1369 PlaySoundSet(m_SoundFire, "ExtinguishByWind_SoundSet", 0, 0);
1370 }
1371
1372 //Stop
1373 protected void SoundFireStop()
1374 {
1375 StopSoundSet(m_SoundFireLoop);
1376 }
1377
1378 //================================================================
1379 // FUEL / KINDLING
1380 //================================================================
1381 //Add to fire consumables
1382 protected void AddToFireConsumables(ItemBase item)
1383 {
1384 m_FireConsumables.Insert(item, new FireConsumable(item, GetFireConsumableTypeEnergy(item)));
1386 }
1387
1389 {
1390 FireConsumableType fireConsumableType = m_FireConsumableTypes.Get(item.Type());
1391 if (!fireConsumableType)
1392 {
1394 int count = m_FireConsumableTypes.Count();
1395 for (int i = 0; i < count; ++i)
1396 {
1397 if (item.IsInherited(m_FireConsumableTypes.GetKey(i)))
1398 fireConsumableType = m_FireConsumableTypes.GetElement(i);
1399 }
1400 }
1401
1402 if (fireConsumableType)
1403 return fireConsumableType.GetEnergy();
1404
1405 return 0;
1406 }
1407
1408 //Remove from fire consumables
1409 protected void RemoveFromFireConsumables(FireConsumable fire_consumable)
1410 {
1411 if (fire_consumable)
1412 {
1413 m_FireConsumables.Remove(fire_consumable.GetItem());
1414 delete fire_consumable;
1415 }
1416
1418 }
1419
1421 {
1422 return m_FireConsumables.Get(item);
1423 }
1424
1425 //Set fuel / kindling to consume
1426 //Sets the item with the lowest energy value as item that will be consumed next
1427 //Returns reference to set fire consumable
1429 {
1430 if (m_FireConsumables.Count() == 0)
1431 {
1432 m_ItemToConsume = null;
1433 }
1434 else
1435 {
1436 for (int i = 0; i < m_FireConsumables.Count(); ++i)
1437 {
1438 ItemBase key = m_FireConsumables.GetKey(i);
1439 FireConsumable fireConsumable = m_FireConsumables.Get(key);
1440
1441 if (i == 0)
1442 {
1443 m_ItemToConsume = fireConsumable;
1444 }
1445 else
1446 {
1447 if (fireConsumable.GetEnergy() < m_ItemToConsume.GetEnergy())
1448 {
1449 m_ItemToConsume = fireConsumable;
1450 }
1451 }
1452 }
1453 }
1454
1455 //refresh visual
1457
1458 return m_ItemToConsume;
1459 }
1460
1462 {
1463 return m_ItemToConsume;
1464 }
1465
1466 //Spend item that is used as consumable for fire (fuel, kindling)
1467 //if 'amount == 0', the whole quantity will be consumed (quantity -= 1)
1468 //debug
1469 //int m_debug_fire_consume_time = 0;
1470 protected void SpendFireConsumable(float amount)
1471 {
1472 //spend item
1473 FireConsumable fireConsumable = GetItemToConsume();
1474
1475 if (!fireConsumable)
1476 {
1477 //Set new item to consume
1478 fireConsumable = SetItemToConsume();
1479 }
1480
1481 if (fireConsumable)
1482 {
1483 ItemBase item = fireConsumable.GetItem();
1484 fireConsumable.SetRemainingEnergy(fireConsumable.GetRemainingEnergy() - amount);
1485
1486 if (fireConsumable.GetRemainingEnergy() <= 0 || amount == 0)
1487 {
1488 //set ashes
1489 if (!HasAshes())
1490 {
1491 SetAshesState(true);
1492 }
1493
1494 if (item.IsAnyInherited({ItemBook, Paper, GiftWrapPaper, EyeMask_ColorBase}))
1495 {
1496 RemoveFromFireConsumables(fireConsumable);
1497 item.Delete();
1498 }
1499 else
1500 {
1501 //if there is nothing left, delete and remove old consumable, set new fire consumable
1502 if (item.GetQuantity() <= 1)
1503 {
1504 //remove item from fuel items
1505 RemoveFromFireConsumables(fireConsumable);
1506 }
1507 else
1508 {
1509 fireConsumable.SetRemainingEnergy(fireConsumable.GetEnergy());
1510 }
1511
1512 item.AddQuantity(-1);
1514 }
1515 }
1516 }
1517
1519 }
1520
1522 protected int GetKindlingCount()
1523 {
1524 int attachmentsCount = GetInventory().AttachmentCount();
1525 int kindlingCount = 0;
1526
1527 for (int i = 0; i < attachmentsCount; ++i)
1528 {
1529 ItemBase item = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(i));
1530
1531 if (IsKindling(item))
1532 kindlingCount++;
1533 }
1534
1535 return kindlingCount;
1536 }
1537
1539 protected int GetFuelCount()
1540 {
1541 int attachmentsCount = GetInventory().AttachmentCount();
1542 int fuelCount = 0;
1543
1544 for (int i = 0; i < attachmentsCount; ++i)
1545 {
1546 ItemBase item = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(i));
1547 if (IsFuel(item))
1548 fuelCount++;
1549 }
1550
1551 return fuelCount;
1552 }
1553
1555 protected bool IsKindling(ItemBase item)
1556 {
1557 FireConsumableType fireConsumableType = m_FireConsumableTypes.Get(item.Type());
1558 if (!fireConsumableType)
1559 {
1561 int count = m_FireConsumableTypes.Count();
1562 for (int i = 0; i < count; ++i)
1563 {
1564 if (item.IsInherited(m_FireConsumableTypes.GetKey(i)))
1565 fireConsumableType = m_FireConsumableTypes.GetElement(i);
1566 }
1567 }
1568
1569 return fireConsumableType && fireConsumableType.IsKindling();
1570 }
1571
1573 protected bool IsFuel(ItemBase item)
1574 {
1575 FireConsumableType fireConsumableType = m_FireConsumableTypes.Get(item.Type());
1576 if (!fireConsumableType)
1577 {
1579 int count = m_FireConsumableTypes.Count();
1580 for (int i = 0; i < count; ++i)
1581 {
1582 if (item.IsInherited(m_FireConsumableTypes.GetKey(i)))
1583 fireConsumableType = m_FireConsumableTypes.GetElement(i);
1584 }
1585 }
1586
1587 return fireConsumableType && !fireConsumableType.IsKindling();
1588 }
1589
1590 //Has attachments of given type
1591 bool IsItemTypeAttached(typename item_type)
1592 {
1593 return GetAttachmentByType(item_type) != null;
1594 }
1595
1596 //Has attachments of required quantity
1597 bool IsItemAttachedQuantity(typename item_type, float quantity)
1598 {
1599 ItemBase item = ItemBase.Cast(GetAttachmentByType(item_type));
1600
1601 return item.GetQuantity() >= quantity;
1602 }
1603
1604 //Has last attached item
1606 {
1607 return GetInventory().AttachmentCount() == 1;
1608 }
1609
1610 //Has last fuel/kindling attached
1612 {
1613 return (GetFuelCount() + GetKindlingCount()) == 1;
1614 }
1615
1616
1617 //================================================================
1618 // FIRE STATE
1619 //================================================================
1620 //Is fireplace burning?
1622 {
1623 return m_IsBurning;
1624 }
1625
1626 //Set burning state
1627 protected void SetBurningState(bool is_burning)
1628 {
1629 m_IsBurning = is_burning;
1630 }
1631
1632 //Are ashes present in fireplace?
1634 {
1635 return m_HasAshes;
1636 }
1637
1638 //Set ashes state
1639 protected void SetAshesState(bool has_ashes)
1640 {
1641 m_HasAshes = has_ashes;
1642 }
1643
1646 {
1647 return ((m_HeatingTimer && m_HeatingTimer.IsRunning()) || (m_CoolingTimer && m_CoolingTimer.IsRunning()));
1648 }
1649
1650 //Is in oven state
1651 bool IsOven()
1652 {
1653 return m_IsOven;
1654 }
1656 {
1657 return m_HasStoneCircle;
1658 }
1659
1661 {
1662 EntityAI attached_item = GetAttachmentByType(ATTACHMENT_STONES);
1663
1664 return attached_item && attached_item.GetQuantity() > 0;
1665 }
1666
1668 {
1669 if (HasStones())
1670 {
1671 return GetAttachmentByType(ATTACHMENT_STONES).GetQuantity();
1672 }
1673
1674 return 0;
1675 }
1676
1677 void SetOvenState(bool is_oven)
1678 {
1679 if (m_IsOven != is_oven)
1680 {
1681 m_IsOven = is_oven;
1682
1683 GetInventory().SetSlotLock(InventorySlots.GetSlotIdFromString("Stones") , is_oven);
1684
1685 Synchronize();
1686 }
1687 }
1688
1689 void SetStoneCircleState(bool has_stonecircle)
1690 {
1691 if (m_HasStoneCircle != has_stonecircle)
1692 {
1693 m_HasStoneCircle = has_stonecircle;
1694
1695 GetInventory().SetSlotLock(InventorySlots.GetSlotIdFromString("Stones") , has_stonecircle);
1696
1697 Synchronize();
1698 }
1699 }
1700
1701 //Fuel burn rate MP
1702 protected float GetFuelBurnRateMP()
1703 {
1704 return m_FuelBurnRateMP;
1705 }
1706
1707 protected void SetFuelBurnRateMP(float value)
1708 {
1709 m_FuelBurnRateMP = value;
1710 }
1711
1712 //Get fire state
1713 protected int GetFireState()
1714 {
1715 return m_FireState;
1716 }
1717
1718 //Sets fire state
1719 protected void SetFireState(FireplaceFireState state)
1720 {
1721 if (m_FireState != state)
1722 {
1723 m_FireState = state;
1724
1725 Synchronize();
1726 }
1727 }
1728
1730 {
1731 SetFireState(FireplaceFireState.EXTINGUISHING_FIRE);
1732 }
1733
1734 //================================================================
1735 // FIRE PROCESS
1736 //================================================================
1737
1738 //Start the fire process
1739 // 1. start heating
1740 // 2. heating
1741 // 3. stop heating
1742 void StartFire(bool force_start = false)
1743 {
1744 //stop cooling process if active
1745 if (m_CoolingTimer)
1746 {
1747 m_CoolingTimer.Stop();
1748 m_CoolingTimer = null;
1749 }
1750
1751 //start fire
1752 if (!IsBurning() || force_start)
1753 {
1754 //roof check
1756
1758 SetBurningState(true);
1759 StartHeating();
1760
1761 //Update navmesh
1762 if (!IsFireplaceIndoor())
1763 {
1764 SetAffectPathgraph(false, true);
1765 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(GetGame().UpdatePathgraphRegionByObject, 100, false, this);
1766 }
1767 }
1768
1769 Synchronize();
1770 }
1771
1772 //Start heating
1773 protected void StartHeating()
1774 {
1775 //visual
1776 SetObjectMaterial(0, MATERIAL_FIREPLACE_GLOW);
1777
1778 if (IsWindy() && !IsRoofAbove() && IsOpen() && !IsOven() && !IsBarrelWithHoles())
1779 {
1780 StopFire();
1781 return;
1782 }
1783
1785 {
1786 StopFire(FireplaceFireState.EXTINGUISHED_FIRE);
1787 return;
1788 }
1789
1790 //create area damage
1791 if (IsBaseFireplace() && !IsOven())
1793
1795 m_HeatingTimer.Run(TIMER_HEATING_UPDATE_INTERVAL, this, "Heating", null, true);
1796 m_CookingProcess.SetCookingUpdateTime(TIMER_HEATING_UPDATE_INTERVAL);
1797
1798 //Setup the noise parameters on fire start
1799 m_NoisePar = new NoiseParams();
1800 if (IsRoofAbove() || IsOven() || IsFireplaceIndoor()) //If we have a roof, we are probably inside
1801 m_NoisePar.LoadFromPath("CfgVehicles FireplaceBase NoiseFireplaceSpecial");
1802 else
1803 m_NoisePar.LoadFromPath("CfgVehicles FireplaceBase NoiseFireplaceBase");
1804 }
1805
1806 //Do heating
1807 protected void Heating()
1808 {
1809 float temperature;
1810 float temperatureModifier = 0;
1811
1812 if (IsOpen() && !IsOven())
1814
1815 //check burning conditions
1817 {
1818 StopFire(FireplaceFireState.EXTINGUISHED_FIRE);
1819 return;
1820 }
1821 else
1822 {
1823 if (m_FireConsumables.Count() == 0)
1824 {
1825 StopFire();
1826 return;
1827 }
1828 }
1829
1830 //spend actual fire consumable
1832 SpendFireConsumable(amount);
1833
1834 //set wetness and alter temperature modifier (which will lower temperature increase because of soaking)
1835 float rain = GetGame().GetWeather().GetRain().GetActual();
1836 float combinedWindAndSnowfall = MiscGameplayFunctions.GetCombinedSnowfallWindValue();
1837
1838 if ((rain >= RAIN_EFFECT_LIMIT || combinedWindAndSnowfall >= SNOWFALL_EFFECT_LIMIT) && !IsRoofAbove() && IsOpen() && !IsOven())
1839 {
1840 if (rain > combinedWindAndSnowfall)
1841 {
1843 temperatureModifier = PARAM_TEMPERATURE_DECREASE * rain;
1844 }
1845 else
1846 {
1847 AddWetnessToFireplace(SNOWFALL_WETNESS_INCREASE * combinedWindAndSnowfall);
1848 temperatureModifier = PARAM_TEMPERATURE_DECREASE * combinedWindAndSnowfall;
1849 }
1850 }
1851 //subtract wetness when heating and not raining above
1852 else
1853 {
1855 }
1856
1857 if (m_SurfaceUnderWetnessModifier > 0.0)
1858 AddWetnessToFireplace(m_SurfaceUnderWetnessModifier * WET_SURFACE_INCREMENT);
1859
1860 // FLAT temperature increase
1861 temperature = GetTemperature() + (PARAM_TEMPERATURE_INCREASE * TIMER_HEATING_UPDATE_INTERVAL) - temperatureModifier;
1862 temperature = Math.Clamp(temperature, g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this), m_UTSLFireplace.m_NormalFireplaceTemperatureMax);
1863 SetTemperatureDirect(temperature); //direct heating (non-systematic approach), freezing, overheating, and other stuff inside 'SetTemperatureEx' are therefore UNHANDLED here!
1864 m_UTSLFireplace.SetFuelCount(GetFuelCount()); //legacy reasons
1865 m_UTSLFireplace.SetCurrentTemperature(temperature); //legacy reasons
1867
1868 //get newly changed temperature
1869 temperature = GetTemperature();
1870
1871 //check fire state
1872 if (GetFireState() != FireplaceFireState.EXTINGUISHING_FIRE)
1873 {
1875 }
1876
1877 //damage cargo items
1879
1880 //manage cooking equipment (this applies only for case of cooking pot on a tripod)
1882 {
1884 }
1885
1886 float cookingItemTemperature;
1887 int i;
1888 // manage cooking on direct cooking slots
1890 {
1891 for (i = 0; i < DIRECT_COOKING_SLOT_COUNT; i++)
1892 {
1893 if (m_DirectCookingSlots[i])
1894 {
1895 cookingItemTemperature = m_DirectCookingSlots[i].GetTemperature();
1896 CookOnDirectSlot(m_DirectCookingSlots[i], cookingItemTemperature, temperature);
1897 }
1898 }
1899 }
1900
1901 // manage smoking slots
1902 if (SmokingSlotsInUse())
1903 {
1904 for (i = 0; i < SMOKING_SLOT_COUNT; i++)
1905 {
1906 if (m_SmokingSlots[i])
1907 {
1908 SmokeOnSmokingSlot(m_SmokingSlots[i], cookingItemTemperature, temperature);
1909 }
1910 }
1911 }
1912
1913 //Make noise for AI, only at night
1914 if (GetGame().GetWorld().IsNight() && m_CanNoise)
1915 {
1916 NoiseSystem noise = GetGame().GetNoiseSystem();
1917 if (noise && m_NoisePar)
1918 {
1919 noise.AddNoisePos(this, GetPosition(), m_NoisePar, NoiseAIEvaluate.GetNoiseReduction(GetGame().GetWeather()));
1920 }
1921 m_CanNoise = false;
1922 }
1923 else
1924 m_CanNoise = true;
1925
1926 Synchronize();
1927 }
1928
1929 //Stop the fire process
1930 // 1. start cooling
1931 // 2. cooling
1932 // 3. stop cooling
1934 {
1935 //roof check
1936 if (IsBurning())
1938
1939 StopHeating();
1941 SetBurningState(false);
1942 StartCooling();
1943 SetFireState(fire_state);
1944
1945 //Update navmesh
1946 if (!IsFireplaceIndoor())
1947 {
1948 SetAffectPathgraph(false, false);
1949 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(GetGame().UpdatePathgraphRegionByObject, 100, false, this);
1950 }
1951
1952 Synchronize();
1953 }
1954
1955 protected void StopHeating()
1956 {
1957 if (!m_HeatingTimer)
1958 return;
1959
1960 m_HeatingTimer.Stop();
1961 m_HeatingTimer = null;
1962 }
1963
1964 protected void StartCooling()
1965 {
1966 if (m_HeatingTimer)
1967 {
1968 m_HeatingTimer.Stop();
1969 m_HeatingTimer = null;
1970 }
1971
1972 //Start cooling
1974 m_CoolingTimer.Run(TIMER_COOLING_UPDATE_INTERVAL, this, "Cooling", null, true);
1975 m_CookingProcess.SetCookingUpdateTime(TIMER_COOLING_UPDATE_INTERVAL);
1976 }
1977
1978 protected void Cooling()
1979 {
1980 float temperature = GetTemperature();
1981 float temperatureModifier = 0;
1982
1983 if (IsOpen() && !IsOven())
1985
1986 //should never be true!
1987 if (IsBurning())
1988 {
1989 StopCooling();
1990 return;
1991 }
1992
1993 float target = Math.Max(g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this),10);
1994
1995 if (temperature > target)
1996 {
1997 //set wetness and alter temperature modifier (which will lower temperature increase because of soaking)
1998 float rain = GetGame().GetWeather().GetRain().GetActual();
1999 float combinedWindAndSnowfall = MiscGameplayFunctions.GetCombinedSnowfallWindValue();
2000
2001 if ((rain >= RAIN_EFFECT_LIMIT || combinedWindAndSnowfall >= SNOWFALL_EFFECT_LIMIT) && !IsRoofAbove() && IsOpen() && !IsOven())
2002 {
2003 if (rain > combinedWindAndSnowfall)
2004 {
2006 temperatureModifier = PARAM_TEMPERATURE_DECREASE * rain;
2007 }
2008 else
2009 {
2010 AddWetnessToFireplace(SNOWFALL_WETNESS_INCREASE * combinedWindAndSnowfall);
2011 temperatureModifier = PARAM_TEMPERATURE_DECREASE * combinedWindAndSnowfall;
2012 }
2013 }
2014 else //subtract wetness
2015 {
2017 }
2018
2019 //calculate already obtained wetness (e.g. extinguished by water)
2020 float wetness = GetWet();
2021 temperatureModifier = temperatureModifier + (PARAM_TEMPERATURE_DECREASE * wetness);
2022
2023 // COMBINED temperature decrease
2024 target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
2025 //FLAT for wetness
2026 float flatWetTarget = GetTemperature() - temperatureModifier;
2027 flatWetTarget = Math.Clamp(flatWetTarget,target,GetTemperatureMax());
2028 SetTemperatureDirect(flatWetTarget);
2029 //INTERPOLATED for regular cooling
2030 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_FIREPLACE,TIMER_COOLING_UPDATE_INTERVAL,GameConstants.TEMP_COEF_FIREPLACE_COOLING));
2031 m_UTSLFireplace.SetFuelCount(GetFuelCount());
2032 m_UTSLFireplace.UpdateFireplaceTemperature(m_UTSSettings);
2034
2035 //get newly changed temperature
2036 temperature = GetTemperature();
2037
2038 //damage cargo items
2040
2041 //cook with equipment if temperature of equipment is still high
2043 {
2044 float cookEquipTemp = m_CookingEquipment.GetTemperature();
2045
2046 if (cookEquipTemp >= PARAM_COOKING_TEMP_THRESHOLD)
2047 {
2048 //cook
2050 }
2051 }
2052
2053 float cookingItemTemperature;
2054 int i;
2055
2056 // manage cooking on direct cooking slots
2058 {
2059 for (i = 0; i < DIRECT_COOKING_SLOT_COUNT; i++)
2060 {
2061 if (m_DirectCookingSlots[i])
2062 CookOnDirectSlot(m_DirectCookingSlots[i], cookingItemTemperature, temperature);
2063 }
2064 }
2065
2066 // manage smoking slots
2067 if (SmokingSlotsInUse())
2068 {
2069 for (i = 0; i < SMOKING_SLOT_COUNT; i++)
2070 {
2071 if (m_SmokingSlots[i])
2072 SmokeOnSmokingSlot(m_SmokingSlots[i], cookingItemTemperature, temperature);
2073 }
2074 }
2075 }
2076 else
2077 {
2078 StopCooling();
2079 }
2080 }
2081
2082 protected void StopCooling()
2083 {
2084 //stop all fire visuals
2086 SetObjectMaterial(0, MATERIAL_FIREPLACE_NOGLOW);
2087
2088 //Stop cooling
2089 m_CoolingTimer.Stop();
2090 m_CoolingTimer = NULL;
2091
2092 //destroy area damage
2094
2095 //remove cookware audio visuals
2096 ItemBase cookware;
2097 if (Class.CastTo(cookware,GetCookingEquipment()) && (cookware.IsCookware() || cookware.IsLiquidContainer())) //also stops boiling effects on bottles
2098 cookware.RemoveAudioVisualsOnClient();
2099
2101 {
2102 for (int i = 0; i < DIRECT_COOKING_SLOT_COUNT; i++)
2103 {
2104 if (m_DirectCookingSlots[i])
2105 {
2106 if (Class.CastTo(cookware,m_DirectCookingSlots[i]) && (cookware.IsCookware() || cookware.IsLiquidContainer())) //also stops boiling effects on bottles
2107 cookware.RemoveAudioVisualsOnClient();
2108
2109 Edible_Base itsfood = Edible_Base.Cast(m_DirectCookingSlots[i]);
2110 if (itsfood)
2111 itsfood.MakeSoundsOnClient(false);
2112
2113 GameInventory inv = m_DirectCookingSlots[i].GetInventory();
2114 if (!inv)
2115 return;
2116
2117 CargoBase cargo = inv.GetCargo();
2118 if (!cargo) // cookware
2119 return;
2120
2121 for (int j = 0; j < cargo.GetItemCount(); j++)
2122 {
2123 Edible_Base edible = Edible_Base.Cast(cargo.GetItem(j));
2124 if (edible)
2125 edible.MakeSoundsOnClient(false);
2126 }
2127 }
2128 }
2129 }
2130 }
2131
2132 //================================================================
2133 // COOKING
2134 //================================================================
2135 protected void CookWithEquipment()
2136 {
2137 if (m_CookingProcess == null)
2138 m_CookingProcess = new Cooking();
2139
2140 m_CookingProcess.CookWithEquipment(m_CookingEquipment);
2141 }
2142
2144 {
2145 if (m_CookingProcess == null)
2146 m_CookingProcess = new Cooking();
2147
2148 return m_CookingProcess;
2149 }
2150
2151 protected void CookOnDirectSlot(ItemBase slot_item, float temp_equip, float temp_ext)
2152 {
2153 if (m_CookingProcess == null)
2154 m_CookingProcess = new Cooking();
2155
2156 m_CookingProcess.CookWithEquipment(slot_item);
2157 }
2158
2159 protected void SmokeOnSmokingSlot(ItemBase slot_item, float temp_equip, float temp_ext)
2160 {
2161 if (m_CookingProcess == NULL)
2162 m_CookingProcess = new Cooking();
2163
2164 // smoking slots accept only individual meat/fruit/veg items
2165 Edible_Base ingr = Edible_Base.Cast(slot_item);
2166 if (ingr)
2167 m_CookingProcess.SmokeItem(ingr, FireplaceBase.TIMER_HEATING_UPDATE_INTERVAL * FireplaceBase.SMOKING_SPEED);
2168 }
2169
2170 //================================================================
2171 // FIRE VICINITY
2172 //================================================================
2173 //apply damage to all items, raise temperature to only specific items
2174 protected void BurnItemsInFireplace()
2175 {
2177 CargoBase cargo = GetInventory().GetCargo();
2178 for (int i = 0; i < cargo.GetItemCount(); i++)
2179 {
2180 ItemBase item = ItemBase.Cast(cargo.GetItem(i));
2181
2182 //add temperature
2184
2185 //set damage
2186 AddDamageToItemByFireEx(item, false, false);
2187
2188 //remove wetness
2190 }
2191
2193 for (int j = 0; j < GetInventory().AttachmentCount(); ++j)
2194 {
2195 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(j));
2196
2197 //add temperature
2198 AddTemperatureToItemByFire(attachment);
2199
2200 //set damage
2201 AddDamageToItemByFireEx(attachment, false, true);
2202
2203 //remove wetness
2205 }
2206 }
2207
2208 //moves temperature of the item to the fire temperature (can cool down item!)
2210 {
2211 if (item.CanHaveTemperature())
2212 {
2213 float fireplaceTemp = GetTemperature();
2214 float itemTemp = item.GetTemperature();
2215 float heatPermCoef = item.GetHeatPermeabilityCoef();
2216 float tempCoef;
2217 float deltaTime;
2218
2219 if (m_HeatingTimer && m_HeatingTimer.IsRunning())
2220 {
2222 tempCoef = GameConstants.TEMP_COEF_FIREPLACE_HEATING;
2223 }
2224 else if (m_CoolingTimer && m_CoolingTimer.IsRunning())
2225 {
2227 tempCoef = GameConstants.TEMP_COEF_FIREPLACE_COOLING;
2228 }
2229 else
2230 {
2231 return;
2232 }
2233
2234 item.SetTemperatureEx(new TemperatureDataInterpolated(fireplaceTemp,ETemperatureAccessTypes.ACCESS_FIREPLACE,deltaTime,tempCoef,heatPermCoef));
2235 }
2236 }
2237
2239 protected void AddTemperatureToFireplace(float amount) {};
2240
2241 //add damage to item by fire
2242 protected void AddDamageToItemByFireEx(ItemBase item, bool can_be_ruined, bool pAttachment)
2243 {
2244 if (!item)
2245 return;
2246
2248 if (!pAttachment)
2249 {
2251 GameInventory itemInventory = item.GetInventory();
2252 if (itemInventory)
2253 {
2254 array<EntityAI> entities = new array<EntityAI>();
2255 itemInventory.EnumerateInventory(InventoryTraversalType.INORDER, entities);
2256 foreach (EntityAI ent : entities)
2257 {
2258 if (ent != this)
2259 {
2260 ent.DecreaseHealth(PARAM_BURN_DAMAGE_COEF,!ent.IsKindOf("Grenade_Base"));
2261 }
2262 }
2263 }
2264 }
2265 else //direct attachments
2266 {
2267 float timerCoef = 1.0;
2268 if (m_HeatingTimer && m_HeatingTimer.IsRunning())
2270 else if (m_CoolingTimer && m_CoolingTimer.IsRunning())
2272
2273 switch (item.Type())
2274 {
2275 case ATTACHMENT_TRIPOD:
2277 item.DecreaseHealth(GameConstants.FIRE_ATTACHMENT_DAMAGE_PER_SECOND * timerCoef, false);
2278 break;
2279 }
2280
2281 if (item.IsCookware())
2282 {
2283 item.DecreaseHealth(GameConstants.FIRE_ATTACHMENT_DAMAGE_PER_SECOND * timerCoef, false);
2284 }
2285
2287 if (IsFuel(item) || IsKindling(item))
2288 {
2289 if (item.GetHealthLevel() < GameConstants.STATE_BADLY_DAMAGED)
2290 item.DecreaseHealth(PARAM_BURN_DAMAGE_COEF, false);
2291 }
2292 }
2293 }
2294
2295 //add wetness on item
2296 protected void AddWetnessToItem(ItemBase item, float amount)
2297 {
2298 float wetness = item.GetWet();
2299 wetness = wetness + amount;
2300 wetness = Math.Clamp(wetness, 0, 1); //wetness <0-1>
2301 item.SetWet(wetness);
2302 }
2303
2304 //add wetness on fireplace
2305 void AddWetnessToFireplace(float amount)
2306 {
2307 //add wetness
2308 float wetness = GetWet();
2309 wetness = wetness + amount;
2310 wetness = Math.Clamp(wetness, 0, 1); //wetness <0-1>
2311 SetWet(wetness);
2312
2313 //decrease temperature
2314 if (amount > 0)
2315 {
2316 float temperature = GetTemperature();
2317 temperature = temperature * (1 - (wetness * 0.5));
2318 temperature = Math.Clamp(temperature, PARAM_MIN_FIRE_TEMPERATURE, PARAM_NORMAL_FIRE_TEMPERATURE);
2319 SetTemperatureDirect(temperature);
2320 m_UTSLFireplace.SetFuelCount(GetFuelCount()); //legacy reasons
2321 m_UTSLFireplace.SetCurrentTemperature(temperature); //legacy reasons
2322 }
2323 }
2324
2326 protected void TransferHeatToNearPlayers() {}
2327
2328 //Create and Destroy damage radius around the fireplace when starting/stopping burning process
2330 {
2331 //destroy area damage if some already exists
2333
2334 //create new area damage
2336 m_AreaDamage.SetDamageComponentType(AreaDamageComponentTypes.HITZONE);
2337 m_AreaDamage.SetExtents("-0.30 0 -0.30", "0.30 0.75 0.30");
2338 m_AreaDamage.SetLoopInterval(0.5);
2339 m_AreaDamage.SetDeferDuration(0.5);
2340 m_AreaDamage.SetHitZones({ "Head","Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" });
2341 m_AreaDamage.SetAmmoName("FireDamage");
2342 m_AreaDamage.Spawn();
2343 }
2344
2346 {
2347 if (m_AreaDamage)
2348 {
2349 m_AreaDamage.Destroy();
2350 }
2351 }
2352
2355 {
2356 ErrorEx("Deprecated method", ErrorExSeverity.INFO);
2357
2358 return false;
2359 }
2360
2361 //================================================================
2362 // ACTIONS
2363 //================================================================
2364 // --- Actions / Action conditions
2365 //Check if there is some kindling attached
2367 {
2368 return GetKindlingCount() > 0;
2369 }
2370
2371 //Check if the weather is too windy
2372 static bool IsWindy()
2373 {
2374 //check wind
2375 float wind_speed = GetGame().GetWeather().GetWindSpeed();
2376 float wind_speed_threshold = GetGame().GetWeather().GetWindMaximumSpeed() * FireplaceBase.IGNITE_WIND_THRESHOLD;
2377
2378 return (wind_speed >= wind_speed_threshold);
2379 }
2380
2382 {
2383 return m_NoIgnite;
2384 }
2385
2386 void SetIgniteFailure(bool failure)
2387 {
2388 m_NoIgnite = failure;
2389 }
2390
2391 //Check if the fireplace is too wet to be ignited
2392 static bool IsEntityWet(notnull EntityAI entity_ai)
2393 {
2394 return (entity_ai.GetWet() >= FireplaceBase.PARAM_MAX_WET_TO_IGNITE);
2395 }
2396
2397 bool IsWet()
2398 {
2399 return FireplaceBase.IsEntityWet(this);
2400 }
2401
2402 //check if fireplace is opened
2403 override bool IsOpen()
2404 {
2405 return true;
2406 }
2407
2408 //Check if there is enough space for smoke
2410 {
2411 return !MiscGameplayFunctions.IsUnderRoof(this, FireplaceBase.MIN_CEILING_HEIGHT);
2412 }
2413
2414 //Check if it's raining and there is only sky above fireplace
2415 static bool IsRainingAboveEntity(notnull EntityAI entity_ai)
2416 {
2417 return (GetGame() && (GetGame().GetWeather().GetRain().GetActual() >= FireplaceBase.PARAM_IGNITE_RAIN_THRESHOLD));
2418 }
2419
2421 {
2422 return FireplaceBase.IsRainingAboveEntity(this);
2423 }
2424
2425 //Check there is water surface bellow fireplace
2426 static bool IsEntityOnWaterSurface(notnull EntityAI entity_ai)
2427 {
2428 vector fireplacePosition = entity_ai.GetPosition();
2429 string surfaceType;
2430 g_Game.SurfaceGetType3D(fireplacePosition[0], fireplacePosition[1] + g_Game.SurfaceGetSeaLevel(), fireplacePosition[2], surfaceType);
2431 if (!surfaceType)
2432 {
2433 float waterLevelDiff = fireplacePosition[1] - g_Game.SurfaceGetSeaLevel();
2434 return waterLevelDiff < 0.5;
2435 }
2436 else if (surfaceType.Contains("water"))
2437 {
2438 return true;
2439 }
2440
2441 return false;
2442 }
2443
2444 protected float GetSurfaceWetnessOnHeatModifier(notnull EntityAI entity)
2445 {
2446 string surfaceType
2447 int liquidType;
2448 g_Game.SurfaceUnderObjectCorrectedLiquid(entity, surfaceType, liquidType);
2449
2450 return Surface.GetParamFloat(surfaceType, "wetnessOnHeatModifier");
2451 }
2452
2454 {
2455 return FireplaceBase.IsEntityOnWaterSurface(this);
2456 }
2457
2458 //check if the surface is interior
2459 static bool IsEntityOnInteriorSurface(notnull EntityAI entity_ai)
2460 {
2461 string surfaceType;
2462 vector fireplacePosition = entity_ai.GetPosition();
2463 GetGame().SurfaceGetType3D(fireplacePosition[0], fireplacePosition[1] + 1.0, fireplacePosition[2], surfaceType);
2464 return (GetGame().ConfigGetInt("CfgSurfaces " + surfaceType + " interior") == 1);
2465 }
2467 {
2468 return FireplaceBase.IsEntityOnInteriorSurface(this);
2469 }
2470
2471 //Checks if has not additional items in it
2472 override bool IsEmpty()
2473 {
2474 return (GetInventory().GetCargo().GetItemCount() == 0 && GetInventory().AttachmentCount() == 0);
2475 }
2476
2477 //Checks if it has no items in cargo
2479 {
2480 return (GetInventory().GetCargo().GetItemCount() == 0);
2481 }
2482
2484 {
2485 return GetInventory().FindAttachment(InventorySlots.GetSlotIdFromString("CookingTripod")) != null;
2486 }
2487
2488 //Check if object is in animation phase
2489 bool IsInAnimPhase(string anim_phase)
2490 {
2491 return GetAnimationPhase(anim_phase) == 0;
2492 }
2493
2495 {
2496 array<Object> objs = {};
2497 if (GetGame().IsBoxCollidingGeometry(GetWorldPosition() + Vector(0, size[1] * 0.5 + 0.1, 0), GetDirection().VectorToAngles(), size, ObjIntersect.View, ObjIntersect.Geom, {this}, objs))
2498 {
2499 foreach (Object obj : objs)
2500 {
2501 if (dBodyGetInteractionLayer(obj) == PhxInteractionLayers.ITEM_LARGE)
2502 return false;
2503 }
2504 }
2505 return true;
2506 }
2507
2508
2509 override bool CanSwapEntities(EntityAI otherItem, InventoryLocation otherDestination, InventoryLocation destination)
2510 {
2511 if (!otherDestination || otherDestination.GetParent() == this)
2512 {
2513 return false;
2514 }
2515 return true;
2516 }
2517
2518 override bool CanPutIntoHands(EntityAI parent)
2519 {
2520 if (!super.CanPutIntoHands(parent))
2521 {
2522 return false;
2523 }
2524
2525 return GetTemperature() <= GameConstants.STATE_HOT_LVL_ONE; //say 'no' to 3rd degree burns!
2526 }
2527
2528 //Action condition for building oven
2530 {
2531 return !IsOven() && !IsBurning() && (GetAttachedStonesCount() >= MIN_STONES_TO_BUILD_OVEN) && !FindAttachmentBySlotName("CookingTripod") && !HasStoneCircle() && IsSpaceForOven();
2532 }
2533
2535 {
2536 const float size = 0.6;
2537 return IsSpaceFor(Vector(size, size, size));
2538 }
2539
2540 //Action condition for stone circle
2545
2547 {
2548 return IsSpaceFor(Vector(0.9, 0.1, 0.9));
2549 }
2550
2551 //Action condition for dismantling oven
2556 //Action condition for dismantling stone circle
2558 {
2559 return (HasStoneCircle() && !IsOven() && !IsBurning());
2560 }
2561
2563 {
2565 }
2566
2567 //Can extinguish fire
2569 {
2570 return IsBurning();
2571 }
2572
2573 FireplaceLight GetLightEntity()
2574 {
2575 return m_Light;
2576 }
2577
2578 void SetLightEntity(FireplaceLight light)
2579 {
2580 m_Light = light;
2581 }
2582
2583 //================================================================
2584 // ADVANCED PLACEMENT
2585 //================================================================
2586 override bool CanBePlaced( Man player, vector position )
2587 {
2588 string surfaceType;
2589 float surfaceHeight = GetGame().SurfaceGetType3D( position[0], position[1], position[2], surfaceType );
2590 if ((position[1] - surfaceHeight) > PLACEMENT_HEIGHT_LIMIT)
2591 return false;
2592
2593 return true;
2594 }
2595
2596 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
2597 {
2598 super.OnPlacementComplete(player, position, orientation);
2599
2600 if (GetGame().IsServer())
2601 {
2602 //remove grass
2603 Object cc_object = GetGame().CreateObjectEx(OBJECT_CLUTTER_CUTTER , position, ECE_PLACE_ON_SURFACE);
2604 cc_object.SetOrientation(orientation);
2605 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(GetGame().ObjectDelete, 1000, false, cc_object);
2606 }
2607 }
2608
2609 override string GetDeploySoundset()
2610 {
2611 return "placeFireplace_SoundSet";
2612 }
2613
2614 //================================================================
2615 // QUANITTY
2616 //================================================================
2617 // calculates and sets total energy based on possible (fuel/kinidling) item attachments
2618 protected void CalcAndSetTotalEnergy()
2619 {
2620 if (GetGame() && GetGame().IsServer())
2621 {
2622 m_TotalEnergy = 0;
2623
2624 foreach (FireConsumableType fireConsumableType : m_FireConsumableTypes)
2625 {
2626 string quantityConfigPath = string.Format("CfgVehicles %1 varQuantityMax", fireConsumableType.GetItemType().ToString());
2627 string stackMaxConfigPath = string.Format("CfgSlots Slot_%1 stackMax", fireConsumableType.GetAttSlot());
2628 if (GetGame().ConfigIsExisting(quantityConfigPath))
2629 {
2630 float quantityMax = GetGame().ConfigGetFloat(quantityConfigPath);
2631 }
2632
2633 if (GetGame().ConfigIsExisting(stackMaxConfigPath))
2634 {
2635 float stackMax = GetGame().ConfigGetFloat(stackMaxConfigPath);
2636 }
2637
2638 //debug
2639 //Print(fireConsumableType.GetItemType().ToString() + " quantityMax = " + quantityMax.ToString() + " [" + (quantity_max*fire_consumable_type.GetEnergy()).ToString() + "] | stack_max = " + stack_max.ToString() + " [" + (stack_max*fire_consumable_type.GetEnergy()).ToString() + "]");
2640
2641 if (stackMax > 0)
2642 {
2643 m_TotalEnergy += stackMax * fireConsumableType.GetEnergy();
2644 }
2645 else
2646 {
2647 m_TotalEnergy += quantityMax * fireConsumableType.GetEnergy();
2648 }
2649 }
2650
2651 //debug
2652 //Print("Total energy = " + m_TotalEnergy.ToString());
2653 }
2654 }
2655
2656 // calculates and sets current quantity based on actual (fuel/kinidling) item attachments
2657 protected void CalcAndSetQuantity()
2658 {
2659 if (GetGame() && GetGame().IsServer())
2660 {
2661 float remainingEnergy;
2662
2663 foreach (FireConsumable fireConsumable : m_FireConsumables)
2664 {
2665 float quantity = fireConsumable.GetItem().GetQuantity();
2666 if (quantity > 0)
2667 {
2668 remainingEnergy += ((quantity - 1) * fireConsumable.GetEnergy()) + fireConsumable.GetRemainingEnergy();
2669 //Print(fireConsumable.GetItem().GetType() + " remaining energy = " + (((quantity - 1) * fire_consumable.GetEnergy()) + fire_consumable.GetRemainingEnergy()).ToString());
2670 }
2671 else
2672 {
2673 remainingEnergy += fireConsumable.GetRemainingEnergy();
2674 //Print(fireConsumable.GetItem().GetType() + " remaining energy = " + (fireConsumable.GetRemainingEnergy().ToString()));
2675 }
2676 }
2677
2678 SetQuantity(remainingEnergy / m_TotalEnergy * GetQuantityMax());
2679 }
2680 }
2681
2683 {
2684 super.OnAttachmentQuantityChanged(item);
2685
2687 }
2688
2689 override bool CanReleaseAttachment(EntityAI attachment)
2690 {
2691 if (!super.CanReleaseAttachment(attachment))
2692 return false;
2693
2694 ItemBase item = ItemBase.Cast(attachment);
2695 if (IsKindling(item) || IsFuel(item))
2696 {
2697 return !IsBurning();
2698 }
2699
2700 return true;
2701 }
2702
2703 void LockOvenAttachments(bool lock)
2704 {
2705 //Print("LockOvenAttachments");
2706 //string path_cooking_equipment = "" + CFG_VEHICLESPATH + " " + GetType() + " GUIInventoryAttachmentsProps CookingEquipment attachmentSlots";
2707 string path_cooking_equipment = string.Format("%1 %2 GUIInventoryAttachmentsProps CookingEquipment attachmentSlots", CFG_VEHICLESPATH, GetType());
2708 //string path_direct_cooking = "" + CFG_VEHICLESPATH + " " + GetType() + " GUIInventoryAttachmentsProps DirectCooking attachmentSlots";
2709 string path_direct_cooking = string.Format("%1 %2 GUIInventoryAttachmentsProps DirectCooking attachmentSlots", CFG_VEHICLESPATH, GetType());
2710 if (GetGame().ConfigIsExisting(path_cooking_equipment) && GetGame().ConfigIsExisting(path_direct_cooking))
2711 {
2712 array<string> arr_cooking_equipment = new array<string>;
2713 array<string> arr_direct_cooking = new array<string>;
2714 GetGame().ConfigGetTextArray(path_cooking_equipment,arr_cooking_equipment);
2715 GetGame().ConfigGetTextArray(path_direct_cooking,arr_direct_cooking);
2716 for (int i = 0; i < arr_cooking_equipment.Count(); i++)
2717 {
2718 if (lock != GetInventory().GetSlotLock(InventorySlots.GetSlotIdFromString(arr_cooking_equipment[i])))
2719 {
2720 GetInventory().SetSlotLock(InventorySlots.GetSlotIdFromString(arr_cooking_equipment[i]),lock);
2721 //Print("attachment lock: " + arr_cooking_equipment[i] + " " + lock);
2722 }
2723 }
2724
2725 for (i = 0; i < arr_direct_cooking.Count(); i++)
2726 {
2727 if (lock == GetInventory().GetSlotLock(InventorySlots.GetSlotIdFromString(arr_direct_cooking[i])))
2728 {
2729 GetInventory().SetSlotLock(InventorySlots.GetSlotIdFromString(arr_direct_cooking[i]),!lock);
2730 //Print("attachment lock: " + arr_direct_cooking[i] + " " + !lock);
2731 }
2732 }
2733 }
2735 }
2737 {
2738 return true;
2739 }
2740
2741 override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
2742 {
2743 super.OnRPC(sender, rpc_type, ctx);
2744
2745 ref Param1<bool> p = new Param1<bool>(false);
2746
2747 if (ctx.Read(p))
2748 {
2749 bool failure = p.param1;
2750 }
2751
2752 switch (rpc_type)
2753 {
2754 case FirePlaceFailure.WIND:
2755
2756 if (failure)
2757 {
2759 SoundFireStop();
2761 }
2762
2763 break;
2764
2765 case FirePlaceFailure.WET:
2766
2767 if (failure)
2768 {
2770 SoundFireStop();
2772 }
2773
2774 break;
2775 }
2776 }
2777
2778 //================================================================
2779 // DEBUG
2780 //================================================================
2781
2782 //Debug menu Spawn Ground Special
2783 override void OnDebugSpawn()
2784 {
2785 ItemBase firewood = ItemBase.Cast(GetInventory().CreateInInventory("Firewood"));
2786 firewood.SetQuantity(firewood.GetQuantityMax());
2787
2788 ItemBase sticks = ItemBase.Cast(GetInventory().CreateInInventory("WoodenStick"));
2789 sticks.SetQuantity(sticks.GetQuantityMax());
2790
2791 ItemBase stone = ItemBase.Cast(GetInventory().CreateInInventory("Stone"));
2792 stone.SetQuantity(stone.GetQuantityMax());
2793
2794 GetInventory().CreateInInventory("Rag");
2795
2796 SpawnEntityOnGroundPos("PetrolLighter", GetPosition());
2797 }
2798
2799 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2800 {
2801 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ACTIVATE_ENTITY, "Ignite", FadeColors.LIGHT_GREY));
2802 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DEACTIVATE_ENTITY, "Extinguish", FadeColors.LIGHT_GREY));
2803 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
2804
2805 super.GetDebugActions(outputList);
2806 }
2807
2808 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
2809 {
2810 if (super.OnAction(action_id, player, ctx))
2811 return true;
2812 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
2813 {
2814 if (action_id == EActions.ACTIVATE_ENTITY)
2815 {
2816 OnIgnitedThis(null);
2817 }
2818 else if (action_id == EActions.DEACTIVATE_ENTITY)
2819 {
2820 StopFire();
2821 }
2822 }
2823 return false;
2824 }
2825
2827 //DEPRECATED STUFF BELOW//
2835 const float TEMPERATURE_LOSS_MP_STONES = 0.90; //10% boost
2836 const float TEMPERATURE_LOSS_MP_OVEN = 0.75; //25% boost
2839 const float DIRECT_COOKING_SPEED = 1.5; // per second
2840 const float PARAM_WET_INCREASE_COEF = 0.02;
2841
2842 protected float m_TemperatureLossMP = 1.0;
2843
2844 //Temperature loss MP
2845 protected float GetTemperatureLossMP()
2846 {
2847 return m_TemperatureLossMP;
2848 }
2849
2850 protected void SetTemperatureLossMP(float value)
2851 {
2852 m_TemperatureLossMP = value;
2853 }
2854
2855 // DEPRECATED
2856 protected void AddDamageToItemByFire(ItemBase item, bool can_be_ruined)
2857 {
2858 AddDamageToItemByFireEx(item,can_be_ruined,false);
2859 }
2860
2864}
Param4< int, int, string, int > TSelectableActionInfoWithColor
Definition entityai.c:97
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition inventory.c:22
eBleedingSourceType GetType()
ref NoiseParams m_NoisePar
override bool IsSelfAdjustingTemperature()
Definition animalbase.c:59
const int ECE_PLACE_ON_SURFACE
float quantityMax
Deferred version of AreaDamageLooped.
proto float SurfaceGetType3D(float x, float y, float z, out string type)
Y input: Maximum Y to trace down from; Returns: Y position the surface was found.
proto native Weather GetWeather()
Returns weather controller object.
represents base for cargo storage for entities
Definition cargo.c:7
Super root of all classes in Enforce script.
Definition enscript.c:11
Wrapper class for managing sound through SEffectManager.
Definition effectsound.c:5
override bool IsOpen()
override bool CanExtinguishFire()
void InitializeTemperatureSources()
override bool CanCookOnStick()
override bool IsBaseFireplace()
override void RefreshFireplacePhysics()
Definition fireplace.c:495
vector GetSmokeEffectPosition()
Definition ovenindoor.c:139
override void EEItemAttached(EntityAI item, string slot_name)
override void ParticleSmallSmokeStart()
Definition ovenindoor.c:145
override bool IsPrepareToDelete()
override void SetCookingEquipment(ItemBase equipment)
Definition fireplace.c:340
override bool CanPutIntoHands(EntityAI parent)
override bool CanShowSmoke()
override void ParticleNormalSmokeStart()
Definition ovenindoor.c:151
override bool IsIndoorOven()
Definition ovenindoor.c:159
override void OnDebugSpawn()
override void OnIgnitedThis(EntityAI fire_source)
override void CreateAreaDamage()
override void OnVariablesSynchronized()
override void AfterStoreLoad()
Definition fireplace.c:538
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnStoreSave(ParamsWriteContext ctx)
override string GetDeploySoundset()
override bool IsBarrelWithHoles()
override bool CanReleaseAttachment(EntityAI attachment)
Definition fireplace.c:183
script counterpart to engine's class Inventory
Definition inventory.c:79
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
InventoryLocation.
provides access to slot configuration
Definition enmath.c:7
Legacy way of using particles in the game.
Definition particle.c:7
The class that will be instanced (moddable)
Definition gameplay.c:389
Definition pot.c:2
Serialization general interface. Serializer API works with:
Definition serializer.c:56
original Timer deletes m_params which is unwanted
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
void Synchronize()
Container_Base m_HalfExtents
ContaminatedArea_Base EffectArea EEInit()
override void EEDelete(EntityAI parent)
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Definition dayzanimal.c:136
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Definition dayzanimal.c:125
DayZGame g_Game
Definition dayzgame.c:3868
PhxInteractionLayers
Definition dayzphysics.c:2
EActions
Definition eactions.c:2
float GetTemperature()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
float GetAirResistanceForSmokeParticles(float actual_height)
void TransferHeatToNearPlayers()
DEPRECATED.
const int MAX_TEMPERATURE_TO_DISMANTLE_OVEN
minimum amount of stones for oven
void RefreshFireplaceVisuals()
float GetFuelBurnRateMP()
void RemoveFromFireConsumables(FireConsumable fire_consumable)
ATTACHMENT_FIREWOOD
override void OnChildItemRemoved(InventoryItem item)
ref UniversalTemperatureSourceSettings m_UTSSettings
float m_FuelBurnRateMP
const string MESSAGE_BURY_ASHES_FAILED_BURNING
int m_OvenAttachmentsLockState
ItemBase GetCookingEquipment()
const string SOUND_FIRE_EXTINGUISHING
bool m_NoIgnite
bool CanBuildStoneCircle()
Particle m_ParticleSmallFire
bool HasAnyKindling()
const float TEMPERATURE_LOSS_MP_OVEN
void AddDamageToItemByFire(ItemBase item, bool can_be_ruined)
void ParticleSteamExtinguishingStop()
bool SmokingSlotsInUse()
void ParticleWetNoIgniteStart()
const float WET_SURFACE_INCREMENT
const float PARAM_HEAT_THROUGH_AIR_COEF
maximum value of temperature of items in fireplace when heating (degree Celsius)
bool DirectCookingSlotsInUse()
FireConsumable GetItemToConsume()
override void CheckForDestroy()
ATTACHMENT_BARK_OAK
const string ANIMATION_OVEN
const int DIRECT_COOKING_SLOT_COUNT
direct cooking slots
const int TIMER_HEATING_UPDATE_INTERVAL
timer constants
Object m_ClutterCutter
Particle m_ParticleFireStart
void ParticleSmallFireStart()
void SoundFireLightStart()
void LockOvenAttachments(bool lock)
void AddTemperatureToItemByFire(ItemBase item)
void ParticleNormalFireStop()
void ParticleSteamEndStart()
Particle m_ParticleSmallSmoke
ATTACHMENT_FRYING_PAN
const string MESSAGE_IGNITE_NO_KINDLING
const int TIMER_COOLING_UPDATE_INTERVAL
update interval duration of heating process (seconds)
const float PARAM_ITEM_HEAT_TEMP_HEATING_COEF
value for calculating temperature increase on each heat update interval (degree Celsius)
ATTACHMENT_CAULDRON
const string MESSAGE_IGNITE_IN_WATER
ATTACHMENT_STICKS
float m_LightDistance
ref UnderObjectDecalSpawnSettings m_UnderObjectDecalSpawnSettings
const float PARAM_TEMPERATURE_DECREASE
how much will temperature increase when fireplace is burning (degree Celsius per second)
const float PARAM_TEMPERATURE_INCREASE
minimum fireplace temperature under which the fireplace is inactive (degree Celsius)
bool IsProcessing()
returns true when FP is heating or cooling
const float PARAM_FIRE_CONSUM_RATE_AMOUNT
value for calculating wetness loss during cooling process
const string MESSAGE_REIGNITE_RAIN
const int LIFETIME_FIREPLACE_STONE_CIRCLE
int PARTICLE_STEAM_EXTINGUISHING
const string SOUND_FIRE_HEAVY
const string MESSAGE_BURY_ASHES_FAILED_NOT_EMPTY
Particle m_ParticleNormalFire
bool IsSpaceForOven()
const float TEMPERATURE_LOSS_MP_DEFAULT
DEPRECATED value for calculation of heat transfered from fireplace through air to player (environment...
const string SOUND_FIRE_LIGHT
void SoundFireExtinguishedStart()
enum FireplaceFireState m_IsBurning
bool IsCeilingHighEnoughForSmoke()
override bool IsFireplace()
const string MESSAGE_IGNITE_IGNIT_ITEM_DAMAGED
void AddToFireConsumables(ItemBase item)
const string MESSAGE_IGNITE_RAIN
void StartCooling()
void ParticleSteamExtinguishingStart()
EffectSound m_SoundFireLoop
int PARTICLE_STEAM_END
const float PARAM_ITEM_HEAT_MIN_TEMP
void ~FireplaceBase()
bool m_HasStoneCircle
const float PLACEMENT_HEIGHT_LIMIT
FireplaceFireState m_FireState
const float PARAM_MIN_TEMP_TO_REIGNITE
maximum wetness value when the fireplace can be ignited
void SoundFireStop()
ATTACHMENT_PUNCHEDCARD
void DestroyFireplace()
[DEPRECATED]
void SetFuelBurnRateMP(float value)
ATTACHMENT_EYEMASK_COLORBASE
bool HasCookingStand()
bool CanBuildOven()
int PARTICLE_NORMAL_FIRE
void SetAshesState(bool has_ashes)
ATTACHMENT_BANDAGE
void Heating()
void StopCooling()
bool IsOnWaterSurface()
const string MESSAGE_CANNOT_DISMANTLE_OVEN
void StopFire(FireplaceFireState fire_state=FireplaceFireState.END_FIRE)
ref Cooking m_CookingProcess
determines how fast will the fuel item burn before spending (lower is better)
const string OBJECT_CLUTTER_CUTTER
const string ANIMATION_CAULDRON_HANDLE
bool HasAshes()
ATTACHMENT_BOOK
void BurnItemsInFireplace()
bool IsRainingAbove()
void Cooling()
Particle m_ParticleSteamExtinguishing
void SoundFireHeavyStart()
const float DIRECT_COOKING_SPEED
how much will temperature increase when attached on burning fireplace (degree Celsius)
const int LIFETIME_FIREPLACE_STONE_OVEN
ATTACHMENT_GIFTWRAP
ATTACHMENT_RAGS
const float PARAM_MAX_TRANSFERED_TEMPERATURE
radius in which objects are heated by fire
override void OnAttachmentRuined(EntityAI attachment)
int PARTICLE_NO_IGNITE_WIND
FireplaceFireState m_LastFireState
override bool CanBePlaced(Man player, vector position)
const string ANIMATION_TRIPOD
ref UnderObjectDecalSpawnComponent m_UnderObjectDecalSpawnComponent
void SetFireState(FireplaceFireState state)
const int MIN_STONES_TO_BUILD_OVEN
minimum amount of stones for circle
const float PARAM_HEAT_RADIUS
radius in which objects are fully heated by fire
FireplaceLight GetLightEntity()
void CalcAndSetQuantity()
const string MESSAGE_IGNITE_WIND
const float TEMPERATURE_LOSS_MP_STONES
const string MATERIAL_FIREPLACE_GLOW
const string SOUND_FIRE_EXTINGUISHED
bool HasStones()
void StartHeating()
const string ANIMATION_ASHES
const float PARAM_NORMAL_FIRE_TEMPERATURE
maximum fireplace temperature of a small fire (degree Celsius)
bool CanDismantleStoneCircle()
void CookOnDirectSlot(ItemBase slot_item, float temp_equip, float temp_ext)
int PARTICLE_FIRE_START
void SetBurntFirewood()
DEPRECATED.
const string MESSAGE_IGNITE_UNDER_LOW_ROOF
const float PARAM_MIN_FIRE_TEMPERATURE
maximum fireplace temperature of an outdoor fire (degree Celsius)
void CookWithEquipment()
bool IsInAnimPhase(string anim_phase)
const float MIN_CEILING_HEIGHT
maximum temperature for dismantling oven
const float PARAM_BURN_DAMAGE_COEF
base value of fire consumption rate (how many base energy will be spent on each update)
const float PARAM_MAX_ITEM_HEAT_TEMP_INCREASE
multiplies temperature change on heating
const string MATERIAL_FIREPLACE_NOGLOW
void StopHeating()
void SpendFireConsumable(float amount)
bool IsSpaceForCircle()
void ParticleNormalSmokeStop()
ref Timer m_CoolingTimer
bool IsCargoEmpty()
const string ANIMATION_INVENTORY
bool IsFuel(ItemBase item)
Returns if item attached to fireplace is fuel.
float GetTemperatureLossMP()
determines how fast will the fireplace loose its temperature when cooling (lower is better)
const string ANIMATION_STONES
bool GetIgniteFailure()
void RefreshFireParticlesAndSounds(bool force_refresh)
bool IsOnInteriorSurface()
const float SNOWFALL_EFFECT_LIMIT
rain level that triggers fireplace to start soaking
void RefreshFireState()
ref AreaDamageManager m_AreaDamage
const float PARAM_SMALL_FIRE_TEMPERATURE
Cooking GetCookingProcess()
int PARTICLE_NORMAL_SMOKE
const float PARAM_WET_COOLING_DECREASE_COEF
value for calculating wetness loss during heating process
ATTACHMENT_STONES
const string MESSAGE_REIGNITE_TOO_WET
void ParticleFireStartStart()
const int SMOKING_SLOT_COUNT
void DestroyAreaDamage()
void SoundFireWetNoIgniteStart()
ATTACHMENT_COOKING_POT
const float FUEL_BURN_RATE_OVEN
const string MESSAGE_BURY_ASHES_FAILED_TOO_HOT
bool IsBurning()
void SmokeOnSmokingSlot(ItemBase slot_item, float temp_equip, float temp_ext)
bool IsWet()
const float SNOWFALL_WETNESS_INCREASE
value for calculating of wetness that fireplace gain when raining
const string MESSAGE_CANNOT_BUILD_OVEN
void SoundFireExtinguishingStart()
float GetSurfaceWetnessOnHeatModifier(notnull EntityAI entity)
void StartFire(bool force_start=false)
override bool GetCookingTargetTemperature(out float temperature)
ItemBase m_DirectCookingSlots[DIRECT_COOKING_SLOT_COUNT]
const string ANIMATION_WOOD
int PARTICLE_FIRE_END
ATTACHMENT_PAPER
int GetFireState()
void SetIgniteFailure(bool failure)
void SoundFireWindyNoIgniteStart()
void AddTemperatureToFireplace(float amount)
DEPRECATED.
bool m_IsOven
const float FUEL_BURN_RATE_DEFAULT
min height of ceiling for fire to be ignited
const float PARAM_BURN_WET_THRESHOLD
maximum rain value when the fireplace can be ignited
ATTACHMENT_BARK_BIRCH
ATTACHMENT_TRIPOD
ref Timer m_HeatingTimer
value for calculating of wetness that fireplace gain when raining
override bool DisassembleOnLastDetach()
void ParticleNormalFireStart()
const float FUEL_BURN_RATE_STONES
bool HasStoneCircle()
ATTACHMENT_COOKINGSTAND
void SetStoneCircleState(bool has_stonecircle)
ref UniversalTemperatureSourceLambdaFireplace m_UTSLFireplace
void SetExtinguishingState()
void StopAllParticlesAndSounds()
vector GetFireEffectPosition()
const string ANIMATION_KINDLING
ref UniversalTemperatureSource m_UTSource
const string MESSAGE_IGNITE_TOO_WET
const float PARAM_IGNITE_RAIN_THRESHOLD
minimum fireplace temperature under which the fireplace can be reignited using air only (degree Celsi...
float GetFireConsumableTypeEnergy(ItemBase item)
void SetTemperatureLossMP(float value)
void ParticleFireWindyNoIgniteStart()
bool IsFacingFireplace(PlayerBase player)
DEPRECATED.
ref map< ItemBase, ref FireConsumable > m_FireConsumables
bool GetCeilingHeight(out float actual_height)
const float PARAM_COOKING_EQUIP_MAX_TEMP
int PARTICLE_SMALL_SMOKE
const float PARAM_ITEM_HEAT_TEMP_INCREASE_COEF
DEPRECATED.
float m_TemperatureLossMP
value for calculating of wetness that fireplace gain when raining
FireplaceFireState
@ NO_FIRE
@ SMALL_FIRE
@ EXTINGUISHED_FIRE
@ COUNT
@ EXTINGUISHING_FIRE
@ REIGNITED_FIRE
@ END_FIRE
@ NORMAL_FIRE
@ START_FIRE
int GetAttachedStonesCount()
bool IsOven()
const float PARAM_WET_INCREASE_COEF
const string ANIMATION_COOKWARE_HANDLE
ref FireConsumable m_ItemToConsume
const float PARAM_MAX_WET_TO_IGNITE
how much will temperature decrease when fireplace is cooling (degree Celsius per second)
ItemBase m_CookingEquipment
const float IGNITE_WIND_THRESHOLD
float m_TotalEnergy
bool IsSpaceFor(vector size)
enum FireplaceFireState WIND
Particle m_ParticleFireEnd
void ClearCookingEquipment()
DEPRECATED.
FireConsumable GetFireConsumableByItem(ItemBase item)
ItemBase m_SmokingSlots[SMOKING_SLOT_COUNT]
const string ANIMATION_STICKS
void CalcAndSetTotalEnergy()
const float PARAM_FULL_HEAT_RADIUS
value for calculating damage on items located in fireplace cargo
const string ANIMATION_STONE
void FireplaceBase()
bool IsKindling(ItemBase item)
Returns if item attached to fireplace is kindling.
FireConsumable SetItemToConsume()
void SetBurningState(bool is_burning)
void ParticleWetNoIgniteStop()
bool IsItemAttachedQuantity(typename item_type, float quantity)
void SoundFireNoFireStart()
const float PARAM_COOKING_EQUIP_TEMP_INCREASE
maximum temperature of attached cooking equipment (degree Celsius)
void ParticleSmallSmokeStop()
void ParticleFireEndStart()
bool m_ThawnSurfaceUnderSupport
size of wetness increment (per FP heating tick) added to overall FP wetness when ignited on wet surfa...
bool IsFireplaceIndoor()
bool IsItemTypeAttached(typename item_type)
void ParticleFireEndStop()
bool HasLastFuelKindlingAttached()
override bool IsEmpty()
int GetFuelCount()
Returns count of all fuel type items (define in 'm_FuelTypes') attached to fireplace.
override bool CanHaveTemperature()
void ParticleFireStartStop()
void ParticleSteamEndStop()
void SetOvenState(bool is_oven)
enum FireplaceFireState WET
const string MESSAGE_BURY_ASHES_FAILED_SURFACE
const float PARAM_WET_HEATING_DECREASE_COEF
maximum wetness value when the fireplace is able to burn
const int MIN_STONES_TO_BUILD_CIRCLE
maximum value for temperature that will be transfered to player (environment)
bool HasLastAttachment()
const string ANIMATION_BURNT_WOOD
Particle m_ParticleSteamEnd
const string MESSAGE_REIGNITE_NO_KINDLING
const float RAIN_WETNESS_INCREASE
snowfall level that triggers fireplace to start soaking
void SetLightEntity(FireplaceLight light)
void ParticleSmallFireStop()
bool CanDismantleOven()
int PARTICLE_OVEN_FIRE
const float PARAM_COOKING_TEMP_THRESHOLD
cooking
const string SOUND_FIRE_NO_FIRE
int PARTICLE_OVEN_FIRE_END
const float SMOKING_SPEED
void AddDamageToItemByFireEx(ItemBase item, bool can_be_ruined, bool pAttachment)
int PARTICLE_SMALL_FIRE
const float PARAM_OUTDOOR_FIRE_TEMPERATURE
maximum fireplace temperature of a normal fire (degree Celsius)
const float RAIN_EFFECT_LIMIT
EffectSound m_SoundFire
override bool CanSwapEntities(EntityAI otherItem, InventoryLocation otherDestination, InventoryLocation destination)
int GetKindlingCount()
Returns count of all kindling type items (define in 'm_KindlingTypes') attached to fireplace.
int PARTICLE_OVEN_FIRE_START
bool m_HasAshes
void AddWetnessToItem(ItemBase item, float amount)
Particle m_ParticleNormalSmoke
void AddWetnessToFireplace(float amount)
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Definition gameplay.c:6
proto native CGame GetGame()
ErrorExSeverity
Definition endebug.c:62
enum ShapeType ErrorEx
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
const string CFG_VEHICLESPATH
Definition constants.c:220
EmitorParam
Definition envisual.c:114
proto native int dBodyGetInteractionLayer(notnull IEntity ent)
const int SAT_DEBUG_ACTION
Definition constants.c:454
class JsonUndergroundAreaTriggerData GetPosition
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
InventoryLocationType
types of Inventory Location
override void SetWet(float value, bool allow_client=false)
Definition itembase.c:8487
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Set item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Definition itembase.c:8148
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Definition itembase.c:6889
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Definition itembase.c:8871
bool CanHaveWetness()
Definition itembase.c:9470
override int GetQuantityMax()
Definition itembase.c:8248
override float GetWet()
Definition itembase.c:8516
class Land_Buoy extends House m_Light
class NoiseSystem NoiseParams()
Definition noise.c:15
void PlayParticle(int particle_id=-1)
Method to tell the particle to start playing.
bool StopParticle(int flags=0)
Method to tell the particle to stop playing.
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
override void OnRPC(ParamsReadContext ctx)