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