Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_Tutorial_CombatEngineering_EnterBuilding_2.c
Go to the documentation of this file.
1[EntityEditorProps(insertable: false)]
5
6class SCR_Tutorial_CombatEngineering_EnterBuilding_2 : SCR_BaseTutorialStage
7{
8 //------------------------------------------------------------------------------------------------
9 override protected void Setup()
10 {
11 SCR_HintManagerComponent.HideHint();
12 SCR_HintManagerComponent.ClearLatestHint();
13
15 if (!logic)
16 return;
17
18 IEntity truck = GetGame().GetWorld().FindEntityByName("BUILDING_VEHICLE");
19 if (!truck)
20 return;
21
22 RegisterWaypoint(truck, "", "CUSTOM");
23
24 SCR_VoiceoverSystem.GetInstance().RegisterActor(GetGame().GetWorld().FindEntityByName("COMBATENGINEERING_Instructor_E"));
25
26 if (!logic.m_bBuildingVoiceLinePlayed)
27 {
28 PlayNarrativeCharacterStage("COMBATENGINEERING_Instructor_E", 1);
29 }
30 else
31 {
32 RegenerateSupplies(); //Hotfix for refund now working
33 ShowHint();
34 }
35
36 SlotManagerComponent slotMan = SlotManagerComponent.Cast(truck.FindComponent(SlotManagerComponent));
37 if (!slotMan)
38 return;
39
40 EntitySlotInfo slot = slotMan.GetSlotByName("EngineerBox");
41 if (!slot)
42 return;
43
44 IEntity box = slot.GetAttachedEntity();
45 if (box)
46 m_TutorialComponent.BlockBuildingModeAccess(box, false);
47 }
48
49 //------------------------------------------------------------------------------------------------
50 override protected void OnStageFinished()
51 {
53 if (logic)
54 logic.m_bBuildingVoiceLinePlayed = true;
55
56 super.OnStageFinished();
57 }
58
59 //------------------------------------------------------------------------------------------------
60 override protected bool GetIsFinished()
61 {
62 return IsBuildingModeOpen();
63 }
64
65 //------------------------------------------------------------------------------------------------
66 protected void RegenerateSupplies()
67 {
68 IEntity supplyTruck = GetGame().GetWorld().FindEntityByName("BUILDING_VEHICLE");
69 if (!supplyTruck)
70 return;
71
72 SlotManagerComponent slotManager = SlotManagerComponent.Cast(supplyTruck.FindComponent(SlotManagerComponent));
73 if (!slotManager)
74 return;
75
76 EntitySlotInfo slotInfo = slotManager.GetSlotByName("EngineerBox");
77 if (!slotInfo)
78 return;
79
80 IEntity cargo = slotInfo.GetAttachedEntity();
81 if (!cargo)
82 return;
83
84 SCR_ResourceComponent resourceComp = SCR_ResourceComponent.FindResourceComponent(cargo);
85 if (!resourceComp)
86 return;
87
88 SCR_ResourceContainer supplyContainer = resourceComp.GetContainer(EResourceType.SUPPLIES);
89 if (supplyContainer)
90 supplyContainer.SetResourceValue(supplyContainer.GetMaxResourceValue());
91 }
92}
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
SCR_TutorialGamemodeComponent m_TutorialComponent
enum EVehicleType IEntity
Adds ability to attach an object to a slot.
proto external Managed FindComponent(typename typeName)
proto external BaseWorld GetWorld()
SCR_Waypoint RegisterWaypoint(string entityName, string title=string.Empty, string icon="MISC")
void PlayNarrativeCharacterStage(string characterName, int stage)
bool SetResourceValue(float value, bool notifyChange=true)
void RegisterActor(notnull IEntity entity)
static SCR_VoiceoverSystem GetInstance()