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_AdjustShellChargeRingsAction.c
Go to the documentation of this file.
1
class
SCR_AdjustShellChargeRingsAction
:
SCR_AdjustSignalAction
2
{
3
protected
SCR_MortarShellGadgetComponent
m_ShellGadgetComp
;
4
protected
ChimeraCharacter
m_Character
;
5
protected
SCR_ShellConfig
m_ShellConfig
;
6
protected
int
m_iDefaultConfigId
;
7
8
//------------------------------------------------------------------------------------------------
9
override
void
Init
(
IEntity
pOwnerEntity,
GenericComponent
pManagerComponent)
10
{
11
m_ShellGadgetComp
= SCR_MortarShellGadgetComponent.Cast(pOwnerEntity.
FindComponent
(SCR_MortarShellGadgetComponent));
12
if
(
m_ShellGadgetComp
)
13
{
14
SCR_MortarShellGadgetComponentClass
data
=
SCR_MortarShellGadgetComponentClass
.Cast(
m_ShellGadgetComp
.GetComponentData(pOwnerEntity));
15
m_iDefaultConfigId
=
data
.FindDefaultChargeRingConfig();
16
}
17
18
super.Init(pOwnerEntity, pManagerComponent);
19
}
20
21
//------------------------------------------------------------------------------------------------
22
override
bool
CanBeShownScript
(
IEntity
user)
23
{
24
ChimeraCharacter
character =
ChimeraCharacter
.Cast(user);
25
if
(!character)
26
return
false
;
27
28
CharacterControllerComponent characterController = character.GetCharacterController();
29
if
(!characterController || characterController.GetInspectEntity() !=
GetOwner
())
30
return
false
;
31
32
if
(!
m_ShellGadgetComp
||
m_ShellGadgetComp
.GetNumberOfChargeRingConfigurations() < 2)
33
return
false
;
34
35
if
(!
m_ShellConfig
)
36
m_ShellConfig
=
m_ShellGadgetComp
.GetSavedConfig(character);
37
38
return
super.CanBeShownScript(user);
39
}
40
41
//------------------------------------------------------------------------------------------------
42
override
bool
GetActionNameScript
(out
string
outName)
43
{
44
if
(!
m_ShellGadgetComp
)
45
return
false
;
46
47
UIInfo
actionInfo =
GetUIInfo
();
48
if
(!actionInfo)
49
return
false
;
50
51
if
(!
m_ShellConfig
||
m_ShellConfig
.GetChargeRingConfigId() == -1 ||
m_ShellConfig
.GetChargeRingConfigId() !=
m_ShellGadgetComp
.GetCurentChargeRingConfigId() ||
m_ShellConfig
.GetChargeRingConfigId() ==
m_iDefaultConfigId
)
52
outName =
WidgetManager
.Translate(actionInfo.GetName(),
m_ShellGadgetComp
.GetCurentChargeRingConfig()[0].ToString(0, 0));
53
else
54
outName =
WidgetManager
.Translate(actionInfo.GetDescription(),
m_ShellGadgetComp
.GetChargeRingConfig(
m_ShellConfig
.GetChargeRingConfigId())[0].ToString(0, 0));
55
56
return
true
;
57
}
58
59
//------------------------------------------------------------------------------------------------
60
override
void
OnActionStart
(
IEntity
pUserEntity)
61
{
62
m_Character
=
ChimeraCharacter
.Cast(pUserEntity);
63
64
if
(
m_ShellGadgetComp
)
65
m_fTargetValue
=
m_ShellGadgetComp
.GetCurentChargeRingConfigId();
66
67
super.OnActionStart(pUserEntity);
68
}
69
70
//------------------------------------------------------------------------------------------------
71
protected
override
float
SCR_GetCurrentValue
()
72
{
73
if
(
m_ShellGadgetComp
)
74
return
m_ShellGadgetComp
.GetCurentChargeRingConfigId();
75
76
return
GetCurrentValue();
77
}
78
79
//------------------------------------------------------------------------------------------------
80
protected
override
float
SCR_GetMinimumValue
()
81
{
82
return
0;
83
}
84
85
//------------------------------------------------------------------------------------------------
86
protected
override
float
SCR_GetMaximumValue
()
87
{
88
if
(
m_ShellGadgetComp
)
89
return
m_ShellGadgetComp
.GetNumberOfChargeRingConfigurations() - 1;
90
91
return
GetMaximumValue();
92
}
93
94
//------------------------------------------------------------------------------------------------
95
protected
override
bool
OnSaveActionData
(ScriptBitWriter writer)
96
{
97
if
(
m_fTargetValue
==
m_ShellGadgetComp
.GetCurentChargeRingConfigId())
98
return
false
;
99
100
if
(!super.OnSaveActionData(writer))
101
return
false
;
102
103
if
(
m_ShellGadgetComp
)
104
{
105
SCR_CharacterControllerComponent
controller =
SCR_CharacterControllerComponent
.Cast(
m_Character
.GetCharacterController());
106
if
(!controller)
107
return
true
;
108
109
EntityPrefabData
shellPrefab =
GetOwner
().
GetPrefabData
();
110
if
(!shellPrefab)
111
return
true
;
112
113
int
savedValue =
m_fTargetValue
;
114
if
(savedValue < 0 || savedValue >
SCR_GetMaximumValue
() || savedValue ==
m_iDefaultConfigId
)
115
savedValue = -1;
116
117
SCR_ShellConfig
savedConfig = controller.
GetSavedShellConfig
(shellPrefab);
118
if
(!savedConfig)
119
savedConfig =
new
SCR_ShellConfig
(shellPrefab, 0,
false
, savedValue);
120
else
121
savedConfig.
SetChargeRingConfigId
(savedValue);
122
123
controller.
SetShellConfig
(savedConfig);
124
}
125
126
return
true
;
127
}
128
129
//------------------------------------------------------------------------------------------------
130
protected
override
bool
OnLoadActionData
(
ScriptBitReader
reader)
131
{
132
if
(!super.OnLoadActionData(reader))
133
return
false
;
134
135
if
(
m_ShellGadgetComp
)
136
m_ShellGadgetComp
.SetChargeRingConfig(
m_fTargetValue
,
false
,
false
);
137
138
return
true
;
139
}
140
}
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_AdjustShellChargeRingsAction
Definition
SCR_AdjustShellChargeRingsAction.c:2
SCR_AdjustShellChargeRingsAction::Init
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
Definition
SCR_AdjustShellChargeRingsAction.c:9
SCR_AdjustShellChargeRingsAction::OnLoadActionData
override bool OnLoadActionData(ScriptBitReader reader)
Definition
SCR_AdjustShellChargeRingsAction.c:130
SCR_AdjustShellChargeRingsAction::GetActionNameScript
override bool GetActionNameScript(out string outName)
Definition
SCR_AdjustShellChargeRingsAction.c:42
SCR_AdjustShellChargeRingsAction::OnSaveActionData
override bool OnSaveActionData(ScriptBitWriter writer)
Definition
SCR_AdjustShellChargeRingsAction.c:95
SCR_AdjustShellChargeRingsAction::OnActionStart
override void OnActionStart(IEntity pUserEntity)
Definition
SCR_AdjustShellChargeRingsAction.c:60
SCR_AdjustShellChargeRingsAction::m_Character
ChimeraCharacter m_Character
Definition
SCR_AdjustShellChargeRingsAction.c:4
SCR_AdjustShellChargeRingsAction::SCR_GetMaximumValue
override float SCR_GetMaximumValue()
Definition
SCR_AdjustShellChargeRingsAction.c:86
SCR_AdjustShellChargeRingsAction::m_iDefaultConfigId
int m_iDefaultConfigId
Definition
SCR_AdjustShellChargeRingsAction.c:6
SCR_AdjustShellChargeRingsAction::SCR_GetCurrentValue
override float SCR_GetCurrentValue()
Definition
SCR_AdjustShellChargeRingsAction.c:71
SCR_AdjustShellChargeRingsAction::m_ShellGadgetComp
SCR_MortarShellGadgetComponent m_ShellGadgetComp
Definition
SCR_AdjustShellChargeRingsAction.c:3
SCR_AdjustShellChargeRingsAction::m_ShellConfig
SCR_ShellConfig m_ShellConfig
Definition
SCR_AdjustShellChargeRingsAction.c:5
SCR_AdjustShellChargeRingsAction::SCR_GetMinimumValue
override float SCR_GetMinimumValue()
Definition
SCR_AdjustShellChargeRingsAction.c:80
SCR_AdjustShellChargeRingsAction::CanBeShownScript
override bool CanBeShownScript(IEntity user)
Definition
SCR_AdjustShellChargeRingsAction.c:22
SCR_AdjustSignalAction
Definition
SCR_AdjustSignalAction.c:2
SCR_AdjustSignalAction::m_fTargetValue
float m_fTargetValue
Normalized current value.
Definition
SCR_AdjustSignalAction.c:48
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::SetChargeRingConfigId
void SetChargeRingConfigId(int configId)
Definition
SCR_ShellConfig.c:52
ScriptBitReader
Definition
EnNetwork.c:199
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_AdjustShellChargeRingsAction.c
Generated by
1.17.0