DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Torch.c
См. документацию.
2{
3 const float PARAM_FULL_HEAT_RADIUS = 0.5;
4 const float PARAM_HEAT_RADIUS = 1.0;
7 const float PARAM_DRY_MODIFIER = 1.125;
8
10 {
11 Init();
12 }
13
14 private SoundOnVehicle m_LoopSoundEntity;
16 bool m_CanReceiveUpgrade; // Synchronized variable
17 bool m_IsBeingDestructed = false;
18
26
27 int m_RagsUpgradedCount;//how many rags were upgraded with fuel/lard
28 bool m_ConsumeRagFlipFlop;//are we burning rag or fuel/lard
30
31 string m_DecraftResult = "WoodenStick";
32 TorchLight m_Light;
33 bool m_WasLit;//was this item ever lit ? (used for correct material setting after reconnect for extinguished flammable items)
34
37 protected ref UniversalTemperatureSourceLambdaConstant m_UTSLConstant;
38
39 override void DeferredInit()
40 {
42 {
43 LockRags(true);
44 }
45 }
46
47 void Init()
48 {
50 {
51 string cfg_path = "CfgVehicles " + GetType();
52 m_BurnTimePerRagEx = g_Game.ConfigGetFloat( cfg_path + " burnTimePerRag" );
53 m_BurnTimePerFullLardEx = g_Game.ConfigGetFloat( cfg_path + " burnTimePerFullLardDose" );
54 m_BurnTimePerFullFuelDoseEx = g_Game.ConfigGetFloat( cfg_path + " burnTimePerFullFuelDose" );
55 m_MaxConsumableLardQuantityEx = g_Game.ConfigGetFloat( cfg_path + " maxConsumableLardDose" );
56 m_MaxConsumableFuelQuantityEx = g_Game.ConfigGetFloat( cfg_path + " maxConsumableFuelDose" );
57 }
58 RegisterNetSyncVariableBool("m_CanReceiveUpgrade");
59 }
60
61 override void EEInit()
62 {
63 super.EEInit();
64
65 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
66 {
68 m_UTSSettings.m_Updateable = true;
74 m_UTSSettings.m_ItemDryModifier = PARAM_DRY_MODIFIER;
75
76 m_UTSLConstant = new UniversalTemperatureSourceLambdaConstant();
78 }
79
80 }
81
83 {
84 if (GetHierarchyRoot())
85 {
86 return GetHierarchyRoot().GetPosition();
87 }
88
89 return super.GetPosition();
90 }
91
92 override void EEDelete(EntityAI parent)
93 {
94 super.EEDelete(parent);
95 if ( m_LoopSoundEntity != NULL && g_Game != NULL )
96 {
97 g_Game.ObjectDelete( m_LoopSoundEntity );
98 }
99
101 }
102
103 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
104 {
105 ItemBase att = ItemBase.Cast(GetInventory().FindAttachment(slotId));
106 if (att && att.IsFullQuantity())
107 return false;
108
109 return super.CanReceiveAttachment(attachment, slotId);
110 }
111
112 override bool CanPutInCargo( EntityAI parent )
113 {
114 if( !super.CanPutInCargo(parent) ) {return false;}
115 return CanBeTakenAsCargo();
116 }
117
118 override bool CanReleaseAttachment(EntityAI attachment)
119 {
120 if( !super.CanReleaseAttachment( attachment ) )
121 return false;
122 return !GetCompEM().IsWorking();
123 }
124
125 override bool CanRemoveFromCargo(EntityAI parent)
126 {
127 return CanBeTakenAsCargo();
128 }
129
130 override bool CanPutAsAttachment (EntityAI parent)
131 {
132 return !GetCompEM().IsWorking();
133 }
134
136 {
137 // Don't let players burn their pockets!
138 return !GetCompEM().IsWorking();
139 }
140
141 override bool IsIgnited()
142 {
143 return GetCompEM().IsWorking();
144 }
145
146 override bool CanIgniteItem(EntityAI ignite_target = NULL)
147 {
148 return GetCompEM().IsWorking();
149 }
150
151 override bool HasFlammableMaterial()
152 {
153 return true;
154 }
155
156 // Checkes if Torch can be ignited
157 override bool CanBeIgnitedBy(EntityAI igniter = NULL)
158 {
159 if ( !GetCompEM().CheckWetness() )
160 return false;
161
162 ItemBase rag = GetRag();
163
164 if (rag && GetCompEM().GetEnergy() < GetCompEM().GetEnergyUsage() * GetCompEM().GetUpdateInterval() )
165 {
166 if (IsRagDryEnough(rag))
167 return false;
168 }
169
170 if ( !GetCompEM().CanWork() )
171 return false;
172
173 if ( GetCompEM().GetEnergy() < 3 )
174 return false;
175
176 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
177 if (player)
178 {
179 if (this != player.GetItemInHands())//we are in player's inventory, but not in his hands
180 {
181 return false;
182 }
183 }
184
185 return true;
186 }
187
189 {
190 float wetness = rag.GetWet();
191 bool is_dry_enough = wetness <= 1-GetCompEM().GetWetnessExposure();
192 return is_dry_enough;
193 }
194
196 {
197 if ( g_Game.IsServer() || !g_Game.IsMultiplayer() )
198 {
200 SetSynchDirty();
201 }
202 }
203
204 override void OnIgnitedThis(EntityAI fire_source)
205 {
206 if ( !GetCompEM().HasEnoughStoredEnergy() )
207 {
208 ConsumeRag();
209 }
210
211 GetCompEM().SwitchOn();
212 }
213
214 override void OnSwitchOn()
215 {
216 if (!GetCompEM().HasEnoughStoredEnergy())
217 {
218 GetCompEM().SwitchOff();
219 }
220
221 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
222 {
223 m_UTSource.SetActive(true);
224 }
225 }
226
227 override void OnSwitchOff()
228 {
229 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
230 {
231 m_UTSource.SetActive(false);
232 }
233 }
234
235 void SetTorchDecraftResult(string type)
236 {
237 m_DecraftResult = type; //not persistent for the moment
238 }
239
241 {
242 ItemBase rag = GetRag();
243
244 if (rag)
245 {
246 if (rag.GetQuantity() <= 1)
247 {
248 LockRags(false); // Unlock attachment slot before deletion. Otherwise it will get stuck locked and unusable.
249 }
250
251 rag.AddQuantity(-1);
252 rag.SetHealth(0);
253 //GetCompEM().AddEnergy( m_BurnTimePerRagEx );
254 return true;
255 }
256
257 return false;
258 }
259
260 void ConsumeLard(Lard lard)
261 {
262 if (lard)
263 {
264 float lard_quant = lard.GetQuantity();
265
266 float available_lard_quant = lard_quant;
267
268 if ( available_lard_quant > m_MaxConsumableLardQuantityEx )
269 available_lard_quant = m_MaxConsumableLardQuantityEx;
270
271 float available_lard_coef = available_lard_quant / m_MaxConsumableLardQuantityEx;
272
273 float add_energy = m_BurnTimePerFullLardEx * available_lard_coef;
274 float add_energy_coef = 1;
275
276 float energy_limit = GetCompEM().GetEnergyMax() - GetCompEM().GetEnergy();
277
278 if (add_energy > energy_limit )
279 {
280 add_energy_coef = energy_limit / add_energy;
281 add_energy = energy_limit;
282 available_lard_quant = available_lard_quant * add_energy_coef;
283 }
284
285 GetCompEM().AddEnergy( add_energy );
286 lard.AddQuantity(-available_lard_quant);
287
289
291 }
292 }
293
294 void Upgrade(ItemBase source)
295 {
296 if (!GetRag())
297 {
298 return;
299 }
300 RuinRags();
301 LockRags(true);
302 float torchCurrentEnergy = GetCompEM().GetEnergy();
303 float sourceQuantity = 100000;//for upgrade from environment(gas pump)
304
305 if (source)
306 {
307 sourceQuantity = source.GetQuantity();
308 }
309
310 float maxOverallCapacity = GetRagQuantity() * 2 * m_BurnTimePerRagEx;
311 //float maxUpgradeCapacity = GetRagQuantity() * m_BurnTimePerRagEx;
312 float currentlyUpgraded = Math.Max(0, torchCurrentEnergy - (GetRagQuantity() * m_BurnTimePerRagEx));
313 //float freeUpgradeCapacity = maxUpgradeCapacity - currentlyUpgraded;
314 float freeUpgradeCapacity = maxOverallCapacity - torchCurrentEnergy;
315 float upgradeQuantity = Math.Min(freeUpgradeCapacity, sourceQuantity);
316 int upgradedRags = Math.Ceil((upgradeQuantity + currentlyUpgraded) / m_BurnTimePerRagEx);
317 upgradedRags = Math.Min(GetRagQuantity(), upgradedRags);
318 m_RagsUpgradedCount = upgradedRags;
319 GetCompEM().AddEnergy(upgradeQuantity);
320 m_ConsumeRagFlipFlop = 0;//consume fuel first
321 if (source)
322 {
323 source.AddQuantity(-upgradeQuantity);
324 }
327 }
328
329
330
332 {
333 if (vessel)
334 {
335 float vessel_quant = vessel.GetQuantity();
336
337 float available_vessel_quant = vessel_quant;
338
339 if ( available_vessel_quant > m_MaxConsumableFuelQuantityEx )
340 available_vessel_quant = m_MaxConsumableFuelQuantityEx;
341
342 float available_vessel_coef = available_vessel_quant / m_MaxConsumableFuelQuantityEx;
343
344 float add_energy = m_BurnTimePerFullFuelDoseEx * available_vessel_coef;
345 float add_energy_coef = 1;
346
347 float energy_limit = GetCompEM().GetEnergyMax() - GetCompEM().GetEnergy();
348
349 if (add_energy > energy_limit )
350 {
351 add_energy_coef = energy_limit / add_energy;
352 add_energy = energy_limit;
353 available_vessel_quant = available_vessel_quant * add_energy_coef;
354 }
355
356 GetCompEM().AddEnergy( add_energy );
357 vessel.AddQuantity(-available_vessel_quant);
358
360
362 }
363 }
364
366 {
367 float add_energy = m_BurnTimePerFullFuelDoseEx;
368 float add_energy_coef = 1;
369
370 float energy_limit = GetCompEM().GetEnergyMax() - GetCompEM().GetEnergy();
371
372 if (add_energy > energy_limit )
373 {
374 add_energy_coef = energy_limit / add_energy;
375 add_energy = energy_limit;
376 }
377
378 GetCompEM().AddEnergy( add_energy );
381 }
382
383 void RuinRags()
384 {
385 ItemBase rag = GetRag();
386
387 if (rag)
388 {
389 rag.SetHealth(1); //does not actually ruin rags, combining would be impossible
390 }
391 }
392
393 // Inventory manipulation
394 override void OnInventoryExit(Man player)
395 {
396 super.OnInventoryExit(player);
397
398 StandUp();
399 }
400
401 // Stands up the torch, if possible. Returns true on success.
402 bool StandUp()
403 {
404 string surface_type;
405 vector position = GetPosition();
406 g_Game.SurfaceGetType ( position[0], position[2], surface_type );
407 bool is_surface_soft = g_Game.IsSurfaceDigable(surface_type);
408
409 if ( is_surface_soft && !IsRuined() )
410 {
411 vector ori_rotate = "0 0 0";
412 ori_rotate[0] = Math.RandomFloat(0, 360);
413 ori_rotate[1] = Math.RandomFloat(0, 10);
414 SetOrientation(ori_rotate);
415
416 return true; // I am standing up
417 }
418
419 return false; // I am NOT standing up
420 }
421
423 {
424 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
425 {
426 SetQuantityNormalized(GetCompEM().GetEnergy0To1());
427 }
428 }
429
431 {
432 return m_CanReceiveUpgrade;
433 }
434
435 void CraftingInit(float quantity)
436 {
437 GetCompEM().SetEnergy(m_BurnTimePerRagEx * quantity);
438 m_CanReceiveUpgrade = true;
439 SetSynchDirty();
440 }
441
442
443 override void EEItemAttached( EntityAI item, string slot_name )
444 {
445 super.EEItemAttached( item, slot_name );
448 }
449
450
451 override void EEItemDetached( EntityAI item, string slot_name )
452 {
453 super.EEItemDetached( item, slot_name );
454
456 {
457 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
458 {
459 EntityAI rags = EntityAI.Cast(g_Game.CreateObjectEx(item.GetType(), GetPosition(), ECE_PLACE_ON_SURFACE));
460 if( rags )
461 MiscGameplayFunctions.TransferItemProperties(item, rags);
462 }
463 return;
464 }
465
468 g_Game.GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( TryTransformIntoStick, 100);
469 }
470
472 {
473 if ((g_Game.IsServer() || !g_Game.IsMultiplayer()) && !IsIgnited() && !GetRag() && !IsSetForDeletion() )
474 return true;
475 else
476 return false;
477 }
478
480 {
481 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
482 if ( m_IsBeingDestructed || (player && player.IsPlayerDisconnected()) )
483 return;
484
485 if ( CanTransformIntoStick() )
486 {
487 m_IsBeingDestructed = true;
488 if (player)
489 {
490 // Transform object into wooden stick
492
493 TorchLambda lambda = new TorchLambda(this, m_DecraftResult);
494 player.ServerReplaceItemInHandsWithNew(lambda);
495 }
496 else
497 {
498 // Create wooden stick and delete Torch
499 vector pos = GetPosition();
500 vector ori = GetOrientation();
501
502 if ( GetType() == "WoodenStick" )
503 ori = ori + Vector(0,90,0);
504
505 ItemBase stick = ItemBase.Cast( g_Game.CreateObjectEx(m_DecraftResult, pos, ECE_PLACE_ON_SURFACE) );
507 stick.SetPosition(pos);
508 stick.PlaceOnSurface();
509
510 if ( stick.GetType() == "LongWoodenStick" )
511 {
512 pos = stick.GetPosition() + Vector(0,-0.3,0);
513 stick.SetPosition(pos);
514 }
515
516 stick.SetOrientation(ori);
517 g_Game.ObjectDelete(this);
518 }
519 }
520 }
521
522
523 override void OnWorkStart()
524 {
525 m_WasLit = true;
526 LockRags(true);
528 }
529
531 {
532 if (m_FireParticle)
533 {
534 m_FireParticle.Stop();
535 }
536 }
537
538 Rag GetRag()
539 {
540 return Rag.Cast( GetAttachmentByType(Rag) );
541 }
542
543 void LockRags(bool do_lock)
544 {
545 ItemBase rag = GetRag();
546 if (rag)
547 {
548 if (do_lock)
549 {
550 rag.LockToParent();
551 }
552 else if (!m_RagsUpgradedCount)
553 {
554 rag.UnlockFromParent();
555 }
556 }
557 }
558
560 {
561 if (!m_Light)
562 {
563 m_Light = TorchLight.Cast( ScriptedLightBase.CreateLight( TorchLight, Vector(0,0,0), 1 ) );
564 m_Light.AttachOnObject(this, m_ParticleLocalPos + Vector (0,0.2,0));
565 }
566
567 if (m_FireParticle)
568 {
569 Object direct_particle = m_FireParticle.GetDirectParticleEffect();
570
571 if (direct_particle && direct_particle != m_Light.GetAttachmentParent())
572 {
573 m_Light.AttachOnObject(direct_particle, Vector(0,0.2,0));
574 }
575 }
576
577 float update_interval = GetCompEM().GetUpdateInterval();
578
580 {
581 float brightness_coef = GetQuantity() / m_StartFadeOutOfLightAtQuantityEx;
582 float radius_coef = GetQuantity() / m_StartFadeOutOfLightAtQuantityEx;
583
584 if (radius_coef < m_StartFadeOutOfLightAtQuantityEx/10)
585 radius_coef = m_StartFadeOutOfLightAtQuantityEx/10;
586
587 if (brightness_coef < m_StartFadeOutOfLightAtQuantityEx/10)
588 brightness_coef = m_StartFadeOutOfLightAtQuantityEx/10;
589
590 m_Light.FadeBrightnessTo(m_Light.m_TorchBrightness * brightness_coef, update_interval);
591 m_Light.FadeRadiusTo(m_Light.m_TorchRadius * radius_coef, update_interval);
592 }
593 else
594 {
595 m_Light.FadeBrightnessTo(m_Light.m_TorchBrightness, update_interval);
596 m_Light.FadeRadiusTo(m_Light.m_TorchRadius, update_interval);
597 }
598 }
599
601 {
602 GetCompEM().SwitchOff();
603 }
604
605
606 override void OnWork( float consumed_energy )
607 {
609 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
610 {
611 if (GetCompEM().GetEnergy() < ((GetRagQuantity() + m_RagsUpgradedCount) - 1) * m_BurnTimePerRagEx)
612 {
613 if (m_RagsUpgradedCount==0)//always burn rag
614 {
615 ConsumeRag();
616 }
617 else if (m_ConsumeRagFlipFlop)//burn rag
618 {
619 ConsumeRag();
621 }
622 else//burn lard/fuel
623 {
626 }
627 }
628 if (GetRag() && GetCompEM().GetEnergy() == 0 && GetRagQuantity() > 0)
629 {
630 GetRag().SetQuantity(0);
631 }
632 RuinRags();
633
635
637
638 AddWet( -m_WaterEvaporationByFireIntensityEx * GetCompEM().GetUpdateInterval() );
639
640 Rag rag = GetRag();
641
642 if ( rag )
643 {
644 rag.AddWet( -m_WaterEvaporationByFireIntensityEx * GetCompEM().GetUpdateInterval() );
645 }
646 }
647
648 if ( !m_LoopSoundEntity && g_Game && ( !g_Game.IsDedicatedServer() ) )
649 {
650 m_LoopSoundEntity = PlaySoundLoop(GetSoundName(), 50);
651 }
652
653 // Effect scaling by fuel
654 if ( !g_Game.IsDedicatedServer() )
655 {
656 UpdateLight();
658 }
659 }
660
661
663 {
664 return "torchLoop";
665 }
666
668 {
669 if ( GetQuantity() < 40 )
670 {
671 if (!m_FireParticle)
672 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.TORCH_T1, this, m_ParticleLocalPos);
673
674 float scale = GetQuantity() / 40;
675
676 if (scale > 1)
677 scale = 1;
678
679 if (scale < 0.25)
680 scale = 0.25;
681
682 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.SIZE, scale);
683 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY, scale);
684 m_FireParticle.ScaleParticleParamFromOriginal(EmitorParam.VELOCITY_RND, scale);
685 }
686 else
687 {
688 if ( !m_FireParticle || m_FireParticle.GetParticleID() != ParticleList.TORCH_T2 )
689 {
690 // Executes once when fire particle starts or changes
691
692 if (m_FireParticle)
693 m_FireParticle.Stop();
694
695 m_FireParticle = ParticleManager.GetInstance().PlayOnObject(ParticleList.TORCH_T2, this, m_ParticleLocalPos);
696 }
697 }
698
699 }
700
701 override void OnWorkStop()
702 {
704 if (m_Light)
705 m_Light.FadeOut();
706
707 if ( m_LoopSoundEntity && g_Game && ( !g_Game.IsDedicatedServer() ) )
708 {
709 g_Game.ObjectDelete( m_LoopSoundEntity );
710 m_LoopSoundEntity = NULL;
711 }
712
713 if ( m_FireParticle)
714 {
715 m_FireParticle.Stop();
716 m_FireParticle = NULL;
717 }
718
721
722 LockRags(false);
723
724 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
725 {
726 if (GetRag() && GetCompEM().GetEnergy() == 0 && GetRagQuantity() > 0)
727 {
728 GetRag().SetQuantity(0);
729 }
730 }
731
733 }
734
735 // COMBAT
736 // This needs refactor!
737 override int GetMeleeMode()
738 {
739 if ( GetCompEM().IsWorking() )
740 return 3; // ???
741 else
742 return 0; // ???
743 }
744
745 override int GetMeleeHeavyMode()
746 {
747 if ( GetCompEM().IsWorking() )
748 return 4; // ???
749 else
750 return 1; // ???
751 }
752
753 override int GetMeleeSprintMode()
754 {
755 if ( GetCompEM().IsWorking() )
756 return 5; // ???
757 else
758 return 2; // ???
759 }
760
761 override void SetActions()
762 {
763 super.SetActions();
764
766 }
767
768 override void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
769 {
770 super.OnAttachmentQuantityChangedEx(item, delta);
771 if (delta != 0)
772 {
773 if (delta > 0 || !GetCompEM().IsWorking()) // dont adjust energy when rag burns out
774 GetCompEM().AddEnergy(m_BurnTimePerRagEx * delta);
775
778 }
779 }
780
781
783 {
784 return true;
785 }
786
787 override void OnDebugSpawn()
788 {
789 GetInventory().CreateAttachment("Rag");
792 }
793
795 {
796 if (GetRag())
797 {
798 return Math.Round(GetRag().GetQuantity());
799 }
800 return 0;
801 }
802
804 {
805 return "";
806 }
807
809 {
810 return "";
811 }
812
814 {
815 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
816 {
817 if (GetCompEM().IsWorking())
818 {
819 if (GetBurningMaterial())
820 {
821 SetObjectMaterial(0, GetBurningMaterial());
822 }
823 }
824 else if (m_WasLit)
825 {
826 if (GetBurntMaterial())
827 {
828 SetObjectMaterial(0, GetBurntMaterial());
829 }
830 }
831 }
832 }
833
834
836 {
837 super.OnStoreSave(ctx);
838 ctx.Write(m_WasLit);
839 }
840
841
842 override bool OnStoreLoad( ParamsReadContext ctx, int version )
843 {
844 if (!super.OnStoreLoad(ctx, version))
845 {
846 return false;
847 }
848 if (version >= 130)
849 {
850 if (!ctx.Read( m_WasLit ))
851 {
852 return false;
853 }
854 }
856 return true;
857 }
858
860 {
861 result.SetQuantity(1);
862 }
863
864 //-------------
865 // DEBUG BELLOW
866 //-------------
867 #ifdef DEVELOPER
868 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
869 {
870 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ACTIVATE_ENTITY, "Ignite", FadeColors.LIGHT_GREY));
871 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
872
873 super.GetDebugActions(outputList);
874 }
875
876 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
877 {
878 if (super.OnAction(action_id, player, ctx))
879 return true;
880 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
881 {
882 if (action_id == EActions.ACTIVATE_ENTITY)
883 {
884 OnIgnitedThis(null);
885 }
886
887 }
888 return false;
889 }
890
891 override string GetDebugText()
892 {
893 string debug_output;
894
895 debug_output = super.GetDebugText();
896
897 if( g_Game.IsDedicatedServer())
898 {
899 debug_output+="m_RagsUpgradedCount:"+m_RagsUpgradedCount+"\n";
900 debug_output+="m_ConsumeRagFlipFlop:"+m_ConsumeRagFlipFlop+"\n";
902 {
903 debug_output+="Burning rag \n";
904 }
905 else if (IsIgnited())
906 {
907 debug_output+="Burning lard/fuel \n";
908 }
909 }
910 else
911 {
912
913 }
914 return debug_output;
915 }
916 #endif
917}
918
919
920class Torch : FlammableBase
921{
922 //legacy vars which cannot be moved/removed
923 static float m_BurnTimePerRag;
930
931
932 override void Init()
933 {
934 super.Init();
935
936 //for legacy reasons
937 m_BurnTimePerRag = m_BurnTimePerRagEx;
938 m_BurnTimePerFullLard = m_BurnTimePerFullLardEx;
939 m_BurnTimePerFullFuelDose = m_BurnTimePerFullFuelDoseEx;
940 m_MaxConsumableLardQuantity = m_MaxConsumableLardQuantityEx;
941 m_MaxConsumableFuelQuantity = m_MaxConsumableFuelQuantityEx;
942 }
943
944 override void SetActions()
945 {
946 super.SetActions();
947
950 }
951
952 // !Called on CHILD when it's attached to parent.
953 override void OnWasAttached( EntityAI parent, int slot_id )
954 {
955 super.OnWasAttached(parent, slot_id);
956 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
957 LockRags(true);
958 }
959
960 // !Called on CHILD when it's detached from parent.
961 override void OnWasDetached( EntityAI parent, int slot_id )
962 {
963 super.OnWasDetached(parent, slot_id);
964 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
965 LockRags(false);
966 }
967
968
970 {
971 super.OnStoreSave(ctx);
972 ctx.Write(m_ConsumeRagFlipFlop);
973 ctx.Write(m_RagsUpgradedCount);
974 }
975
976
977 override bool OnStoreLoad( ParamsReadContext ctx, int version )
978 {
979 if (!super.OnStoreLoad(ctx, version))
980 {
981 return false;
982 }
983
984 if (version >= 129)
985 {
986 if (!ctx.Read( m_ConsumeRagFlipFlop ))
987 {
988 return false;
989 }
990
991 if (!ctx.Read( m_RagsUpgradedCount ))
992 {
993 return false;
994 }
995 }
996 UpdateCheckForReceivingUpgrade();
997 return true;
998 }
999};
1000
1002{
1003 override void CopyOldPropertiesToNew (notnull EntityAI old_item, EntityAI new_item)
1004 {
1005 super.CopyOldPropertiesToNew(old_item, new_item);
1006
1007 ItemBase stick;
1008 FlammableBase flammable = FlammableBase.Cast(old_item);
1009 Class.CastTo(stick, new_item);
1010 if (stick && flammable)
1011 {
1012 flammable.ApplyResultModifications(stick);
1013 }
1014 }
1015};
Param4< int, int, string, int > TSelectableActionInfoWithColor
eBleedingSourceType GetType()
ActionLightItemOnFireCB ActionContinuousBaseCB ActionLightItemOnFire()
Определения ActionLightItemOnFire.c:11
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void SetActions()
Определения AdvancedCommunication.c:213
vector GetOrientation()
Определения AreaDamageManager.c:306
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
DayZGame g_Game
Определения DayZGame.c:3942
override Widget Init()
Определения DayZGame.c:127
EActions
Определения EActions.c:2
override float GetQuantity()
Определения ItemBase.c:8398
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8321
float GetEnergy()
Определения ItemBase.c:8525
override void AddWet(float value)
Определения ItemBase.c:8611
override void OnWasAttached(EntityAI parent, int slot_id)
Определения ItemBase.c:6288
string GetDebugText()
Определения ModifierBase.c:71
void OnStoreSave(ParamsWriteContext ctx)
Определения ModifiersManager.c:229
bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения ModifiersManager.c:265
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
override void OnWasDetached(EntityAI parent, int slot_id)
Определения RemoteDetonator.c:237
static float m_BurnTimePerFullLard
Определения Torch.c:924
static int m_StartFadeOutOfLightAtQuantity
Определения Torch.c:929
static float m_MaxConsumableFuelQuantity
Определения Torch.c:927
static float m_BurnTimePerFullFuelDose
Определения Torch.c:925
static float m_WaterEvaporationByFireIntensity
Определения Torch.c:928
FlammableBase m_BurnTimePerRag
static float m_MaxConsumableLardQuantity
Определения Torch.c:926
Super root of all classes in Enforce script.
Определения EnScript.c:11
void ConsumeFuelFromGasStation()
Определения Torch.c:365
const float PARAM_DRY_MODIFIER
maximum value for temperature that will be transfered to player (environment)
Определения Torch.c:7
override void OnDebugSpawn()
Определения Torch.c:787
int m_RagsUpgradedCount
Определения Torch.c:27
override bool CanPutInCargo(EntityAI parent)
Определения Torch.c:112
void UpdateLight()
Определения Torch.c:559
void RuinRags()
Определения Torch.c:383
void ApplyResultModifications(ItemBase result)
Определения Torch.c:859
bool IsRagDryEnough(ItemBase rag)
Определения Torch.c:188
override void OnInventoryExit(Man player)
Определения Torch.c:394
Rag GetRag()
Определения Torch.c:538
bool m_WasLit
Определения Torch.c:33
override int GetMeleeMode()
Определения Torch.c:737
void FlammableBase()
Определения Torch.c:9
bool CanBeTakenAsCargo()
Определения Torch.c:135
float m_MaxConsumableFuelQuantityEx
Определения Torch.c:23
void UpdateCheckForReceivingUpgrade()
Определения Torch.c:195
float m_BurnTimePerFullLardEx
Определения Torch.c:20
void ConsumeLard(Lard lard)
Определения Torch.c:260
vector m_ParticleLocalPos
Определения Torch.c:29
override bool IsIgnited()
Определения Torch.c:141
override bool CanReleaseAttachment(EntityAI attachment)
Определения Torch.c:118
bool CanTransformIntoStick()
Определения Torch.c:471
ref UniversalTemperatureSource m_UTSource
Определения Torch.c:35
bool m_IsBeingDestructed
Определения Torch.c:17
const int TIMER_HEATING_UPDATE_INTERVAL
Определения Torch.c:5
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения Torch.c:842
SoundOnVehicle m_LoopSoundEntity
Определения Torch.c:14
override void OnIgnitedThis(EntityAI fire_source)
Определения Torch.c:204
override void EEInit()
Определения Torch.c:61
override void SetActions()
Определения Torch.c:761
void CraftingInit(float quantity)
Определения Torch.c:435
override void OnWork(float consumed_energy)
Определения Torch.c:606
override void OnStoreSave(ParamsWriteContext ctx)
Определения Torch.c:835
int GetRagQuantity()
Определения Torch.c:794
override void OnWorkStop()
Определения Torch.c:701
void TryTransformIntoStick()
Определения Torch.c:479
bool m_ConsumeRagFlipFlop
Определения Torch.c:28
override void DeferredInit()
Определения Torch.c:39
override void EEDelete(EntityAI parent)
Определения Torch.c:92
void Upgrade(ItemBase source)
Определения Torch.c:294
override void EEItemDetached(EntityAI item, string slot_name)
Определения Torch.c:451
void LockRags(bool do_lock)
Определения Torch.c:543
const float PARAM_MAX_TRANSFERED_TEMPERATURE
update interval duration of heating process (seconds)
Определения Torch.c:6
override bool CanRemoveFromCargo(EntityAI parent)
Определения Torch.c:125
override void OnSwitchOff()
Определения Torch.c:227
string GetBurningMaterial()
Определения Torch.c:803
float m_BurnTimePerFullFuelDoseEx
Определения Torch.c:21
bool StandUp()
Определения Torch.c:402
override bool CanBeIgnitedBy(EntityAI igniter=NULL)
Определения Torch.c:157
float m_WaterEvaporationByFireIntensityEx
Определения Torch.c:24
ref UniversalTemperatureSourceLambdaConstant m_UTSLConstant
Определения Torch.c:37
void SetTorchDecraftResult(string type)
Определения Torch.c:235
override void OnSwitchOn()
Определения Torch.c:214
TorchLight m_Light
Определения Torch.c:32
Particle m_FireParticle
Определения Torch.c:15
override void OnWorkStart()
Определения Torch.c:523
void UpdateMaterial()
Определения Torch.c:813
void CalculateQuantity()
Определения Torch.c:422
void StopAllParticles()
Определения Torch.c:530
override void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Определения Torch.c:768
ref UniversalTemperatureSourceSettings m_UTSSettings
Определения Torch.c:36
override bool DisassembleOnLastDetach()
Определения Torch.c:782
float m_MaxConsumableLardQuantityEx
Определения Torch.c:22
float m_BurnTimePerRagEx
Определения Torch.c:19
bool m_CanReceiveUpgrade
Определения Torch.c:16
const float PARAM_HEAT_RADIUS
Определения Torch.c:4
const float PARAM_FULL_HEAT_RADIUS
Определения Torch.c:3
override vector GetUniversalTemperatureSourcePosition()
Определения Torch.c:82
int m_StartFadeOutOfLightAtQuantityEx
Определения Torch.c:25
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения Torch.c:103
bool CanReceiveUpgrade()
Определения Torch.c:430
string m_DecraftResult
Определения Torch.c:31
override int GetMeleeSprintMode()
Определения Torch.c:753
override bool CanIgniteItem(EntityAI ignite_target=NULL)
Определения Torch.c:146
override int GetMeleeHeavyMode()
Определения Torch.c:745
void UpdateParticle()
Определения Torch.c:667
override bool CanPutAsAttachment(EntityAI parent)
Определения Torch.c:130
override void EEItemAttached(EntityAI item, string slot_name)
Определения Torch.c:443
void ConsumeFuelFromBottle(ItemBase vessel)
Определения Torch.c:331
bool ConsumeRag()
Определения Torch.c:240
override bool HasFlammableMaterial()
Определения Torch.c:151
void Init()
Определения Torch.c:47
override void OnItemInHandsPlayerSwimStart(PlayerBase player)
Определения Torch.c:600
string GetBurntMaterial()
Определения Torch.c:808
string GetSoundName()
Определения Torch.c:662
Определения Torch.c:2
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения PowerGenerator.c:397
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения PowerGenerator.c:409
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:982
Определения EnMath.c:7
Определения ObjectTyped.c:2
Legacy way of using particles in the game.
Определения Particle.c:7
static const int TORCH_T2
Определения ParticleList.c:76
static const int TORCH_T1
Определения ParticleList.c:75
Определения ParticleList.c:12
Определения PlayerBaseClient.c:2
void ReplaceItemWithNewLambdaBase(EntityAI old_item, string new_item_type)
Определения ReplaceItemWithNewLambdaBase.c:13
proto bool Write(void value_out)
proto bool Read(void value_in)
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Определения Torch.c:1003
Определения Torch.c:1002
original Timer deletes m_params which is unwanted
Определения UniversalTemperatureSource.c:39
Определения EnConvert.c:119
Serializer ParamsReadContext
Определения gameplay.c:15
Serializer ParamsWriteContext
Определения gameplay.c:16
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/DayZ/constants.c:811
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Round(float f)
Returns mathematical round of value.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static proto float Ceil(float f)
Returns ceil of value.
EmitorParam
Определения EnVisual.c:114
const int SAT_DEBUG_ACTION
Определения 3_Game/DayZ/constants.c:457
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/DayZ/tools/tools.c:8