DayZ 1.24
Loading...
Searching...
No Matches
FireplaceBase.c
Go to the documentation of this file.
14
16{
17 WIND = 0,
18 WET = 1,
19}
20
21class FireplaceBase extends ItemBase
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_RoofAbove = false;
29 protected bool m_NoIgnite = false;
30 protected int m_OvenAttachmentsLockState = -1;
32 protected FireplaceFireState m_LastFireState = FireplaceFireState.NO_FIRE; //for synchronization purposes
34
35 //Fireplace params
36 protected float m_TemperatureLossMP = 1.0;
37 protected float m_FuelBurnRateMP = 1.0;
38
39 //cooking
41
42 //
43 const float PARAM_SMALL_FIRE_TEMPERATURE = 150;
44 const float PARAM_NORMAL_FIRE_TEMPERATURE = 1000;
45 const float PARAM_MIN_FIRE_TEMPERATURE = 30;
48 const float PARAM_MAX_WET_TO_IGNITE = 0.2;
49 const float PARAM_MIN_TEMP_TO_REIGNITE = 30;
50 const float PARAM_IGNITE_RAIN_THRESHOLD = 0.1;
51 const float PARAM_BURN_WET_THRESHOLD = 0.40;
52 const float PARAM_WET_INCREASE_COEF = 0.02;
54 const float PARAM_WET_COOLING_DECREASE_COEF = 0.002;
56 const float PARAM_BURN_DAMAGE_COEF = 5.0;
58 const float PARAM_ITEM_HEAT_MIN_TEMP = 40;
60 const float PARAM_FULL_HEAT_RADIUS = 2.0;
61 const float PARAM_HEAT_RADIUS = 4.0;
62 const float PARAM_HEAT_THROUGH_AIR_COEF = 0.1;
66 const int MIN_STONES_TO_BUILD_OVEN = 16;
68 const float MIN_CEILING_HEIGHT = 5;
69 //
70 const float TEMPERATURE_LOSS_MP_DEFAULT = 1.0;
71 const float TEMPERATURE_LOSS_MP_STONES = 0.90; //10% boost
72 const float TEMPERATURE_LOSS_MP_OVEN = 0.75; //25% boost
73
74 const float FUEL_BURN_RATE_DEFAULT = 1.0;
75 const float FUEL_BURN_RATE_STONES = 0.92;
76 const float FUEL_BURN_RATE_OVEN = 0.85;
77
79 const float PARAM_COOKING_TEMP_THRESHOLD = 100;
80 const float PARAM_COOKING_EQUIP_MAX_TEMP = 250;
87 const float DIRECT_COOKING_SPEED = 1.5; // per second
88 const int SMOKING_SLOT_COUNT = 4;
89 const float SMOKING_SPEED = 1; // per second
90
91 // stage lifetimes
94
95 const float IGNITE_WIND_THRESHOLD = 0.8; //fireplace can not be ignited above this multiple of max wind
96
97 //Timers
100
101 // Light entity
102 protected FireplaceLight m_Light;
103 protected float m_LightDistance = 2000;
104
105 //Attachments
110
111 //Particles - default for FireplaceBase
124 //
133
134 //Sounds
135 const string SOUND_FIRE_HEAVY = "HeavyFire_SoundSet";
136 const string SOUND_FIRE_LIGHT = "LightFire_SoundSet";
137 const string SOUND_FIRE_NO_FIRE = "NoFuelFire_SoundSet";
138 const string SOUND_FIRE_EXTINGUISHING = "ExtinguishByWater_SoundSet";
139 const string SOUND_FIRE_EXTINGUISHED = "ExtinguishByWaterEnd_SoundSet";
140
141 //
144 //
145
146 //Fuel
147 //Kindling / Fuel item types
150
151 //Player action / status messages
152 const string MESSAGE_IGNITE_IGNIT_ITEM_DAMAGED = "You cannot start fire. Fireplace is ruined.";
153 const string MESSAGE_IGNITE_NO_KINDLING = "There needs to be some kindling to start a fire.";
154 const string MESSAGE_IGNITE_TOO_WET = "The fireplace is too wet to be ignited.";
155 const string MESSAGE_IGNITE_RAIN = "The fire went out because of the rain.";
156 const string MESSAGE_IGNITE_WIND = "The fire went out because of the wind.";
157 const string MESSAGE_IGNITE_IN_WATER = "I cannot ignite the fireplace in the water.";
158 const string MESSAGE_IGNITE_UNDER_LOW_ROOF = "I cannot ignite the fireplace here, the is not enough room.";
159 const string MESSAGE_REIGNITE_NO_KINDLING = "There needs to be some kindling to start a fire.";
160 const string MESSAGE_REIGNITE_RAIN = "Cannot reignite fireplace in rain.";
161 const string MESSAGE_REIGNITE_TOO_WET = "The fireplace is too wet to be reignited.";
162 const string MESSAGE_BURY_ASHES_FAILED_NOT_EMPTY = "Cannot bury ashes. There are sill items in it.";
163 const string MESSAGE_BURY_ASHES_FAILED_SURFACE = "Cannot bury ashes on hard surface.";
164 const string MESSAGE_BURY_ASHES_FAILED_BURNING = "Cannot bury ashes, the fireplace is still burning.";
165 const string MESSAGE_BURY_ASHES_FAILED_TOO_HOT = "Cannot bury ashes, the fireplace is too hot.";
166 const string MESSAGE_CANNOT_BUILD_OVEN = "Cannot build oven.";
167 const string MESSAGE_CANNOT_DISMANTLE_OVEN = "Cannot dismantle oven.";
168
169 //Visual animations
170 const string ANIMATION_ASHES = "Ashes";
171 const string ANIMATION_KINDLING = "Kindling";
172 const string ANIMATION_STICKS = "Sticks";
173 const string ANIMATION_WOOD = "Wood";
174 const string ANIMATION_BURNT_WOOD = "BurntWood";
175 const string ANIMATION_STONE = "Stone";
176 const string ANIMATION_STONES = "StonesCircle";
177 const string ANIMATION_TRIPOD = "Tripod";
178 const string ANIMATION_OVEN = "Oven";
179 const string ANIMATION_INVENTORY = "Inventory";
180 const string ANIMATION_COOKWARE_HANDLE = "handleRotate";
181 const string ANIMATION_CAULDRON_HANDLE = "handle1Rotate";
182
183
184 //Visual textures and materials
185 const string MATERIAL_FIREPLACE_GLOW = "dz\\gear\\cooking\\data\\stoneground.rvmat";
186 const string MATERIAL_FIREPLACE_NOGLOW = "dz\\gear\\cooking\\data\\stonegroundnoemit.rvmat";
187
188 //Attachment types
189 //Fuel
192 //Kindling
198 typename ATTACHMENT_PAPER = Paper;
202 //Other
207 typename ATTACHMENT_FRYING_PAN = FryingPan;
208 typename ATTACHMENT_CAULDRON = Cauldron;
209 //
210 const string OBJECT_CLUTTER_CUTTER = "ClutterCutterFireplace";
212
213 //area damage
214 protected ref AreaDamageManager m_AreaDamage;
215
216 //quantity
217 protected float m_TotalEnergy;
218
219 // Noise
221 private bool m_CanNoise = true; // Flip every fireplace update to limit amount of noise generation
222
223 // UniversalTemperatureSource
227
228 //================================================================
229 // INIT / STORE LOAD-SAVE
230 //================================================================
231 //Constructor
232 protected void FireplaceBase()
233 {
234 //STATIC: define kindling types
236 {
239 m_FireConsumableTypes.Insert(ATTACHMENT_BANDAGE, new FireConsumableType(ATTACHMENT_BANDAGE, 14, true, "MedicalBandage"));
247
248 //define fuel types
249 m_FireConsumableTypes.Insert(ATTACHMENT_STICKS, new FireConsumableType(ATTACHMENT_STICKS, 40, false, "WoodenStick"));
251 }
252
253 //calculate total energy
255
256 //define fuel / kindling items (fire consumables)
258
259 //default burning parameters
262
263 //synchronized variables
264 RegisterNetSyncVariableBool("m_IsBurning");
265 RegisterNetSyncVariableBool("m_HasAshes");
266 RegisterNetSyncVariableBool("m_IsOven");
267 RegisterNetSyncVariableBool("m_HasStoneCircle");
268 RegisterNetSyncVariableBool("m_RoofAbove");
269 RegisterNetSyncVariableInt("m_FireState", FireplaceFireState.NO_FIRE, FireplaceFireState.COUNT);
270 RegisterNetSyncVariableBool("m_IsSoundSynchRemote");
271 RegisterNetSyncVariableBool("m_IsPlaceSound");
272 RegisterNetSyncVariableBool("m_NoIgnite");
273
275 }
276
277 protected void ~FireplaceBase()
278 {
280
281 if (GetLightEntity())
282 GetLightEntity().FadeOut();
283 }
284
285 override void EEInit()
286 {
287 super.EEInit();
288
289 //refresh visual on init
291
292 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
293 {
295 m_UTSSettings.m_AffectStat = true;
296 m_UTSSettings.m_ManualUpdate = true;
297 m_UTSSettings.m_TemperatureMin = 0;
301 m_UTSSettings.m_RangeMax = PARAM_HEAT_RADIUS;
302
304 m_UTSLFireplace.SetSmallFireplaceTemperatureMax(PARAM_SMALL_FIRE_TEMPERATURE);
305 m_UTSLFireplace.SetNormalFireplaceTemperatureMax(PARAM_NORMAL_FIRE_TEMPERATURE);
306
308 }
309 }
310
311 override void EEItemAttached(EntityAI item, string slot_name)
312 {
313 super.EEItemAttached(item, slot_name);
314
315 //cookware
316 switch (item.Type())
317 {
322 break;
323 }
324 }
325
327 {
328 super.OnItemLocationChanged(old_owner, new_owner);
329
330 //refresh physics after location change (with delay)
332 }
333
335 {
336 switch (attachment.Type())
337 {
340 int slot = InventorySlots.GetSlotIdFromString("CookingEquipment");
341 EntityAI ent = GetInventory().FindAttachment(slot);
342 if (ent)
343 {
344 switch (ent.Type())
345 {
349 vector direction = ent.GetDirection();
351
352 float angle = Math.Acos(dot);
353 if (direction[0] < 0)
354 angle = -angle;
355
356 float cos = Math.Cos(angle);
357 float sin = Math.Sin(angle);
358 GetInventory().DropEntityInBounds(InventoryMode.SERVER, this, ent, "2 0 2", angle, cos, sin);
359 break;
360 }
361 }
362
363 attachment.Delete();
364 break;
365 }
366 }
367
368 override void EEDelete(EntityAI parent)
369 {
370 super.EEDelete(parent);
371
373
374 // cleanup particles (for cases of leaving burning fplace and going back outside of network bubble)
375#ifndef SERVER
377#endif
378 }
379
380 //on store save/load
382 {
383 super.OnStoreSave(ctx);
384
385 //Save ashes state
386 ctx.Write(m_HasAshes);
387
388 //Save temperature loss MP
390
391 //Save fuel burn rate MP
392 ctx.Write(m_FuelBurnRateMP);
393
394 //Save burning state
395 ctx.Write(m_IsBurning);
396 }
397
398 override bool OnStoreLoad(ParamsReadContext ctx, int version)
399 {
400 if (!super.OnStoreLoad(ctx, version))
401 return false;
402
403 //--- Fireplace data ---
404 //Load ashes state
405 if (!ctx.Read(m_HasAshes))
406 {
407 m_HasAshes = false; //set default
408 return false;
409 }
410
411 //Load temperature loss MP
412 if (!ctx.Read(m_TemperatureLossMP))
413 {
414 m_TemperatureLossMP = 1.0; //set default
415 return false;
416 }
417
418 //Load fuel burn rate MP
419 if (!ctx.Read(m_FuelBurnRateMP))
420 {
421 m_FuelBurnRateMP = 1.0; //set default
422 return false;
423 }
424
425 //Load burning state, if true start fire
426 if (!ctx.Read(m_IsBurning))
427 {
428 m_IsBurning = false; //set default
429 return false;
430 }
431 //---
432
433 return true;
434 }
435
436 override void AfterStoreLoad()
437 {
438 super.AfterStoreLoad();
439
440 Synchronize();
441
442 //start fire
443 if (IsBurning())
444 {
445 if (GetGame() && GetGame().IsServer())
446 {
447 StartFire(true); //will be auto-synchronized when starting fire
448 }
449 }
450 }
451
452 //================================================================
453 // SYNCHRONIZATION
454 //================================================================
456 {
457 if (GetGame() && GetGame().IsServer())
458 {
459 SetSynchDirty();
460
461 if (GetGame().IsMultiplayer() && GetGame().IsServer())
462 {
463 //Refresh visuals (on server)
465 }
466 }
467 }
468
470 {
471 super.OnVariablesSynchronized();
472
475
476 if (IsPlaceSound())
478
479 if (IsBaseFireplace() && !IsOven())
480 {
483 else if (!m_IsBurning && m_AreaDamage)
485 }
486 }
487
488 //================================================================
489 // BASE
490 //================================================================
491
492 //States
493 //check fireplace types
494 override bool IsFireplace()
495 {
496 return true;
497 }
498
500 {
501 return false;
502 }
503
505 {
506 return false;
507 }
508
510 {
511 return false;
512 }
513
515 {
516 return false;
517 }
518
519 override bool CanHaveWetness()
520 {
521 return true;
522 }
523
524 override bool CanHaveTemperature()
525 {
526 return true;
527 }
528
529 //cooking equipment
534
539
541 {
543 m_CookingProcess.TerminateCookingSounds(pItem);
544
546 }
547
553
555 {
556 for (int i = 0; i < DIRECT_COOKING_SLOT_COUNT; i++)
557 {
559 return true;
560 }
561 return false;
562 }
563
565 {
566 for (int i = 0; i < SMOKING_SLOT_COUNT; i++)
567 {
568 if (m_SmokingSlots[i])
569 return true;
570 }
571 return false;
572 }
573
576 {
577 DeleteSafe();
578 }
579
580 override bool IsPrepareToDelete()
581 {
582 return IsEmpty() && !IsBurning() && !HasAshes();
583 }
584
585 override void EECargoOut(EntityAI item)
586 {
587 super.EECargoOut(item);
588
589 CheckForDestroy();
590 }
591
592 //================================================================
593 // VISUAL
594 //================================================================
595 //Fireplace visual
597 {
598 if (IsHologram())
599 return;
600
601 // Light
602#ifndef SERVER
603 if (IsBurning())
604 {
605 //turn light on
606 if (!GetLightEntity())
607 {
608 SetLightEntity(FireplaceLight.Cast(ScriptedLightBase.CreateLight(FireplaceLight, GetPosition(), 20)));
609 GetLightEntity().AttachOnMemoryPoint(this, "light");
610 }
611
612 if (GetLightEntity() && GetLightEntity().GetBrightness() > 0)
613 {
614 // change brightness based on the distance of player to the fireplace
615 Object player = GetGame().GetPlayer();
617
618 if (IsOven())
619 lightDist = 50;
620
621 if (player)
622 {
623 if (vector.DistanceSq(player.GetPosition(), this.GetPosition()) > lightDist * lightDist)
624 GetLightEntity().FadeBrightnessTo(0, 5);
625 else
626 GetLightEntity().FadeBrightnessTo(FireplaceLight.m_FireplaceBrightness, 5);
627 }
628
629 // The following solves an issue with the light point clipping through narrow geometry
631 GetLightEntity().SetInteriorMode();
632 else
633 GetLightEntity().SetExteriorMode();
634 }
635 }
636 else
637 {
638 //turn light off
639 if (GetLightEntity())
640 GetLightEntity().FadeOut();
641 }
642#endif
643
644 //set default burn parameters based on fireplace type
646 {
649 }
650 else if (HasStoneCircle())
651 {
654 }
655 else
656 {
659 }
660
661 // Oven attachments
662 if (IsOven())
663 {
664 //lock attachment slots
667 }
668 else
669 {
670 //unlock attachment slots
672 LockOvenAttachments(false);
673 }
674
675 //VISUAL STATES
676 //Fuel state
677 if (GetGame().IsServer()) // SetAnimationPhase should ideally be called on server only..
678 {
679 // Sticks state
681 SetAnimationPhase(ANIMATION_STICKS, 0);
682 else
683 SetAnimationPhase(ANIMATION_STICKS, 1);
684
685 // Firewood state
687 {
688 if (IsBurning() && HasAshes())
689 {
690 SetAnimationPhase(ANIMATION_BURNT_WOOD, 0); // Because this might not be set under certain circumstances
691 SetAnimationPhase(ANIMATION_WOOD, 1);
692 }
693
694 if (IsWet() || !IsBurning())
695 {
696 SetAnimationPhase(ANIMATION_BURNT_WOOD, 1);
697 SetAnimationPhase(ANIMATION_WOOD, 0);
698 }
699 }
700 else
701 {
702 SetAnimationPhase(ANIMATION_WOOD, 1);
703 SetAnimationPhase(ANIMATION_BURNT_WOOD, 1);
704 }
705
706 // Kindling state
707 if (GetKindlingCount() != 0)
708 SetAnimationPhase(ANIMATION_KINDLING, 0);
709 else
710 SetAnimationPhase(ANIMATION_KINDLING, 1);
711
712 // Ashes state
713 if (HasAshes())
714 SetAnimationPhase(ANIMATION_ASHES, 0);
715 else
716 SetAnimationPhase(ANIMATION_ASHES, 1);
717
718 // Stone variations
719 if (HasStones())
720 {
721 if (HasStoneCircle())
722 {
723 SetAnimationPhase(ANIMATION_STONES, 0);
724 SetAnimationPhase(ANIMATION_STONE, 1);
725 }
726 else if (IsOven())
727 {
728 SetAnimationPhase(ANIMATION_OVEN, 0);
729 SetAnimationPhase(ANIMATION_STONE, 1);
730 }
731 else
732 {
734 SetAnimationPhase(ANIMATION_STONES, 1);
735 SetAnimationPhase(ANIMATION_OVEN, 1);
736 SetAnimationPhase(ANIMATION_STONE, 0);
737 }
738 }
739 else
740 {
741 SetAnimationPhase(ANIMATION_STONE, 1);
742 }
743 }
744
745 //refresh physics (with delay)
747 }
748
749 protected void SetBurntFirewood()
750 {
751 if (GetGame().IsServer() && IsInAnimPhase(ANIMATION_WOOD))
752 {
753 SetAnimationPhase(ANIMATION_WOOD, 1);
754 SetAnimationPhase(ANIMATION_BURNT_WOOD, 0);
755 }
756 }
757
758 //Refresh fireplace object physics
760
762 {
764
766 {
767 switch (fire_state)
768 {
769 case FireplaceFireState.START_FIRE:
770 {
771 //particles
773
774 //sounds
777 break;
778 }
779 case FireplaceFireState.SMALL_FIRE:
780 {
781 //particles
783
785
786 if (CanShowSmoke())
788 else
790
793
795
796 //sounds
799 break;
800 }
801 case FireplaceFireState.NORMAL_FIRE:
802 {
803 //particles
805
808
810
811 if (CanShowSmoke())
813 else
815
817
818 //sounds
821 break;
822 }
823 case FireplaceFireState.END_FIRE:
824 {
825 //particles
827
830
833
835
836 //sounds
839 break;
840 }
841 case FireplaceFireState.EXTINGUISHING_FIRE: //TODO add steam particles when extinguishing
842 {
843 //particles
845
848
851
853
855
856 //sounds
859 break;
860 }
861 case FireplaceFireState.EXTINGUISHED_FIRE: //TODO add steam particles when fireplace is extinguished
862 {
863 //particles
865
868
871
873
875
876 if (CanShowSmoke())
878 else
880
881 //sounds
885 break;
886 }
887 case FireplaceFireState.REIGNITED_FIRE:
888 {
889 //particles
891
894
897
899
901
902 //sounds
904 break;
905 }
906 case FireplaceFireState.NO_FIRE:
907 {
908 //particles
910
913
916
918
921
922 //sounds
924 break;
925 }
926 }
927
929 }
930 }
931
958
960 {
961 return true;
962 }
963
964 //Fireplace fire intensity
966 {
967 float temperature = GetTemperature();
968
969 //if it's burning
970 if (IsBurning())
971 {
972 //Start fire
974 {
975 if (GetFireState() != FireplaceFireState.START_FIRE)
977 }
978 //Small fire
980 {
981 if (GetFireState() != FireplaceFireState.SMALL_FIRE)
983 }
984 //Normal fire
986 {
987 if (GetFireState() != FireplaceFireState.NORMAL_FIRE)
988 SetFireState(FireplaceFireState.NORMAL_FIRE);
989 }
990 }
991 }
992
993 //================================================================
994 // PARTICLES & SOUNDS
995 //================================================================
996 //returns true if particle started, false if not
997 protected bool PlayParticle(out Particle particle, int particle_type, vector pos, bool worldpos = false)
998 {
999 if (!particle && GetGame() && (!GetGame().IsDedicatedServer()))
1000 {
1001 if (!worldpos)
1002 particle = ParticleManager.GetInstance().PlayOnObject(particle_type, this, pos);
1003 else
1004 particle = ParticleManager.GetInstance().PlayInWorld(particle_type, pos);
1005
1006 return true;
1007 }
1008
1009 return false;
1010 }
1011
1012 //returns true if particle stopped, false if not
1014 {
1015 if (particle && GetGame() && (!GetGame().IsDedicatedServer()))
1016 {
1017 particle.Stop();
1018 particle = NULL;
1019
1020 return true;
1021 }
1022
1023 return false;
1024 }
1025
1026 //start fire
1034
1035 protected void ParticleFireStartStop()
1036 {
1038 }
1039
1040 //small fire
1048
1049 protected void ParticleSmallFireStop()
1050 {
1052 }
1053
1054 //normal fire
1062
1063 protected void ParticleNormalFireStop()
1064 {
1066 }
1067
1068 //small smoke
1070 {
1072
1073 //calculate air resistance
1074 float actual_height;
1076 {
1078
1079 //alter smoke height
1081 }
1082
1083 if (IsRoofAbove())
1085 }
1086
1087 protected void ParticleSmallSmokeStop()
1088 {
1090 }
1091
1092 //normal smoke
1094 {
1096
1097 //calculate air resistance
1098 float actual_height;
1100 {
1102
1103 //alter smoke height
1105 }
1106
1107 if (IsRoofAbove())
1109 }
1110
1112 {
1114 }
1115
1116 //fire end
1124
1125 protected void ParticleFireEndStop()
1126 {
1128 }
1129
1137
1138 //steam extinguishing
1143
1148
1149 //steam end
1154
1155 protected void ParticleSteamEndStop()
1156 {
1158 }
1159
1164
1166 {
1168 }
1169
1171 {
1172 vector from = this.GetPosition();
1173 vector to = this.GetPosition();
1174 from[1] = from[1] + 1.0;
1175 to[1] = to[1] + MIN_CEILING_HEIGHT;
1178 int contactComponent;
1179
1182
1183 return hit;
1184 }
1185
1187 {
1188 float air_res;
1190
1191 air_res = (6 - actual_height) * 0.33;
1192 air_res = Math.Clamp(air_res, 0, 2);
1193
1194 return air_res;
1195 }
1196
1197 //Particle Positions
1198 //Get local fire and smoke effect position
1200 {
1201 return Vector(0, 0.05, 0);
1202 }
1203
1205 {
1206 return Vector(0, 0.05, 0);
1207 }
1208
1209 //================================================================
1210 // SOUNDS
1211 //================================================================
1212 //Burning
1213 //Start
1214 protected void SoundFireLightStart()
1215 {
1216 PlaySoundSetLoop(m_SoundFireLoop, SOUND_FIRE_LIGHT, 1.0, 1.0);
1217 }
1218
1219 protected void SoundFireHeavyStart()
1220 {
1221 PlaySoundSetLoop(m_SoundFireLoop, SOUND_FIRE_HEAVY, 1.0, 2.0);
1222 }
1223
1224 protected void SoundFireNoFireStart()
1225 {
1226 PlaySoundSetLoop(m_SoundFireLoop, SOUND_FIRE_NO_FIRE, 2.0, 2.0);
1227 }
1228
1230 {
1231 PlaySoundSet(m_SoundFire, SOUND_FIRE_EXTINGUISHED, 0.1, 0.1);
1232 }
1233
1235 {
1236 PlaySoundSet(m_SoundFire, SOUND_FIRE_EXTINGUISHED, 0.1, 0.1);
1237 }
1238
1240 {
1241 PlaySoundSetLoop(m_SoundFireLoop, SOUND_FIRE_EXTINGUISHING, 1.0, 0.5);
1242 }
1243
1245 {
1246 PlaySoundSet(m_SoundFire, "ExtinguishByWind_SoundSet", 0, 0);
1247 }
1248
1249 //Stop
1250 protected void SoundFireStop()
1251 {
1252 StopSoundSet(m_SoundFireLoop);
1253 }
1254
1255 //================================================================
1256 // FUEL / KINDLING
1257 //================================================================
1258 //Add to fire consumables
1264
1266 {
1268 if (!fireConsumableType)
1269 {
1271 int count = m_FireConsumableTypes.Count();
1272 for (int i = 0; i < count; ++i)
1273 {
1274 if (item.IsInherited(m_FireConsumableTypes.GetKey(i)))
1276 }
1277 }
1278
1280 return fireConsumableType.GetEnergy();
1281
1282 return 0;
1283 }
1284
1285 //Remove from fire consumables
1287 {
1288 if (fire_consumable)
1289 {
1290 m_FireConsumables.Remove(fire_consumable.GetItem());
1291 delete fire_consumable;
1292 }
1293
1295 }
1296
1298 {
1299 return m_FireConsumables.Get(item);
1300 }
1301
1302 //Set fuel / kindling to consume
1303 //Sets the item with the lowest energy value as item that will be consumed next
1304 //Returns reference to set fire consumable
1306 {
1307 if (m_FireConsumables.Count() == 0)
1309 else
1310 {
1311 for (int i = 0; i < m_FireConsumables.Count(); ++i)
1312 {
1313 ItemBase key = m_FireConsumables.GetKey(i);
1315
1316 if (i == 0)
1318 else
1319 {
1320 if (fireConsumable.GetEnergy() < m_ItemToConsume.GetEnergy())
1322 }
1323 }
1324 }
1325
1326 //refresh visual
1328
1329 return m_ItemToConsume;
1330 }
1331
1333 {
1334 return m_ItemToConsume;
1335 }
1336
1337 //Spend item that is used as consumable for fire (fuel, kindling)
1338 //if 'amount == 0', the whole quantity will be consumed (quantity -= 1 )
1339 //debug
1340 //int m_debug_fire_consume_time = 0;
1341 protected void SpendFireConsumable(float amount)
1342 {
1343 //spend item
1345
1346 if (!fireConsumable)
1347 {
1348 //Set new item to consume
1350 }
1351
1352 if (fireConsumable)
1353 {
1354 ItemBase item = fireConsumable.GetItem();
1355 fireConsumable.SetRemainingEnergy(fireConsumable.GetRemainingEnergy() - amount);
1356
1357 if (fireConsumable.GetRemainingEnergy() <= 0 || amount == 0)
1358 {
1359 //set ashes
1360 if (!HasAshes())
1361 SetAshesState(true);
1362
1363 if (item.IsAnyInherited({ItemBook, Paper, GiftWrapPaper, EyeMask_ColorBase}))
1364 {
1366 item.Delete();
1367 }
1368 else
1369 {
1370 //if there is nothing left, delete and remove old consumable, set new fire consumable
1371 if (item.GetQuantity() <= 1)
1372 {
1373 //remove item from fuel items
1375 }
1376 else
1377 fireConsumable.SetRemainingEnergy(fireConsumable.GetEnergy());
1378
1379 item.AddQuantity(-1);
1381 }
1382 }
1383 }
1384
1386 }
1387
1389 protected int GetKindlingCount()
1390 {
1391 int attachmentsCount = GetInventory().AttachmentCount();
1392 int kindlingCount = 0;
1393
1394 for (int i = 0; i < attachmentsCount; ++i)
1395 {
1396 ItemBase item = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(i));
1397
1398 if (IsKindling(item))
1399 kindlingCount++;
1400 }
1401
1402 return kindlingCount;
1403 }
1404
1406 protected int GetFuelCount()
1407 {
1408 int attachmentsCount = GetInventory().AttachmentCount();
1409 int fuelCount = 0;
1410
1411 for (int i = 0; i < attachmentsCount; ++i)
1412 {
1413 ItemBase item = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(i));
1414 if (IsFuel(item))
1415 fuelCount++;
1416 }
1417
1418 return fuelCount;
1419 }
1420
1422 protected bool IsKindling(ItemBase item)
1423 {
1425 if (!fireConsumableType)
1426 {
1428 int count = m_FireConsumableTypes.Count();
1429 for (int i = 0; i < count; ++i)
1430 {
1431 if (item.IsInherited(m_FireConsumableTypes.GetKey(i)))
1433 }
1434 }
1435
1436 return fireConsumableType && fireConsumableType.IsKindling();
1437 }
1438
1440 protected bool IsFuel(ItemBase item)
1441 {
1443 if (!fireConsumableType)
1444 {
1446 int count = m_FireConsumableTypes.Count();
1447 for (int i = 0; i < count; ++i)
1448 {
1449 if (item.IsInherited(m_FireConsumableTypes.GetKey(i)))
1451 }
1452 }
1453
1454 return fireConsumableType && !fireConsumableType.IsKindling();
1455 }
1456
1457 //Has attachments of given type
1459 {
1460 return GetAttachmentByType(item_type) != null;
1461 }
1462
1463 //Has attachments of required quantity
1465 {
1466 ItemBase item = ItemBase.Cast(GetAttachmentByType(item_type));
1467
1468 return item.GetQuantity() >= quantity;
1469 }
1470
1471 //Has last attached item
1473 {
1474 return GetInventory().AttachmentCount() == 1;
1475 }
1476
1477 //Has last fuel/kindling attached
1479 {
1480 return (GetFuelCount() + GetKindlingCount()) == 1;
1481 }
1482
1483
1484 //================================================================
1485 // FIRE STATE
1486 //================================================================
1487 //Is fireplace burning?
1489 {
1490 return m_IsBurning;
1491 }
1492
1493 //Set burning state
1494 protected void SetBurningState(bool is_burning)
1495 {
1497 }
1498
1499 //Are ashes present in fireplace?
1501 {
1502 return m_HasAshes;
1503 }
1504
1505 //Set ashes state
1506 protected void SetAshesState(bool has_ashes)
1507 {
1509
1510 if (m_HasAshes)
1512 }
1513
1514 //Is in oven state
1515 bool IsOven()
1516 {
1517 return m_IsOven;
1518 }
1520 {
1521 return m_HasStoneCircle;
1522 }
1523
1525 {
1526 EntityAI attached_item = GetAttachmentByType(ATTACHMENT_STONES);
1527
1528 return attached_item && attached_item.GetQuantity() > 0;
1529 }
1530
1532 {
1533 if (HasStones())
1534 return GetAttachmentByType(ATTACHMENT_STONES).GetQuantity();
1535
1536 return 0;
1537 }
1538
1540 {
1541 if (m_IsOven != is_oven)
1542 {
1543 m_IsOven = is_oven;
1545
1546 GetInventory().SetSlotLock(InventorySlots.GetSlotIdFromString("Stones"), is_oven);
1547
1548 Synchronize();
1549 }
1550 }
1552 {
1554 {
1556
1557 GetInventory().SetSlotLock(InventorySlots.GetSlotIdFromString("Stones"), has_stonecircle);
1558
1559 Synchronize();
1560 }
1561 }
1562
1563 //Temperature loss MP
1564 protected float GetTemperatureLossMP()
1565 {
1566 return m_TemperatureLossMP;
1567 }
1568
1569 protected void SetTemperatureLossMP(float value)
1570 {
1572 }
1573
1574 //Fuel burn rate MP
1575 protected float GetFuelBurnRateMP()
1576 {
1577 return m_FuelBurnRateMP;
1578 }
1579
1580 protected void SetFuelBurnRateMP(float value)
1581 {
1583 }
1584
1585 //Get fire state
1586 protected int GetFireState()
1587 {
1588 return m_FireState;
1589 }
1590
1591 //Sets fire state
1593 {
1594 if (m_FireState != state)
1595 {
1597
1598 Synchronize();
1599 }
1600 }
1601
1603 {
1604 SetFireState(FireplaceFireState.EXTINGUISHING_FIRE);
1605 }
1606
1607 //================================================================
1608 // FIRE PROCESS
1609 //================================================================
1610
1611 //Start the fire process
1612 // 1. start heating
1613 // 2. heating
1614 // 3. stop heating
1615 void StartFire(bool force_start = false)
1616 {
1617 //stop cooling process if active
1618 if (m_CoolingTimer)
1619 {
1620 m_CoolingTimer.Stop();
1622 }
1623
1624 //set under roof flag (was fire ignited under roof?)
1625 if (MiscGameplayFunctions.IsUnderRoof(this))
1626 m_RoofAbove = true;
1627
1628 //start fire
1629 if (!IsBurning() || force_start)
1630 {
1632 SetBurningState(true);
1633 m_UTSource.SetActive(true);
1634 StartHeating();
1635
1636 //Update navmesh
1637 if (!IsFireplaceIndoor())
1638 {
1639 SetAffectPathgraph(false, true);
1640 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(GetGame().UpdatePathgraphRegionByObject, 100, false, this);
1641 }
1642 }
1643
1644 Synchronize();
1645 }
1646
1647 //Start heating
1648 protected void StartHeating()
1649 {
1650 //visual
1651 SetObjectMaterial(0, MATERIAL_FIREPLACE_GLOW);
1652
1653 if (IsWindy() && !IsRoofAbove() && !IsOven() && !IsBarrelWithHoles())
1654 {
1655 StopFire();
1656 return;
1657 }
1658
1660 {
1661 StopFire(FireplaceFireState.EXTINGUISHED_FIRE);
1662 return;
1663 }
1664
1665 //create area damage
1666 if (IsBaseFireplace() && !IsOven())
1668
1670 m_HeatingTimer.Run(TIMER_HEATING_UPDATE_INTERVAL, this, "Heating", null, true);
1671
1672 //Setup the noise parameters on fire start
1673 m_NoisePar = new NoiseParams();
1674 if (IsRoofAbove() || IsOven() || IsFireplaceIndoor()) //If we have a roof, we are probably inside
1675 m_NoisePar.LoadFromPath("CfgVehicles FireplaceBase NoiseFireplaceSpecial");
1676 else
1677 m_NoisePar.LoadFromPath("CfgVehicles FireplaceBase NoiseFireplaceBase");
1678 }
1679
1680 //Do heating
1681 protected void Heating()
1682 {
1683 float temperature = GetTemperature();
1684 float temperature_modifier = 0;
1685
1686 //check burning conditions
1688 {
1689 StopFire(FireplaceFireState.EXTINGUISHED_FIRE);
1690 return;
1691 }
1692 else
1693 {
1694 if (m_FireConsumables.Count() == 0)
1695 {
1696 StopFire();
1697 return;
1698 }
1699 }
1700
1701 //spend actual fire consumable
1703 SpendFireConsumable(amount);
1704
1705 //set wetness if raining and alter temperature modifier (which will lower temperature increase because of rain)
1706 float rain = GetGame().GetWeather().GetRain().GetActual();
1708 {
1709 //set wet to fireplace
1711
1712 //set temperature modifier
1714 }
1715 //subtract wetness when heating and not raining above
1716 else
1718
1719 // temperature via UniversalTemperatureSource
1720 m_UTSLFireplace.SetFuelCount(GetFuelCount());
1722 m_UTSLFireplace.SetCurrentTemperature(temperature);
1724
1725 //check fire state
1726 if (GetFireState() != FireplaceFireState.EXTINGUISHING_FIRE)
1728
1729 //damage cargo items
1731
1732 //manage cooking equipment (this applies only for case of cooking pot on a tripod)
1734 {
1735 float cook_equip_temp = m_CookingEquipment.GetTemperature();
1736
1738 {
1739 //start cooking
1741 }
1742
1743 //DEBUG
1744 /*
1745 PlayerBase player = ( PlayerBase ) GetGame().GetPlayer();
1746 string s_message = "cooking equipment temp = " + ftoa(cook_equip_temp) + " | PARAM_COOKING_TEMP_THRESHOLD = " + ftoa(PARAM_COOKING_TEMP_THRESHOLD);
1747 if (player != NULL) {player.MessageAction (s_message);}
1748 Print ( s_message );
1749 */
1750 //set temperature to cooking equipment
1754 else
1756
1757 m_CookingEquipment.SetTemperature(cook_equip_temp);
1758 }
1759
1760 float cook_item_temp;
1761 int i;
1762 // manage cooking on direct cooking slots
1764 {
1765 for (i = 0; i < DIRECT_COOKING_SLOT_COUNT; i++)
1766 {
1768 {
1769 cook_item_temp = m_DirectCookingSlots[i].GetTemperature();
1772 }
1773 }
1774 }
1775
1776 // manage smoking slots
1777 if (SmokingSlotsInUse())
1778 {
1779 for (i = 0; i < SMOKING_SLOT_COUNT; i++)
1780 {
1781 if (m_SmokingSlots[i])
1783 }
1784 }
1785
1786 //Make noise for AI, only at night
1787 if (GetGame().GetWorld().IsNight() && m_CanNoise)
1788 {
1789 NoiseSystem noise = GetGame().GetNoiseSystem();
1790 if (noise && m_NoisePar)
1791 noise.AddNoisePos(this, GetPosition(), m_NoisePar);
1792 m_CanNoise = false;
1793 }
1794 else
1795 m_CanNoise = true;
1796
1797 Synchronize();
1798 }
1799
1800 //Stop the fire process
1801 // 1. start cooling
1802 // 2. cooling
1803 // 3. stop cooling
1805 {
1806 StopHeating();
1808 SetBurningState(false);
1809 StartCooling();
1811
1812 //Update navmesh
1813 if (!IsFireplaceIndoor())
1814 {
1815 SetAffectPathgraph(false, false);
1816 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(GetGame().UpdatePathgraphRegionByObject, 100, false, this);
1817 }
1818
1819 Synchronize();
1820 }
1821
1822 protected void StopHeating()
1823 {
1824 if (!m_HeatingTimer)
1825 return;
1826
1827 m_HeatingTimer.Stop();
1829 }
1830
1831 protected void StartCooling()
1832 {
1833 if (m_HeatingTimer)
1834 {
1835 m_HeatingTimer.Stop();
1837 }
1838
1839 //Start cooling
1841 m_CoolingTimer.Run(TIMER_COOLING_UPDATE_INTERVAL, this, "Cooling", null, true);
1842 }
1843
1844 protected void Cooling()
1845 {
1846 float wetness = GetWet();
1847 float temperature = GetTemperature();
1848 float temperature_modifier = 0;
1849
1850 if (!IsBurning() && temperature >= 10)
1851 {
1852 //check wetness
1853 //set wetness if raining and alter temperature modifier (which will lower temperature increase because of rain)
1854 float rain = GetGame().GetWeather().GetRain().GetActual();
1855 if (IsRainingAbove() && !IsRoofAbove())
1856 {
1857 //set wet to fireplace
1859
1860 //set temperature modifier
1862 }
1863 else //subtract wetness
1865
1866 //calculate already obtained wetness (e.g. extinguished by water)
1868
1869 // temperature via UniversalTemperatureSource
1870 m_UTSLFireplace.SetFuelCount(GetFuelCount());
1872 m_UTSLFireplace.SetCurrentTemperature(temperature);
1874
1875 //damage cargo items
1877
1878 //cook with equipment if temperature of equipment is still high
1880 {
1881 float cook_equip_temp = m_CookingEquipment.GetTemperature();
1882
1884 {
1885 //cook
1887 }
1888 }
1889
1890 float cook_item_temp;
1891 int i;
1892
1893 // manage cooking on direct cooking slots
1895 {
1896 for (i = 0; i < DIRECT_COOKING_SLOT_COUNT; i++)
1897 {
1899 {
1900 cook_item_temp = m_DirectCookingSlots[i].GetTemperature();
1903 }
1904 }
1905 }
1906
1907 // manage smoking slots
1908 if (SmokingSlotsInUse())
1909 {
1910 for (i = 0; i < SMOKING_SLOT_COUNT; i++)
1911 {
1912 if (m_SmokingSlots[i])
1914 }
1915 }
1916
1917 //Debug
1918 //PlayerBase player = ( PlayerBase ) GetGame().GetPlayer();
1919 //if (player != NULL) {player.MessageAction ( temperature.ToString() );}
1920 }
1921 else
1922 {
1923 //stop cooling
1924 if (Math.AbsFloat(temperature) < 10)
1925 {
1926 StopCooling();
1927 m_UTSource.SetActive(false);
1928 }
1929 }
1930 }
1931
1932 protected void StopCooling()
1933 {
1934 //stop all fire visuals
1936 SetObjectMaterial(0, MATERIAL_FIREPLACE_NOGLOW);
1937
1938 //Stop cooling
1939 m_CoolingTimer.Stop();
1941
1942 //destroy area damage
1944
1945 //remove cookware audio visuals
1946 if (GetCookingEquipment())
1947 {
1949 if (cooking_pot)
1950 cooking_pot.RemoveAudioVisualsOnClient();
1951 }
1952
1954 {
1955 for (int i = 0; i < DIRECT_COOKING_SLOT_COUNT; i++)
1956 {
1958 {
1960 if (cookingpot)
1961 cookingpot.RemoveAudioVisualsOnClient();
1962
1963 FryingPan fryingpan = FryingPan.Cast(m_DirectCookingSlots[i]);
1964 if (fryingpan)
1965 fryingpan.RemoveAudioVisualsOnClient();
1966
1968 if (itsfood)
1969 itsfood.MakeSoundsOnClient(false);
1970 }
1971 }
1972 }
1973 }
1974
1975 //================================================================
1976 // COOKING
1977 //================================================================
1978 protected void CookWithEquipment()
1979 {
1980 if (m_CookingProcess == null)
1981 m_CookingProcess = new Cooking();
1982
1983 m_CookingProcess.CookWithEquipment(m_CookingEquipment);
1984 }
1985
1987 {
1988 if (m_CookingProcess == null)
1989 m_CookingProcess = new Cooking();
1990
1991 return m_CookingProcess;
1992 }
1993
2015
2017 {
2018 if (m_CookingProcess == NULL)
2019 m_CookingProcess = new Cooking();
2020
2021 // smoking slots accept only individual meat/fruit/veg items
2023 if (ingr)
2024 m_CookingProcess.SmokeItem(ingr, FireplaceBase.TIMER_HEATING_UPDATE_INTERVAL * FireplaceBase.SMOKING_SPEED);
2025 }
2026
2027 //================================================================
2028 // FIRE VICINITY
2029 //================================================================
2030 //apply damage to all items, raise temperature to only specific items
2031 protected void BurnItemsInFireplace()
2032 {
2034 CargoBase cargo = GetInventory().GetCargo();
2035 for (int i = 0; i < cargo.GetItemCount(); i++)
2036 {
2037 ItemBase item = ItemBase.Cast(cargo.GetItem(i));
2038
2039 //set damage
2040 AddDamageToItemByFireEx(item, false, false);
2041
2042 if (item.GetHealth("", "Health") <= 0 && !item.IsKindOf("Grenade_Base"))
2043 item.Delete();
2044
2045 //add temperature
2047
2048 //remove wetness
2050 }
2051
2053 for (int j = 0; j < GetInventory().AttachmentCount(); ++j)
2054 {
2055 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(j));
2056
2057 //set damage
2058 AddDamageToItemByFireEx(attachment, false, true);
2059
2060 //add temperature
2062
2063 //remove wetness
2065 }
2066 }
2067
2068 //add temperature to item by fire
2070 {
2071 if (item.GetTemperatureMax() >= PARAM_ITEM_HEAT_MIN_TEMP)
2072 {
2073 float temperature = item.GetTemperature() + PARAM_ITEM_HEAT_TEMP_INCREASE_COEF;
2075 item.SetTemperature(temperature);
2076 }
2077 }
2078
2080 protected void AddTemperatureToFireplace(float amount) {};
2081
2082 //add damage to item by fire
2084 {
2085 if (!item)
2086 return;
2087
2089 return;
2090
2092 if (!pAttachment)
2093 {
2095 GameInventory itemInventory = item.GetInventory();
2096 if (itemInventory)
2097 {
2098 for (int i = 0; i < itemInventory.AttachmentCount(); ++i)
2099 itemInventory.GetAttachmentFromIndex(i).AddHealth("", "", -PARAM_BURN_DAMAGE_COEF);
2100 }
2101
2102 item.AddHealth("", "", -PARAM_BURN_DAMAGE_COEF);
2103 }
2104 else
2105 {
2106 float timerCoef = 1.0;
2107 if (m_HeatingTimer && m_HeatingTimer.IsRunning())
2109 else if (m_CoolingTimer && m_CoolingTimer.IsRunning())
2111
2112 switch (item.Type())
2113 {
2114 case ATTACHMENT_TRIPOD:
2120 break;
2121 }
2122
2124 if (IsFuel(item) || IsKindling(item))
2125 {
2126 if (item.GetHealthLevel() < GameConstants.STATE_BADLY_DAMAGED)
2127 item.DecreaseHealth(PARAM_BURN_DAMAGE_COEF, false);
2128 }
2129
2131 if (item.CanBeCooked() && item.GetHealthLevel() >= GameConstants.STATE_BADLY_DAMAGED)
2132 {
2134 edible_item.ChangeFoodStage(FoodStageType.BURNED);
2135 }
2136 }
2137 }
2138
2139 // DEPRECATED
2141 {
2142 item.DecreaseHealth(PARAM_BURN_DAMAGE_COEF, false);
2143
2144 if (item.CanBeCooked() & item.GetHealthLevel() >= GameConstants.STATE_BADLY_DAMAGED)
2145 {
2147 edible_item.ChangeFoodStage(FoodStageType.BURNED);
2148 }
2149 }
2150
2151 //add wetness on item
2152 protected void AddWetnessToItem(ItemBase item, float amount)
2153 {
2154 float wetness = item.GetWet();
2155 wetness = wetness + amount;
2156 wetness = Math.Clamp(wetness, 0, 1); //wetness <0-1>
2157 item.SetWet(wetness);
2158 }
2159
2160 //add wetness on fireplace
2161 void AddWetnessToFireplace(float amount)
2162 {
2163 //add wetness
2164 float wetness = GetWet();
2165 wetness = wetness + amount;
2166 wetness = Math.Clamp(wetness, 0, 1); //wetness <0-1>
2167 SetWet(wetness);
2168
2169 //decrease temperature
2170 if (amount > 0)
2171 {
2172 float temperature = GetTemperature();
2173 temperature = temperature * (1 - (wetness * 0.5));
2175 // temperature via UniversalTemperatureSource
2176 m_UTSLFireplace.SetFuelCount(GetFuelCount());
2177 m_UTSLFireplace.SetCurrentTemperature(temperature);
2178 }
2179 }
2180
2182 protected void TransferHeatToNearPlayers() {}
2183
2184 //Create and Destroy damage radius around the fireplace when starting/stopping burning process
2186 {
2187 //destroy area damage if some already exists
2189
2190 //create new area damage
2192 m_AreaDamage.SetDamageComponentType(AreaDamageComponentTypes.HITZONE);
2193 m_AreaDamage.SetExtents("-0.30 0 -0.30", "0.30 0.75 0.30");
2194 m_AreaDamage.SetLoopInterval(0.5);
2195 m_AreaDamage.SetDeferDuration(0.5);
2196 m_AreaDamage.SetHitZones({ "Head", "Torso", "LeftHand", "LeftLeg", "LeftFoot", "RightHand", "RightLeg", "RightFoot" });
2197 m_AreaDamage.SetAmmoName("FireDamage");
2198 m_AreaDamage.Spawn();
2199 }
2200
2202 {
2203 if (m_AreaDamage)
2204 m_AreaDamage.Destroy();
2205 }
2206
2209 {
2210 ErrorEx("Deprecated method", ErrorExSeverity.INFO);
2211
2212 return false;
2213 }
2214
2215 //================================================================
2216 // ACTIONS
2217 //================================================================
2218 // --- Actions / Action conditions
2219 //Check if there is some kindling attached
2221 {
2222 return GetKindlingCount() > 0;
2223 }
2224
2225 //Check if the weather is too windy
2226 static bool IsWindy()
2227 {
2228 //check wind
2229 float wind_speed = GetGame().GetWeather().GetWindSpeed();
2230 float wind_speed_threshold = GetGame().GetWeather().GetWindMaximumSpeed() * FireplaceBase.IGNITE_WIND_THRESHOLD;
2231
2232 return (wind_speed >= wind_speed_threshold);
2233 }
2234
2236 {
2237 return m_NoIgnite;
2238 }
2239
2241 {
2243 }
2244
2245 //Check if the fireplace is too wet to be ignited
2247 {
2248 return (entity_ai.GetWet() >= FireplaceBase.PARAM_MAX_WET_TO_IGNITE);
2249 }
2250
2251 bool IsWet()
2252 {
2253 return FireplaceBase.IsEntityWet(this);
2254 }
2255
2256 //Check if there is any roof above fireplace
2258 {
2259 return m_RoofAbove;
2260 }
2261
2262 //check if fireplace is opened
2263 override bool IsOpen()
2264 {
2265 return true;
2266 }
2267
2268 //Check if there is enough space for smoke
2270 {
2271 return !MiscGameplayFunctions.IsUnderRoof(this, FireplaceBase.MIN_CEILING_HEIGHT);
2272 }
2273
2274 //Check if it's raining and there is only sky above fireplace
2276 {
2277 return (GetGame() && (GetGame().GetWeather().GetRain().GetActual() >= FireplaceBase.PARAM_IGNITE_RAIN_THRESHOLD));
2278 }
2279
2281 {
2282 return FireplaceBase.IsRainingAboveEntity(this);
2283 }
2284
2285 //Check there is water surface bellow fireplace
2287 {
2288 vector fireplacePosition = entity_ai.GetPosition();
2289 string surfaceType;
2290 g_Game.SurfaceGetType3D(fireplacePosition[0], fireplacePosition[1] + g_Game.SurfaceGetSeaLevel(), fireplacePosition[2], surfaceType);
2291 if (!surfaceType)
2292 {
2293 float waterLevelDiff = fireplacePosition[1] - g_Game.SurfaceGetSeaLevel();
2294 return waterLevelDiff < 0.5;
2295 }
2296 else if (surfaceType.Contains("water"))
2297 return true;
2298
2299 return false;
2300 }
2302 {
2303 return FireplaceBase.IsEntityOnWaterSurface(this);
2304 }
2305
2306 //check if the surface is interior
2308 {
2309 string surfaceType;
2310 vector fireplacePosition = entity_ai.GetPosition();
2311 GetGame().SurfaceGetType3D(fireplacePosition[0], fireplacePosition[1] + 1.0, fireplacePosition[2], surfaceType);
2312 return (GetGame().ConfigGetInt("CfgSurfaces " + surfaceType + " interior") == 1);
2313 }
2315 {
2316 return FireplaceBase.IsEntityOnInteriorSurface(this);
2317 }
2318
2319 //Checks if has not additional items in it
2320 override bool IsEmpty()
2321 {
2322 return (GetInventory().GetCargo().GetItemCount() == 0 && GetInventory().AttachmentCount() == 0);
2323 }
2324
2325 //Checks if it has no items in cargo
2327 {
2328 return (GetInventory().GetCargo().GetItemCount() == 0);
2329 }
2330
2332 {
2333 return GetInventory().FindAttachment(InventorySlots.GetSlotIdFromString("CookingTripod")) != null;
2334 }
2335
2336 //Check if object is in animation phase
2338 {
2339 return GetAnimationPhase(anim_phase) == 0;
2340 }
2341
2343 {
2344 array<Object> objs = {};
2345 if (GetGame().IsBoxCollidingGeometry(GetWorldPosition() + Vector(0, size[1] * 0.5 + 0.1, 0), GetDirection().VectorToAngles(), size, ObjIntersect.View, ObjIntersect.Geom, {this}, objs))
2346 {
2347 foreach (Object obj : objs)
2348 {
2349 if (dBodyGetInteractionLayer(obj) == PhxInteractionLayers.ITEM_LARGE)
2350 return false;
2351 }
2352 }
2353 return true;
2354 }
2355
2356
2358 {
2359 if (!otherDestination || otherDestination.GetParent() == this)
2360 return false;
2361 return true;
2362 }
2363
2364 //Action condition for building oven
2366 {
2367 return !IsOven() && !IsBurning() && (GetAttachedStonesCount() >= MIN_STONES_TO_BUILD_OVEN) && !FindAttachmentBySlotName("CookingTripod") && !HasStoneCircle() && IsSpaceForOven();
2368 }
2369
2371 {
2372 const float size = 0.6;
2373 return IsSpaceFor(Vector(size, size, size));
2374 }
2375
2376 //Action condition for stone circle
2381
2383 {
2384 return IsSpaceFor(Vector(0.9, 0.1, 0.9));
2385 }
2386
2387 //Action condition for dismantling oven
2392 //Action condition for dismantling stone circle
2394 {
2395 return (HasStoneCircle() && !IsOven() && !IsBurning());
2396 }
2397
2399 {
2401 }
2402
2403 //Can extinguish fire
2405 {
2406 return IsBurning();
2407 }
2408
2409 FireplaceLight GetLightEntity()
2410 {
2411 return m_Light;
2412 }
2413
2414 void SetLightEntity(FireplaceLight light)
2415 {
2416 m_Light = light;
2417 }
2418
2419 //================================================================
2420 // ADVANCED PLACEMENT
2421 //================================================================
2422
2423 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
2424 {
2425 super.OnPlacementComplete(player, position, orientation);
2426
2427 if (GetGame().IsServer())
2428 {
2429 //remove grass
2431 cc_object.SetOrientation(orientation);
2432 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(GetGame().ObjectDelete, 1000, false, cc_object);
2433
2434 SetIsPlaceSound(true);
2435 }
2436 }
2437
2438 override string GetPlaceSoundset()
2439 {
2440 return "placeFireplace_SoundSet";
2441 }
2442
2443 //================================================================
2444 // QUANITTY
2445 //================================================================
2446 // calculates and sets total energy based on possible (fuel/kinidling) item attachments
2447 protected void CalcAndSetTotalEnergy()
2448 {
2449 if (GetGame() && GetGame().IsServer())
2450 {
2451 m_TotalEnergy = 0;
2452
2454 {
2455 string quantityConfigPath = string.Format("CfgVehicles %1 varQuantityMax", fireConsumableType.GetItemType().ToString());
2456 string stackMaxConfigPath = string.Format("CfgSlots Slot_%1 stackMax", fireConsumableType.GetAttSlot());
2457 if (GetGame().ConfigIsExisting(quantityConfigPath))
2458 float quantityMax = GetGame().ConfigGetFloat(quantityConfigPath);
2459
2460 if (GetGame().ConfigIsExisting(stackMaxConfigPath))
2461 float stackMax = GetGame().ConfigGetFloat(stackMaxConfigPath);
2462
2463 //debug
2464 //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() + "]" );
2465
2466 if (stackMax > 0)
2467 m_TotalEnergy += stackMax * fireConsumableType.GetEnergy();
2468 else
2470 }
2471
2472 //debug
2473 //Print( "Total energy = " + m_TotalEnergy.ToString() );
2474 }
2475 }
2476
2477 // calculates and sets current quantity based on actual (fuel/kinidling) item attachments
2478 protected void CalcAndSetQuantity()
2479 {
2480 if (GetGame() && GetGame().IsServer())
2481 {
2482 float remainingEnergy;
2483
2485 {
2486 float quantity = fireConsumable.GetItem().GetQuantity();
2487 if (quantity > 0)
2488 {
2489 remainingEnergy += ((quantity - 1) * fireConsumable.GetEnergy()) + fireConsumable.GetRemainingEnergy();
2490 //Print( fireConsumable.GetItem().GetType() + " remaining energy = " + ( ( ( quantity - 1 ) * fire_consumable.GetEnergy() ) + fire_consumable.GetRemainingEnergy() ).ToString() );
2491 }
2492 else
2493 {
2494 remainingEnergy += fireConsumable.GetRemainingEnergy();
2495 //Print( fireConsumable.GetItem().GetType() + " remaining energy = " + ( fireConsumable.GetRemainingEnergy().ToString() ) );
2496 }
2497 }
2498
2500 }
2501 }
2502
2504 {
2505 super.OnAttachmentQuantityChanged(item);
2506
2508 }
2509
2511 {
2512 if (!super.CanReleaseAttachment(attachment))
2513 return false;
2514
2516 if (IsKindling(item) || IsFuel(item))
2517 return !IsBurning();
2518
2519 return true;
2520 }
2521
2523 {
2524 //Print("LockOvenAttachments");
2525 //string path_cooking_equipment = "" + CFG_VEHICLESPATH + " " + GetType() + " GUIInventoryAttachmentsProps CookingEquipment attachmentSlots";
2526 string path_cooking_equipment = string.Format("%1 %2 GUIInventoryAttachmentsProps CookingEquipment attachmentSlots", CFG_VEHICLESPATH, GetType());
2527 //string path_direct_cooking = "" + CFG_VEHICLESPATH + " " + GetType() + " GUIInventoryAttachmentsProps DirectCooking attachmentSlots";
2528 string path_direct_cooking = string.Format("%1 %2 GUIInventoryAttachmentsProps DirectCooking attachmentSlots", CFG_VEHICLESPATH, GetType());
2529 if (GetGame().ConfigIsExisting(path_cooking_equipment) && GetGame().ConfigIsExisting(path_direct_cooking))
2530 {
2534 GetGame().ConfigGetTextArray(path_direct_cooking, arr_direct_cooking);
2535 for (int i = 0; i < arr_cooking_equipment.Count(); i++)
2536 {
2537 if (lock != GetInventory().GetSlotLock(InventorySlots.GetSlotIdFromString(arr_cooking_equipment[i])))
2538 {
2539 GetInventory().SetSlotLock(InventorySlots.GetSlotIdFromString(arr_cooking_equipment[i]), lock);
2540 //Print("attachment lock: " + arr_cooking_equipment[i] + " " + lock);
2541 }
2542 }
2543
2544 for (i = 0; i < arr_direct_cooking.Count(); i++)
2545 {
2546 if (lock == GetInventory().GetSlotLock(InventorySlots.GetSlotIdFromString(arr_direct_cooking[i])))
2547 {
2548 GetInventory().SetSlotLock(InventorySlots.GetSlotIdFromString(arr_direct_cooking[i]), !lock);
2549 //Print("attachment lock: " + arr_direct_cooking[i] + " " + !lock);
2550 }
2551 }
2552 }
2554 }
2556 {
2557 return true;
2558 }
2559
2561 {
2562 super.OnRPC(sender, rpc_type, ctx);
2563
2564 ref Param1<bool> p = new Param1<bool>(false);
2565
2566 if (ctx.Read(p))
2567 bool failure = p.param1;
2568
2569 switch (rpc_type)
2570 {
2571 case FirePlaceFailure.WIND:
2572
2573 if (failure)
2574 {
2576 SoundFireStop();
2578 }
2579
2580 break;
2581
2582 case FirePlaceFailure.WET:
2583
2584 if (failure)
2585 {
2587 SoundFireStop();
2589 }
2590
2591 break;
2592 }
2593 }
2594
2595
2596 //================================================================
2597 // DEBUG
2598 //================================================================
2599
2600 //Debug menu Spawn Ground Special
2601 override void OnDebugSpawn()
2602 {
2603 ItemBase firewood = ItemBase.Cast(GetInventory().CreateInInventory("Firewood"));
2604 firewood.SetQuantity(firewood.GetQuantityMax());
2605
2606 ItemBase sticks = ItemBase.Cast(GetInventory().CreateInInventory("WoodenStick"));
2607 sticks.SetQuantity(sticks.GetQuantityMax());
2608
2609 ItemBase stone = ItemBase.Cast(GetInventory().CreateInInventory("Stone"));
2610 stone.SetQuantity(stone.GetQuantityMax());
2611
2612 GetInventory().CreateInInventory("Rag");
2613
2614 SpawnEntityOnGroundPos("PetrolLighter", GetPosition());
2615 }
2616
2618 {
2619 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ACTIVATE_ENTITY, "Ignite", FadeColors.LIGHT_GREY));
2620 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DEACTIVATE_ENTITY, "Extinguish", FadeColors.LIGHT_GREY));
2621 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
2622
2623 super.GetDebugActions(outputList);
2624 }
2625
2627 {
2628 if (super.OnAction(action_id, player, ctx))
2629 return true;
2630 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
2631 {
2632 if (action_id == EActions.ACTIVATE_ENTITY)
2634 else if (action_id == EActions.DEACTIVATE_ENTITY)
2635 StopFire();
2636 }
2637 return false;
2638 }
2639
2640
2641}
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
const int ECE_PLACE_ON_SURFACE
float quantityMax
void Synchronize()
Container_Base m_HalfExtents
override void EEInit()
override void EEDelete(EntityAI parent)
static const float PARAM_BURN_DAMAGE_COEF
Definition Cooking.c:24
DayZGame g_Game
Definition DayZGame.c:3528
PhxInteractionLayers
Definition DayZPhysics.c:2
void OnRPC(ParamsReadContext ctx)
EActions
Definition EActions.c:2
ExplosiveLight m_Light
light
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
ref UniversalTemperatureSourceSettings m_UTSSettings
float m_FuelBurnRateMP
determines how fast will the fireplace loose its temperature when cooling (lower is better)
const string MESSAGE_BURY_ASHES_FAILED_BURNING
int m_OvenAttachmentsLockState
ItemBase GetCookingEquipment()
const string SOUND_FIRE_EXTINGUISHING
static bool IsEntityOnInteriorSurface(notnull EntityAI entity_ai)
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 PARAM_HEAT_THROUGH_AIR_COEF
radius in which objects are heated by fire
bool DirectCookingSlotsInUse()
static ref map< typename, ref FireConsumableType > m_FireConsumableTypes
FireConsumable GetItemToConsume()
ATTACHMENT_BARK_OAK
const string ANIMATION_OVEN
const int DIRECT_COOKING_SLOT_COUNT
direct cooking slots
const int TIMER_HEATING_UPDATE_INTERVAL
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)
ATTACHMENT_CAULDRON
const string MESSAGE_IGNITE_IN_WATER
ATTACHMENT_STICKS
float m_LightDistance
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)
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()
static bool IsEntityOnWaterSurface(notnull EntityAI entity_ai)
const float TEMPERATURE_LOSS_MP_DEFAULT
min height of ceiling for fire to be ignited
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
value for calculating temperature increase on each heat update interval (degree Celsius)
void ~FireplaceBase()
bool m_HasStoneCircle
bool m_CanNoise
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
bool m_RoofAbove
void SoundFireHeavyStart()
const float DIRECT_COOKING_SPEED
const int LIFETIME_FIREPLACE_STONE_OVEN
ATTACHMENT_GIFTWRAP
ATTACHMENT_RAGS
const float PARAM_MAX_TRANSFERED_TEMPERATURE
DEPRECATED value for calculation of heat transfered from fireplace through air to player (environment...
override void OnAttachmentRuined(EntityAI attachment)
int PARTICLE_NO_IGNITE_WIND
FireplaceFireState m_LastFireState
const string ANIMATION_TRIPOD
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
static bool IsWindy()
static bool IsEntityWet(notnull EntityAI entity_ai)
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()
const string MESSAGE_IGNITE_UNDER_LOW_ROOF
const float PARAM_MIN_FIRE_TEMPERATURE
maximum fireplace temperature of a normal 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
minimum temperature for items that can be heated in fireplace cargo or as attachments (degree Celsius...
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()
const string ANIMATION_STONES
bool GetIgniteFailure()
void RefreshFireParticlesAndSounds(bool force_refresh)
bool IsOnInteriorSurface()
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()
bool IsRoofAbove()
const string MESSAGE_CANNOT_BUILD_OVEN
void SoundFireExtinguishingStart()
void StartFire(bool force_start=false)
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
const float PARAM_BURN_WET_THRESHOLD
maximum rain value when the fireplace can be ignited
ATTACHMENT_BARK_BIRCH
ATTACHMENT_TRIPOD
ref Timer m_HeatingTimer
override bool DisassembleOnLastDetach()
void ParticleNormalFireStart()
const float FUEL_BURN_RATE_STONES
bool HasStoneCircle()
ATTACHMENT_COOKINGSTAND
void SetStoneCircleState(bool has_stonecircle)
ref UniversalTemperatureSourceLambdaFireplace m_UTSLFireplace
static bool IsRainingAboveEntity(notnull EntityAI entity_ai)
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
temperature threshold for starting coooking process (degree Celsius)
int PARTICLE_SMALL_SMOKE
const float PARAM_ITEM_HEAT_TEMP_INCREASE_COEF
value for calculating damage on items located in fireplace cargo
float m_TemperatureLossMP
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
maximum wetness value when the fireplace is able to burn
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)
override void EECargoOut(EntityAI item)
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
maximum value of temperature of items in fireplace when heating (degree Celsius)
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 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.
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
value for calculating of wetness that fireplace gain when raining
const int MIN_STONES_TO_BUILD_CIRCLE
bool HasLastAttachment()
const string ANIMATION_BURNT_WOOD
Particle m_ParticleSteamEnd
const string MESSAGE_REIGNITE_NO_KINDLING
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
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)
FoodStageType
Definition FoodStage.c:2
override void SetWet(float value, bool allow_client=false)
Definition ItemBase.c:8252
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Definition ItemBase.c:6834
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:7838
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Definition ItemBase.c:6524
bool CanHaveWetness()
Definition ItemBase.c:9226
void PlayPlaceSound()
Definition ItemBase.c:9027
override float GetTemperature()
Definition ItemBase.c:8204
void SetIsPlaceSound(bool is_place_sound)
Definition ItemBase.c:8962
bool CanHaveTemperature()
Definition ItemBase.c:9232
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Definition ItemBase.c:5867
override bool IsHologram()
Definition ItemBase.c:5641
bool IsPlaceSound()
Definition ItemBase.c:8967
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Definition ItemBase.c:6792
override int GetQuantityMax()
Definition ItemBase.c:7941
override float GetWet()
Definition ItemBase.c:8281
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)
class JsonUndergroundAreaTriggerData GetPosition
Deferred version of AreaDamageLooped.
represents base for cargo storage for entities
Definition Cargo.c:7
static proto bool RaycastRV(vector begPos, vector endPos, out vector contactPos, out vector contactDir, out int contactComponent, set< Object > results=NULL, Object with=NULL, Object ignore=NULL, bool sorted=false, bool ground_only=false, int iType=ObjIntersectView, float radius=0.0, CollisionFlags flags=CollisionFlags.NEARESTCONTACT)
Raycasts world by given parameters.
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
override bool IsOpen()
override bool CanExtinguishFire()
override bool CanCookOnStick()
override bool IsBaseFireplace()
override string GetPlaceSoundset()
override void RefreshFireplacePhysics()
Definition Fireplace.c:471
vector GetSmokeEffectPosition()
override void EEItemAttached(EntityAI item, string slot_name)
override void ParticleSmallSmokeStart()
override bool IsPrepareToDelete()
override void SetCookingEquipment(ItemBase equipment)
Definition Fireplace.c:328
override bool CanShowSmoke()
override void ParticleNormalSmokeStart()
override bool IsIndoorOven()
Definition OvenIndoor.c:153
override bool IsFireplaceIndoor()
override void OnDebugSpawn()
override void OnIgnitedThis(EntityAI fire_source)
override void CreateAreaDamage()
override void OnVariablesSynchronized()
override void AfterStoreLoad()
Definition Fireplace.c:514
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnStoreSave(ParamsWriteContext ctx)
override bool IsBarrelWithHoles()
override bool CanReleaseAttachment(EntityAI attachment)
Definition Fireplace.c:150
script counterpart to engine's class Inventory
Definition Inventory.c:79
InventoryLocation.
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
Definition EnMath.c:7
Legacy way of using particles in the game.
Definition Particle.c:7
void SetParameter(int emitter, int parameter, float value)
Set the value of a parameter of an emitor in the particle.
Definition Particle.c:603
static const int CAMP_NO_IGNITE_WIND
static const int CAMP_STOVE_FIRE_START
static const int CAMP_SMALL_SMOKE
static const int CAMP_STEAM_EXTINGUISH_START
static const int CAMP_FIRE_START
static const int CAMP_NORMAL_SMOKE
static const int CAMP_STOVE_FIRE
static const int CAMP_STEAM_2END
static const int CAMP_SMALL_FIRE
static const int CAMP_FIRE_END
static const int CAMP_NORMAL_FIRE
static const int CAMP_STOVE_FIRE_END
The class that will be instanced (moddable)
Definition gameplay.c:376
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
original Timer deletes m_params which is unwanted
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Definition EnConvert.c:271
static const vector Forward
Definition EnConvert.c:109
static const vector Zero
Definition EnConvert.c:110
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()
ErrorExSeverity
Definition EnDebug.c:62
enum ShapeType ErrorEx
const float FIRE_ATTACHMENT_DAMAGE_PER_SECOND
various damage per second constants
Definition constants.c:727
const int STATE_BADLY_DAMAGED
Definition constants.c:758
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Acos(float c)
Returns angle in radians from cosinus.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float Sin(float angle)
Returns sinus of angle in radians.
static proto float AbsFloat(float f)
Returns absolute value.
const string CFG_VEHICLESPATH
Definition constants.c:209
EmitorParam
Definition EnVisual.c:114
proto native int dBodyGetInteractionLayer(notnull IEntity ent)
const int SAT_DEBUG_ACTION
Definition constants.c:424
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8