Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_AdjustShellTimeFuzeAction.c
Go to the documentation of this file.
1
class
SCR_AdjustShellTimeFuzeAction
:
SCR_AdjustSignalAction
2
{
3
protected
SCR_MortarShellGadgetComponent
m_ShellGadgetComp
;
4
protected
ChimeraCharacter
m_Character
;
5
protected
SCR_ShellConfig
m_ShellConfig
;
6
7
//------------------------------------------------------------------------------------------------
8
override
void
Init
(
IEntity
pOwnerEntity,
GenericComponent
pManagerComponent)
9
{
10
super.Init(pOwnerEntity, pManagerComponent);
11
12
m_ShellGadgetComp
= SCR_MortarShellGadgetComponent.Cast(pOwnerEntity.
FindComponent
(SCR_MortarShellGadgetComponent));
13
}
14
15
//------------------------------------------------------------------------------------------------
16
override
bool
CanBeShownScript
(
IEntity
user)
17
{
18
ChimeraCharacter
character =
ChimeraCharacter
.Cast(user);
19
if
(!character)
20
return
false
;
21
22
CharacterControllerComponent characterController = character.GetCharacterController();
23
if
(!characterController || characterController.GetInspectEntity() !=
GetOwner
())
24
return
false
;
25
26
if
(!
m_ShellGadgetComp
|| !
m_ShellGadgetComp
.IsUsingTimeFuze() ||
m_ShellGadgetComp
.IsLoaded())
27
return
false
;
28
29
if
(!
m_ShellConfig
)
30
{
31
m_ShellConfig
=
m_ShellGadgetComp
.GetSavedConfig(character);
32
if
(
m_ShellConfig
)
33
m_fTargetValue
=
m_ShellConfig
.GetSavedTime();
34
}
35
36
return
super.CanBeShownScript(user);
37
}
38
39
//------------------------------------------------------------------------------------------------
40
override
bool
GetActionNameScript
(out
string
outName)
41
{
42
if
(!
m_ShellGadgetComp
)
43
return
false
;
44
45
UIInfo
actionInfo =
GetUIInfo
();
46
if
(!actionInfo)
47
return
false
;
48
49
50
if
(!
m_ShellConfig
|| !
m_ShellConfig
.IsUsingManualTime())
51
{
52
outName = actionInfo.GetName();
53
}
54
else
55
{
56
string
fuzeTime =
WidgetManager
.Translate(
UIConstants
.VALUE_UNIT_SECONDS,
m_ShellConfig
.GetSavedTime().ToString(-1, 1));
57
outName =
WidgetManager
.Translate(actionInfo.GetDescription(), fuzeTime);
58
}
59
60
return
true
;
61
}
62
63
//------------------------------------------------------------------------------------------------
64
override
float
SCR_GetCurrentValue
()
65
{
66
if
(
m_ShellConfig
)
67
return
m_ShellConfig
.GetSavedTime();
68
69
if
(
m_ShellGadgetComp
)
70
return
m_ShellGadgetComp
.GetFuzeTime();
71
72
return
super.SCR_GetCurrentValue();
73
}
74
75
//------------------------------------------------------------------------------------------------
76
protected
override
float
SCR_GetMinimumValue
()
77
{
78
if
(
m_ShellGadgetComp
)
79
return
m_ShellGadgetComp
.GetMinFuzeTime() -
m_fAdjustmentStep
;
//to allow for resetting the time fuze to automatic mode by going below min value
80
81
return
super.SCR_GetMinimumValue();
82
}
83
84
//------------------------------------------------------------------------------------------------
85
protected
override
float
SCR_GetMaximumValue
()
86
{
87
if
(
m_ShellGadgetComp
)
88
return
m_ShellGadgetComp
.GetMaxFuzeTime();
89
90
return
super.SCR_GetMaximumValue();
91
}
92
93
//------------------------------------------------------------------------------------------------
94
override
float
GetActionProgressScript
(
float
fProgress,
float
timeSlice)
95
{
96
SCR_MortarShellGadgetComponentClass
data
=
SCR_MortarShellGadgetComponentClass
.Cast(
m_ShellGadgetComp
.GetComponentData(
m_ShellGadgetComp
.GetOwner()));
97
if
(
data
&&
data
.IsUsingTimeFuze() &&
data
.GetMaxFuzeTime() >
data
.GetMinFuzeTime())
98
return
(
m_fTargetValue
-
data
.GetMinFuzeTime()) / (
data
.GetMaxFuzeTime() -
data
.GetMinFuzeTime());
99
100
return
0;
101
}
102
103
override
void
OnActionStart
(
IEntity
pUserEntity)
104
{
105
m_Character
=
ChimeraCharacter
.Cast(pUserEntity);
106
107
super.OnActionStart(pUserEntity);
108
}
109
110
//------------------------------------------------------------------------------------------------
113
override
protected
bool
OnSaveActionData
(ScriptBitWriter writer)
114
{
115
if
(
float
.AlmostEqual(
m_fTargetValue
,
m_ShellGadgetComp
.GetFuzeTime()))
116
return
false
;
117
118
if
(!
m_ShellGadgetComp
)
119
return
false
;
120
121
m_ShellGadgetComp
.SetFuzeTime(
m_fTargetValue
);
122
123
if
(!super.OnSaveActionData(writer))
124
return
false
;
125
126
if
(!
m_Character
)
127
return
true
;
128
129
SCR_CharacterControllerComponent
controller =
SCR_CharacterControllerComponent
.Cast(
m_Character
.GetCharacterController());
130
if
(!controller)
131
return
true
;
132
133
EntityPrefabData
shellPrefab =
GetOwner
().
GetPrefabData
();
134
if
(!shellPrefab)
135
return
true
;
136
137
bool
useManualTime;
138
if
(
m_fTargetValue
>=
m_ShellGadgetComp
.GetMinFuzeTime())
139
useManualTime =
true
;
140
141
SCR_ShellConfig
savedConfig = controller.
GetSavedShellConfig
(shellPrefab);
142
if
(!savedConfig)
143
{
144
savedConfig =
new
SCR_ShellConfig
(shellPrefab,
m_ShellGadgetComp
.GetFuzeTime(), useManualTime, -1);
145
}
146
else
147
{
148
savedConfig.
SetSavedTime
(
m_ShellGadgetComp
.GetFuzeTime());
149
savedConfig.
SetManualTimeUsage
(useManualTime);
150
}
151
152
controller.
SetShellConfig
(savedConfig);
153
154
return
true
;
155
}
156
157
//------------------------------------------------------------------------------------------------
161
override
protected
bool
OnLoadActionData
(
ScriptBitReader
reader)
162
{
163
if
(!super.OnLoadActionData(reader))
164
return
false
;
165
166
if
(
m_bIsAdjustedByPlayer
)
167
return
true
;
168
169
if
(
m_ShellGadgetComp
)
170
m_ShellGadgetComp
.SetFuzeTime(
m_fTargetValue
);
171
172
return
true
;
173
}
174
}
GetUIInfo
SCR_UIInfo GetUIInfo()
Definition
SCR_EditableEntityCampaignBuildingModeLabelSetting.c:27
data
Get all prefabs that have the spawner data
Definition
SCR_EntityCatalogManagerComponent.c:320
ChimeraCharacter
Definition
ChimeraCharacter.c:13
EntityPrefabData
Definition
EntityPrefabData.c:19
GenericComponent
Definition
GenericComponent.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
IEntity::GetPrefabData
proto external EntityPrefabData GetPrefabData()
SCR_AdjustShellTimeFuzeAction
Definition
SCR_AdjustShellTimeFuzeAction.c:2
SCR_AdjustShellTimeFuzeAction::Init
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
Definition
SCR_AdjustShellTimeFuzeAction.c:8
SCR_AdjustShellTimeFuzeAction::OnLoadActionData
bool OnLoadActionData(ScriptBitReader reader)
Definition
SCR_AdjustShellTimeFuzeAction.c:161
SCR_AdjustShellTimeFuzeAction::SCR_GetCurrentValue
override float SCR_GetCurrentValue()
Definition
SCR_AdjustShellTimeFuzeAction.c:64
SCR_AdjustShellTimeFuzeAction::OnSaveActionData
bool OnSaveActionData(ScriptBitWriter writer)
Definition
SCR_AdjustShellTimeFuzeAction.c:113
SCR_AdjustShellTimeFuzeAction::CanBeShownScript
override bool CanBeShownScript(IEntity user)
Definition
SCR_AdjustShellTimeFuzeAction.c:16
SCR_AdjustShellTimeFuzeAction::SCR_GetMaximumValue
override float SCR_GetMaximumValue()
Definition
SCR_AdjustShellTimeFuzeAction.c:85
SCR_AdjustShellTimeFuzeAction::m_Character
ChimeraCharacter m_Character
Definition
SCR_AdjustShellTimeFuzeAction.c:4
SCR_AdjustShellTimeFuzeAction::GetActionNameScript
override bool GetActionNameScript(out string outName)
Definition
SCR_AdjustShellTimeFuzeAction.c:40
SCR_AdjustShellTimeFuzeAction::m_ShellConfig
SCR_ShellConfig m_ShellConfig
Definition
SCR_AdjustShellTimeFuzeAction.c:5
SCR_AdjustShellTimeFuzeAction::SCR_GetMinimumValue
override float SCR_GetMinimumValue()
Definition
SCR_AdjustShellTimeFuzeAction.c:76
SCR_AdjustShellTimeFuzeAction::OnActionStart
override void OnActionStart(IEntity pUserEntity)
Definition
SCR_AdjustShellTimeFuzeAction.c:103
SCR_AdjustShellTimeFuzeAction::GetActionProgressScript
override float GetActionProgressScript(float fProgress, float timeSlice)
Definition
SCR_AdjustShellTimeFuzeAction.c:94
SCR_AdjustShellTimeFuzeAction::m_ShellGadgetComp
SCR_MortarShellGadgetComponent m_ShellGadgetComp
Definition
SCR_AdjustShellTimeFuzeAction.c:3
SCR_AdjustSignalAction
Definition
SCR_AdjustSignalAction.c:2
SCR_AdjustSignalAction::m_fTargetValue
float m_fTargetValue
Normalized current value.
Definition
SCR_AdjustSignalAction.c:48
SCR_AdjustSignalAction::m_bIsAdjustedByPlayer
bool m_bIsAdjustedByPlayer
Interacted with by main entity. Allows reading input actions.
Definition
SCR_AdjustSignalAction.c:51
SCR_AdjustSignalAction::m_fAdjustmentStep
float m_fAdjustmentStep
Adjustment step of normalized value.
Definition
SCR_AdjustSignalAction.c:5
SCR_CharacterControllerComponent
Definition
SCR_CharacterControllerComponent.c:36
SCR_CharacterControllerComponent::GetSavedShellConfig
SCR_ShellConfig GetSavedShellConfig(notnull EntityPrefabData shellPrefab)
Definition
SCR_CharacterControllerComponent.c:418
SCR_CharacterControllerComponent::SetShellConfig
void SetShellConfig(notnull SCR_ShellConfig config)
Definition
SCR_CharacterControllerComponent.c:400
SCR_MortarShellGadgetComponentClass
Definition
SCR_MortarShellGadgetComponent.c:3
SCR_ShellConfig
Definition
SCR_ShellConfig.c:2
SCR_ShellConfig::SetManualTimeUsage
void SetManualTimeUsage(bool shouldUse)
Definition
SCR_ShellConfig.c:38
SCR_ShellConfig::SetSavedTime
void SetSavedTime(float newTime)
Definition
SCR_ShellConfig.c:24
ScriptBitReader
Definition
EnNetwork.c:199
UIConstants
Definition
Constants.c:151
UIInfo
UIInfo - allows to define UI elements.
Definition
UIInfo.c:14
WidgetManager
Definition
WidgetManager.c:16
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition
SCR_FuelNode.c:128
scripts
Game
UserActions
SCR_AdjustShellTimeFuzeAction.c
Generated by
1.17.0