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