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_AnalyticsDataCollectionVehicleCostModule.c
Go to the documentation of this file.
1
[
BaseContainerProps
()]
2
class
SCR_AnalyticsDataCollectionVehicleCostModule
:
SCR_AnalyticsDataCollectionSupplyCostBaseModule
3
{
4
//------------------------------------------------------------------------------------------------
5
protected
override
void
Enable
()
6
{
7
super.Enable();
8
9
SCR_GameModeCampaign
campaign =
SCR_GameModeCampaign
.GetInstance();
10
if
(campaign)
11
campaign.GetOnEntityRequested().Insert(
OnVehicleSpawned
);
12
13
SCR_SupportStationManagerComponent
supportStationManager =
SCR_SupportStationManagerComponent
.
GetInstance
();
14
if
(supportStationManager)
15
supportStationManager.
GetOnSupportStationExecutedSuccessfully
().Insert(
OnSupportStationExecuted
);
16
}
17
18
//------------------------------------------------------------------------------------------------
19
protected
override
void
Disable
()
20
{
21
super.Disable();
22
23
SCR_GameModeCampaign
campaign =
SCR_GameModeCampaign
.GetInstance();
24
if
(campaign)
25
campaign.GetOnEntityRequested().Remove(
OnVehicleSpawned
);
26
27
SCR_SupportStationManagerComponent
supportStationManager =
SCR_SupportStationManagerComponent
.
GetInstance
();
28
if
(supportStationManager)
29
supportStationManager.
GetOnSupportStationExecutedSuccessfully
().Remove(
OnSupportStationExecuted
);
30
}
31
32
//------------------------------------------------------------------------------------------------
36
protected
void
OnVehicleSpawned
(
IEntity
userEntity,
IEntity
spawnedEntity)
37
{
38
// Spawned entity is not a vehicle
39
if
(!spawnedEntity.IsInherited(
Vehicle
))
40
return
;
41
42
// User is not a player
43
int
playerId =
GetGame
().GetPlayerManager().GetPlayerIdFromControlledEntity(userEntity);
44
if
(playerId == 0)
45
return
;
46
47
string
vehicleName =
SCR_AnalyticsDataCollectionHelper
.GetEntityPrefabName(spawnedEntity);
48
int
vehicleCost =
SCR_AnalyticsDataCollectionHelper
.GetEntitySupplyCost(spawnedEntity);
49
50
AddSupplySpendingData
(playerId, vehicleName, vehicleCost);
51
}
52
53
//------------------------------------------------------------------------------------------------
60
protected
void
OnSupportStationExecuted
(SCR_BaseSupportStationComponent supportStation,
ESupportStationType
supportStationType,
IEntity
actionTarget,
IEntity
actionUser,
SCR_BaseUseSupportStationAction
action)
61
{
62
if
(!action)
63
return
;
64
65
// We only care about repair and vehicle weapon support station types
66
if
(supportStationType !=
ESupportStationType
.REPAIR && supportStationType !=
ESupportStationType
.VEHICLE_WEAPON)
67
return
;
68
69
// User is not a player
70
int
playerId =
GetGame
().GetPlayerManager().GetPlayerIdFromControlledEntity(actionUser);
71
if
(playerId == 0)
72
return
;
73
74
// The cost is 0, no need to add
75
int
actionCost = action.
GetSupportStationSuppliesOnUse
();
76
if
(actionCost == 0)
77
return
;
78
79
// Refund action does not cost supplies
80
if
(
SCR_RefundVehicleAmmoSupportStationAction
.Cast(action))
81
return
;
82
83
IEntity
vehiclePrefab = actionTarget.
GetRootParent
();
84
string
vehicleName =
SCR_AnalyticsDataCollectionHelper
.GetEntityPrefabName(vehiclePrefab);
85
86
AddSupplySpendingData
(playerId, vehicleName, actionCost);
87
}
88
89
//------------------------------------------------------------------------------------------------
90
protected
void
~SCR_AnalyticsDataCollectionVehicleCostModule
()
91
{
92
Disable
();
93
}
94
}
ESupportStationType
ESupportStationType
Definition
ESupportStationType.c:3
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
SCR_GameModeCampaign
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
Definition
SCR_GameModeCampaign.c:1812
IEntity
Definition
IEntity.c:13
IEntity::GetRootParent
proto external IEntity GetRootParent()
SCR_AnalyticsDataCollectionHelper
Definition
SCR_AnalyticsDataCollectionHelper.c:2
SCR_AnalyticsDataCollectionSupplyCostBaseModule
Definition
SCR_AnalyticsDataCollectionSupplyCostBaseModule.c:3
SCR_AnalyticsDataCollectionSupplyCostBaseModule::AddSupplySpendingData
void AddSupplySpendingData(int playerID, string itemName, int cost)
Definition
SCR_AnalyticsDataCollectionSupplyCostBaseModule.c:33
SCR_AnalyticsDataCollectionVehicleCostModule
Definition
SCR_AnalyticsDataCollectionVehicleCostModule.c:3
SCR_AnalyticsDataCollectionVehicleCostModule::OnSupportStationExecuted
void OnSupportStationExecuted(SCR_BaseSupportStationComponent supportStation, ESupportStationType supportStationType, IEntity actionTarget, IEntity actionUser, SCR_BaseUseSupportStationAction action)
Definition
SCR_AnalyticsDataCollectionVehicleCostModule.c:60
SCR_AnalyticsDataCollectionVehicleCostModule::Enable
override void Enable()
Definition
SCR_AnalyticsDataCollectionVehicleCostModule.c:5
SCR_AnalyticsDataCollectionVehicleCostModule::OnVehicleSpawned
void OnVehicleSpawned(IEntity userEntity, IEntity spawnedEntity)
Definition
SCR_AnalyticsDataCollectionVehicleCostModule.c:36
SCR_AnalyticsDataCollectionVehicleCostModule::~SCR_AnalyticsDataCollectionVehicleCostModule
void ~SCR_AnalyticsDataCollectionVehicleCostModule()
Definition
SCR_AnalyticsDataCollectionVehicleCostModule.c:90
SCR_AnalyticsDataCollectionVehicleCostModule::Disable
override void Disable()
Definition
SCR_AnalyticsDataCollectionVehicleCostModule.c:19
SCR_BaseUseSupportStationAction
Definition
SCR_BaseUseSupportStationAction.c:2
SCR_BaseUseSupportStationAction::GetSupportStationSuppliesOnUse
int GetSupportStationSuppliesOnUse()
Definition
SCR_BaseUseSupportStationAction.c:472
SCR_RefundVehicleAmmoSupportStationAction
Definition
SCR_RefundVehicleAmmoSupportStationAction.c:2
SCR_SupportStationManagerComponent
Definition
SCR_SupportStationManagerComponent.c:11
SCR_SupportStationManagerComponent::GetOnSupportStationExecutedSuccessfully
ScriptInvokerBase< SupportStation_OnSupportStationExecuted > GetOnSupportStationExecutedSuccessfully()
Definition
SCR_SupportStationManagerComponent.c:48
SCR_SupportStationManagerComponent::GetInstance
static SCR_SupportStationManagerComponent GetInstance()
Definition
SCR_SupportStationManagerComponent.c:23
Vehicle
enum EPhysicsLayerPresets Vehicle
Definition
gameLib.c:24
scripts
Game
DataCollection
AnalyticsDataCollectionModules
SCR_AnalyticsDataCollectionVehicleCostModule.c
Generated by
1.17.0