Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AdjustTimedFuzeAction.c
Go to the documentation of this file.
2{
4
5 //------------------------------------------------------------------------------------------------
6 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
7 {
8 super.Init(pOwnerEntity, pManagerComponent);
9
11 }
12
13 //------------------------------------------------------------------------------------------------
14 override bool CanBeShownScript(IEntity user)
15 {
16 if (!m_ChargeComp || m_ChargeComp.GetUsedFuzeType() != SCR_EFuzeType.NONE)
17 return false;
18
19 return super.CanBeShownScript(user);
20 }
21
22 override bool GetActionNameScript(out string outName)
23 {
24 UIInfo actionInfo = GetUIInfo();
25 if (!actionInfo)
26 return false;
27
28 outName = WidgetManager.Translate(actionInfo.GetName(), m_ChargeComp.GetFuzeTime());
29 return true;
30 }
31
32 //------------------------------------------------------------------------------------------------
33 override float GetActionProgressScript(float fProgress, float timeSlice)
34 {
35 if (GetMaximumValue() - GetMinimumValue() != 0)
36 return (m_fTargetValue - GetMinimumValue()) / (GetMaximumValue() - GetMinimumValue());
37
38 return 0;
39 }
40
41 //------------------------------------------------------------------------------------------------
44 override protected bool OnSaveActionData(ScriptBitWriter writer)
45 {
46 if (float.AlmostEqual(m_fTargetValue, m_ChargeComp.GetFuzeTime()))
47 return false;
48
49 return super.OnSaveActionData(writer);
50 }
51
52 //------------------------------------------------------------------------------------------------
56 override protected bool OnLoadActionData(ScriptBitReader reader)
57 {
58 if (!super.OnLoadActionData(reader))
59 return false;
60
61 if (m_ChargeComp)
62 m_ChargeComp.SetFuzeTime(m_fTargetValue);
63
64 return true;
65 }
66}
SCR_EFuzeType
Enum with all types of fuzes.
proto external Managed FindComponent(typename typeName)
float m_fTargetValue
Normalized current value.
SCR_ExplosiveChargeComponent m_ChargeComp
override bool CanBeShownScript(IEntity user)
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
bool OnLoadActionData(ScriptBitReader reader)
override bool GetActionNameScript(out string outName)
bool OnSaveActionData(ScriptBitWriter writer)
override float GetActionProgressScript(float fProgress, float timeSlice)
UIInfo - allows to define UI elements.
Definition UIInfo.c:14