Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_TutorialLogic_CombatEngineering.c
Go to the documentation of this file.
3{
4 bool m_bBuildingVoiceLinePlayed;
5 protected const ResourceName CONSTRUCTION_TRUCK_PREFAB = "{F54F833E747C1B77}Prefabs/Vehicles/Wheeled/M923A1/Tutorial_Engineering_Truck.et";
6 protected const ResourceName MACHINEGUN_NEST_PREFAB = "{6E9DCCF936BF17B9}PrefabsEditable/Auto/Compositions/Slotted/SlotFlatSmall/E_MachineGunNest_S_US_02.et";
7
8 //------------------------------------------------------------------------------------------------
9 void HandleArlevilleSupplies(bool refill)
10 {
11 IEntity ent = GetGame().GetWorld().FindEntityByName("ARLEVILLE_SUPPLY_STORAGE");
12 if (!ent)
13 return;
14
15 SCR_ResourceComponent resComp = SCR_ResourceComponent.FindResourceComponent(ent);
16 if (!resComp)
17 return;
18
19 SCR_ResourceContainer resourceContainer = resComp.GetContainer(EResourceType.SUPPLIES);
20 if (!resourceContainer)
21 return;
22
23 resourceContainer.DepleteResourceValue();
24
25 if (refill)
26 resourceContainer.IncreaseResourceValue(810);
27 }
28
29 //------------------------------------------------------------------------------------------------
30 protected void OnEntitySpawned(IEntity ent)
31 {
32 if (!ent)
33 return;
34
35 ResourceName spawnedEntityResourceName = ent.GetPrefabData().GetPrefabName();
36 if (spawnedEntityResourceName == MACHINEGUN_NEST_PREFAB)
37 {
38 ent.SetName("BUILDING_GUNNEST");
39 return;
40 }
41
42 if (spawnedEntityResourceName != CONSTRUCTION_TRUCK_PREFAB)
43 return;
44
45 ent.SetName("BUILDING_VEHICLE");
46 SlotManagerComponent slotMan = SlotManagerComponent.Cast(ent.FindComponent(SlotManagerComponent));
47 if (!slotMan)
48 return;
49
50 EntitySlotInfo slot = slotMan.GetSlotByName("EngineerBox");
51 if (!slot)
52 return;
53
54 IEntity box = slot.GetAttachedEntity();
55 if (!box)
56 return;
57
58 SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
59 if (tutorial)
60 tutorial.BlockBuildingModeAccess(box, true);
61 }
62
63 //------------------------------------------------------------------------------------------------
64 override void OnCourseStart()
65 {
66 SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
67 if (!tutorial)
68 return;
69
70 IEntity service = GetGame().GetWorld().FindEntityByName("VEHICLE_REQUESTING_BOARD");
71 if (service)
72 {
73 SCR_CampaignBuildingProviderComponent buildingComponent = SCR_CampaignBuildingProviderComponent.Cast(service.FindComponent(SCR_CampaignBuildingProviderComponent));
74 if (buildingComponent)
75 buildingComponent.RemovePlayerCooldowns(1);
76 }
77
78 SCR_EntityHelper.DeleteEntityAndChildren(GetGame().GetWorld().FindEntityByName("BUILDING_VEHICLE"));
79 SCR_EntityHelper.DeleteEntityAndChildren(GetGame().GetWorld().FindEntityByName("BUILDING_GUNNEST"));
80
81 tutorial.GetOnEntitySpawned().Insert(OnEntitySpawned);
82 }
83
84 //------------------------------------------------------------------------------------------------
85 override void OnCourseEnd()
86 {
87 m_bBuildingVoiceLinePlayed = false;
89
90 SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
91 if (!tutorial)
92 return;
93
94 tutorial.GetOnEntitySpawned().Remove(OnEntitySpawned);
95
96 IEntity service = GetGame().GetWorld().FindEntityByName("VEHICLE_REQUESTING_BOARD");
97 if (service)
98 tutorial.BlockBuildingModeAccess(service, false);
99
100 IEntity vehicle = GetGame().GetWorld().FindEntityByName("BUILDING_VEHICLE");
101 if (!vehicle)
102 return;
103
104 tutorial.ChangeVehicleLockState(vehicle, true);
105 tutorial.InsertIntoGarbage(vehicle);
106 }
107}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Adds ability to attach an object to a slot.
proto external Managed FindComponent(typename typeName)
proto external BaseWorld GetWorld()
proto external void SetName(string name)
proto external EntityPrefabData GetPrefabData()
bool DepleteResourceValue(bool notifyChange=true)
bool IncreaseResourceValue(float value, bool notifyChange=true)