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_VehicleSalvageSupportStationUserAction.c
Go to the documentation of this file.
1
class
SCR_VehicleSalvageSupportStationUserAction
:
SCR_BaseUseSupportStationAction
2
{
3
protected
Vehicle
m_VehicleParent
;
4
protected
SCR_DamageManagerComponent
m_DamageManager
;
5
protected
bool
m_bSupplyCostObtained
;
6
protected
int
m_iSupplyCost
;
7
8
//------------------------------------------------------------------------------------------------
9
protected
override
ESupportStationType
GetSupportStationType
()
10
{
11
return
ESupportStationType
.LOAD_WRECK;
12
}
13
14
//------------------------------------------------------------------------------------------------
17
int
GetSupplyCost
()
18
{
19
if
(
m_bSupplyCostObtained
)
20
return
m_iSupplyCost
;
21
22
m_bSupplyCostObtained
=
true
;
23
24
if
(!
m_VehicleParent
)
25
{
26
Print
(
"'SCR_VehicleSalvageSupportStationUserAction': Vehicle is null!"
,
LogLevel
.WARNING);
27
return
0;
28
}
29
30
// Get prefab data of vehicle
31
EntityPrefabData
prefabData =
m_VehicleParent
.GetPrefabData();
32
if
(!prefabData)
33
{
34
Print
(
"'SCR_VehicleSalvageSupportStationUserAction': Vehicle does not have prefab data!"
,
LogLevel
.WARNING);
35
return
0;
36
}
37
38
// Get prefab name of vehicle
39
ResourceName
prefab = prefabData.GetPrefabName();
40
if
(prefab.IsEmpty())
41
{
42
Print
(
"'SCR_VehicleSalvageSupportStationUserAction': Prefab does not have a name!"
,
LogLevel
.WARNING);
43
return
0;
44
}
45
46
// Get vehicle faction
47
SCR_Faction
faction;
48
FactionAffiliationComponent factionAff = FactionAffiliationComponent.Cast(
m_VehicleParent
.FindComponent(FactionAffiliationComponent));
49
if
(factionAff)
50
faction =
SCR_Faction
.Cast(factionAff.GetDefaultAffiliatedFaction());
51
52
// Get entity catalog so we can obtain the vehicle's value
53
SCR_EntityCatalogManagerComponent catalogManager = SCR_EntityCatalogManagerComponent.GetInstance();
54
if
(!catalogManager)
55
{
56
Print
(
"'SCR_VehicleSalvageSupportStationUserAction': Catalog Manager is null!"
,
LogLevel
.WARNING);
57
return
0;
58
}
59
60
SCR_EntityCatalogEntry
catalogEntry = catalogManager.GetEntryWithPrefabFromAnyCatalog(
EEntityCatalogType
.VEHICLE, prefab, faction);
61
if
(!catalogEntry)
62
{
63
Print
(
"'SCR_VehicleSalvageSupportStationUserAction': Catalog entry is null!"
,
LogLevel
.WARNING);
64
return
0;
65
}
66
67
SCR_EditableEntityUIInfo
editableUIInfo =
SCR_EditableEntityUIInfo
.Cast(catalogEntry.
GetEntityUiInfo
());
68
if
(!editableUIInfo)
69
{
70
Print
(
"'SCR_VehicleSalvageSupportStationUserAction': Editable UI Info of catalog entry is null!"
,
LogLevel
.WARNING);
71
return
0;
72
}
73
74
array<ref SCR_EntityBudgetValue> budgets = {};
75
editableUIInfo.
GetEntityAndChildrenBudgetCost
(budgets);
76
77
// Loop through budgets to find the one of target vehicle
78
foreach
(
SCR_EntityBudgetValue
budget : budgets)
79
{
80
if
(!budget)
81
continue
;
82
83
if
(budget.GetBudgetType() !=
EEditableEntityBudget
.CAMPAIGN)
84
continue
;
85
86
m_iSupplyCost
= budget.GetBudgetValue();
87
break
;
88
}
89
90
return
m_iSupplyCost
;
91
}
92
93
//------------------------------------------------------------------------------------------------
94
protected
override
void
DelayedInit
(
IEntity
owner)
95
{
96
if
(!owner)
97
return
;
98
99
super.DelayedInit(owner);
100
101
m_VehicleParent
=
Vehicle
.Cast(owner);
102
if
(!
m_VehicleParent
)
103
m_VehicleParent
=
Vehicle
.Cast(owner.
GetParent
());
104
105
if
(!
m_VehicleParent
)
106
{
107
Print
(
"'SCR_VehicleSalvageSupportStationComponent': Vehicle Parent is null!"
,
LogLevel
.ERROR);
108
return
;
109
}
110
111
m_DamageManager
=
m_VehicleParent
.GetDamageManager();
112
113
if
(!
m_DamageManager
)
114
{
115
Print
(
"'SCR_VehicleSalvageSupportStationComponent': Damage Manager is null!"
,
LogLevel
.ERROR);
116
return
;
117
}
118
}
119
120
//------------------------------------------------------------------------------------------------
121
override
bool
CanBeShownScript
(
IEntity
user)
122
{
123
m_bShowSupplyCostOnAction
=
true
;
124
125
// Check if setting is enabled
126
SCR_AdditionalGameModeSettingsComponent
additionalGameSettings =
SCR_AdditionalGameModeSettingsComponent
.GetInstance();
127
if
(!additionalGameSettings)
128
{
129
additionalGameSettings.SetEnableVehicleSalvage_S(
false
);
130
return
false
;
131
}
132
133
if
(!additionalGameSettings.IsVehicleSalvageEnabled())
134
return
false
;
135
136
// Check if the vehicle exists and is destroyed
137
if
(!
m_VehicleParent
|| !
m_DamageManager
)
138
return
false
;
139
140
if
(!
m_DamageManager
.IsDestroyed())
141
return
false
;
142
143
return
super.CanBeShownScript(user);
144
}
145
}
EEditableEntityBudget
EEditableEntityBudget
Definition
EEditableEntityBudget.c:2
EEntityCatalogType
EEntityCatalogType
Definition
EEntityCatalogType.c:5
ESupportStationType
ESupportStationType
Definition
ESupportStationType.c:3
SCR_AdditionalGameModeSettingsComponent
void SCR_AdditionalGameModeSettingsComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_AdditionalGameModeSettingsComponent.c:356
EntityPrefabData
Definition
EntityPrefabData.c:19
IEntity
Definition
IEntity.c:13
IEntity::GetParent
proto external IEntity GetParent()
ResourceName
Definition
ResourceName.c:13
SCR_BaseUseSupportStationAction
Definition
SCR_BaseUseSupportStationAction.c:2
SCR_BaseUseSupportStationAction::m_bShowSupplyCostOnAction
bool m_bShowSupplyCostOnAction
Definition
SCR_BaseUseSupportStationAction.c:25
SCR_EditableEntityUIInfo
Definition
SCR_EditableEntityUIInfo.c:3
SCR_EditableEntityUIInfo::GetEntityAndChildrenBudgetCost
void GetEntityAndChildrenBudgetCost(out notnull array< ref SCR_EntityBudgetValue > outBudgets)
Get Entity and its children budgets.
Definition
SCR_EditableEntityUIInfo.c:134
SCR_EntityBudgetValue
Definition
SCR_EntityBudgetValue.c:3
SCR_EntityCatalogEntry
Definition
SCR_EntityCatalogEntry.c:6
SCR_EntityCatalogEntry::GetEntityUiInfo
Get UI info Prefab needs to be an editable entity or have a custom UI info logic Note that if UIInfo is NULL then the autotest will fail return Ui info *SCR_UIInfo GetEntityUiInfo()
Definition
SCR_EntityCatalogEntry.c:74
SCR_Faction
Definition
SCR_Faction.c:6
SCR_VehicleSalvageSupportStationUserAction
Definition
SCR_VehicleSalvageSupportStationUserAction.c:2
SCR_VehicleSalvageSupportStationUserAction::CanBeShownScript
override bool CanBeShownScript(IEntity user)
Definition
SCR_VehicleSalvageSupportStationUserAction.c:121
SCR_VehicleSalvageSupportStationUserAction::GetSupplyCost
int GetSupplyCost()
Definition
SCR_VehicleSalvageSupportStationUserAction.c:17
SCR_VehicleSalvageSupportStationUserAction::m_bSupplyCostObtained
bool m_bSupplyCostObtained
Definition
SCR_VehicleSalvageSupportStationUserAction.c:5
SCR_VehicleSalvageSupportStationUserAction::m_VehicleParent
Vehicle m_VehicleParent
Definition
SCR_VehicleSalvageSupportStationUserAction.c:3
SCR_VehicleSalvageSupportStationUserAction::m_DamageManager
SCR_DamageManagerComponent m_DamageManager
Definition
SCR_VehicleSalvageSupportStationUserAction.c:4
SCR_VehicleSalvageSupportStationUserAction::DelayedInit
override void DelayedInit(IEntity owner)
Definition
SCR_VehicleSalvageSupportStationUserAction.c:94
SCR_VehicleSalvageSupportStationUserAction::GetSupportStationType
override ESupportStationType GetSupportStationType()
Definition
SCR_VehicleSalvageSupportStationUserAction.c:9
SCR_VehicleSalvageSupportStationUserAction::m_iSupplyCost
int m_iSupplyCost
Definition
SCR_VehicleSalvageSupportStationUserAction.c:6
Vehicle
enum EPhysicsLayerPresets Vehicle
Definition
gameLib.c:24
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
scripts
Game
UserActions
SupportStations
SCR_VehicleSalvageSupportStationUserAction.c
Generated by
1.17.0