Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ExplosiveFuzeTimerAttribute.c
Go to the documentation of this file.
1
4{
5 //------------------------------------------------------------------------------------------------
6 override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
7 {
9 if (!editableEntity)
10 return null;
11
12 IEntity owner = editableEntity.GetOwner();
13 if (!owner)
14 return null;
15
17 if (!explosiveComp)
18 return null;
19
20 ChimeraWorld world = ChimeraWorld.CastFrom(GetGame().GetWorld());
21 if (!world)
22 return null;
23
24 TimeAndWeatherManagerEntity timeAndWeatherManager = world.GetTimeAndWeatherManager();
25 if (!timeAndWeatherManager)
26 return null;
27
28 int fuzeTime;
29 if (explosiveComp.GetUsedFuzeType() == SCR_EFuzeType.TIMED)
30 fuzeTime = explosiveComp.GetTimeOfDetonation() - timeAndWeatherManager.GetEngineTime();
31
32 //~ No current timer so use default
33 if (fuzeTime <= 0)
34 fuzeTime = explosiveComp.GetFuzeTime();
35
36 //~ No fuze time so do not show attribute
37 if (fuzeTime <= 0)
38 return null;
39
41 }
42
43 //------------------------------------------------------------------------------------------------
44 override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
45 {
46 if (!var)
47 return;
48
50 if (!editableEntity)
51 return;
52
53 IEntity owner = editableEntity.GetOwner();
54 if (!owner)
55 return;
56
58 if (!explosiveComp)
59 return;
60
61 if (explosiveComp.GetUsedFuzeType() != SCR_EFuzeType.NONE)
62 explosiveComp.DisarmChargeSilent();
63
64 explosiveComp.SetFuzeTime(var.GetFloat(), true);
65 explosiveComp.ArmWithTimedFuze(true);
66 }
67}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_EFuzeType
Enum with all types of fuzes.
proto external Managed FindComponent(typename typeName)
static SCR_BaseEditorAttributeVar CreateFloat(float value)
void DisarmChargeSilent()
Callback method to ensure that charge is disarmed when transferred but with no sound.
void ArmWithTimedFuze(bool silent=false)
Arms the charge and starts the timer for the detonation.
void SetFuzeTime(float fuzeDelay, bool silent=false)
Change the time which will be used for timed fuze.
Explosive trigger attribute for manipulating the time that remains until the detonation.