Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_TutorialCourseSelectionUserAction.c
Go to the documentation of this file.
2{
3 protected SCR_TutorialGamemodeComponent m_TutorialComponent;
4 protected SCR_TutorialInstructorComponent m_TutorialInstructor;
5 protected LocalizedString m_sCompletedSuffix = " #AR-Tutorial_TaskCompletedSuffix";
6
7 //------------------------------------------------------------------------------------------------
8 override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
9 {
10 BaseGameMode gamemode = GetGame().GetGameMode();
11 if (!gamemode)
12 return;
13
14 SCR_TutorialGamemodeComponent tutorialComponent = SCR_TutorialGamemodeComponent.Cast(gamemode.FindComponent(SCR_TutorialGamemodeComponent));
15 if (!tutorialComponent)
16 return;
17
18 tutorialComponent.SetCourseConfig(m_TutorialInstructor.GetCourseType());
19 }
20
21 //------------------------------------------------------------------------------------------------
22 override bool CanBePerformedScript(IEntity user)
23 {
25 return false;
26
28 {
29 BaseGameMode gamemode = GetGame().GetGameMode();
30 if (!gamemode)
31 return false;
32
33 m_TutorialComponent = SCR_TutorialGamemodeComponent.Cast(gamemode.FindComponent(SCR_TutorialGamemodeComponent));
34 }
35
36 if (m_TutorialComponent && m_TutorialComponent.IsCourseAvailable(m_TutorialInstructor.GetCourseType()))
37 return true;
38
39 return false;
40 }
41
42 //------------------------------------------------------------------------------------------------
43 override bool CanBroadcastScript()
44 {
45 return false;
46 }
47
48 //------------------------------------------------------------------------------------------------
49 override event bool GetActionNameScript(out string outName)
50 {
52 return false;
53
54 if (!SCR_Enum.HasFlag(m_TutorialComponent.GetFinishedCourses(), m_TutorialInstructor.GetCourseType()))
55 return false;
56
57 outName = GetUIInfo().GetName() + m_sCompletedSuffix;
58 return true;
59 }
60
61 //------------------------------------------------------------------------------------------------
62 override bool CanBeShownScript(IEntity user)
63 {
65 {
66 BaseGameMode gamemode = GetGame().GetGameMode();
67 if (!gamemode)
68 return false;
69
70 m_TutorialComponent = SCR_TutorialGamemodeComponent.Cast(gamemode.FindComponent(SCR_TutorialGamemodeComponent));
71 }
72
73 if (m_TutorialComponent.IsCourseBreaking())
74 return false;
75
76 m_TutorialInstructor = SCR_TutorialInstructorComponent.Cast(GetOwner().FindComponent(SCR_TutorialInstructorComponent));
78 return false;
79
80 if (m_TutorialComponent && m_TutorialComponent.GetOngoingFadeAnimation())
81 return false;
82
83 SCR_TutorialCourse currentCourse = m_TutorialComponent.GetActiveConfig();
84 if (!currentCourse || currentCourse.GetCourseType() != SCR_ETutorialCourses.FREE_ROAM)
85 return false;
86
87 SCR_BaseTutorialStage stage = m_TutorialComponent.GetCurrentStage();
88 if (!stage.IsInherited(SCR_TutorialStageHub))
89 return false;
90
91 return true;
92 };
93}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_ETutorialCourses
proto external IEntity GetOwner()
Returns the parent entity of this action.
proto external UIInfo GetUIInfo()
Returns the UIInfo set for this user action or null if none.
SCR_ETutorialCourses GetCourseType()
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
override event bool GetActionNameScript(out string outName)