Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AnalyticsDataCollectionCompositionCostModule.c
Go to the documentation of this file.
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(OnCompositionSpawned);
12 }
13
14 //------------------------------------------------------------------------------------------------
15 protected override void Disable()
16 {
17 super.Disable();
18
19 SCR_GameModeCampaign campaign = SCR_GameModeCampaign.GetInstance();
20 if (campaign)
21 campaign.GetOnEntityRequested().Remove(OnCompositionSpawned);
22 }
23
24 //------------------------------------------------------------------------------------------------
28 protected void OnCompositionSpawned(IEntity userEntity, IEntity spawnedEntity)
29 {
30 // Spawned entity is a vehicle, not a composition
31 if (spawnedEntity.IsInherited(Vehicle))
32 return;
33
34 // Spawned entity is an AI group, not a composition
35 SCR_AIGroup aiGroup = SCR_AIGroup.Cast(spawnedEntity);
36 if (aiGroup)
37 return;
38
39 // User is not a player
40 int playerId = GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(userEntity);
41 if (playerId == 0)
42 return;
43
44 string compositionName = SCR_AnalyticsDataCollectionHelper.GetEntityPrefabName(spawnedEntity);
45 int compositionCost = SCR_AnalyticsDataCollectionHelper.GetEntitySupplyCost(spawnedEntity);
46
47 AddSupplySpendingData(playerId, compositionName, compositionCost);
48 }
49
50 //------------------------------------------------------------------------------------------------
55}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
enum EPhysicsLayerPresets Vehicle
Definition gameLib.c:24