Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_Tutorial_LRS_Attach_Optic.c
Go to the documentation of this file.
1[EntityEditorProps(insertable: false)]
5
6//------------------------------------------------------------------------------------------------
8{
9 WeaponComponent m_WeaponComp;
10 CharacterControllerComponent m_CharacterComponent;
11 //------------------------------------------------------------------------------------------------
12 override protected void Setup()
13 {
14 SCR_HintManagerComponent.HideHint();
15 SCR_HintManagerComponent.ClearLatestHint();
16
17 IEntity gun = GetGame().GetWorld().FindEntityByName("Course_M21");
18 if (!gun)
19 return;
20
21 m_WeaponComp = WeaponComponent.Cast(gun.FindComponent(WeaponComponent));
22 m_CharacterComponent = CharacterControllerComponent.Cast(m_Player.FindComponent(CharacterControllerComponent));
23
24 if (IsOpticAttached())
25 {
26 m_bFinished = true;
27 return;
28 }
29
30 PlayNarrativeCharacterStage("LONGRANGESHOOTING_Instructor", 3);
31 }
32
33 //------------------------------------------------------------------------------------------------
34 override void OnVoiceoverEventFinished(string eventName)
35 {
36 if (eventName != "SOUND_TUTORIAL_TA_RIFLE_PICKED_UP_INSTRUCTOR_K_02")
37 return;
38
39 RegisterWaypoint("Course_Optic", "", "GUNLOWER");
40 }
41
42 //------------------------------------------------------------------------------------------------
43 protected bool IsOpticAttached()
44 {
45 if (!m_WeaponComp)
46 return false;
47
48 array <AttachmentSlotComponent> attachments = {};
49 m_WeaponComp.GetAttachments(attachments);
50
51 return attachments.IsIndexValid(0) && attachments[0].GetAttachedEntity();
52 }
53
54 //------------------------------------------------------------------------------------------------
55 override protected bool GetIsFinished()
56 {
57 bool opticsAttached = IsOpticAttached();
58
59 if (opticsAttached)
60 {
61 UnregisterWaypoint("Course_Optic");
62 return true;
63 }
64
65 if (m_CharacterComponent)
66 {
67 if (m_TutorialComponent.IsEntityInPlayerInventory("Course_Optic"))
68 {
69 if (m_CharacterComponent.GetInspect())
70 ShowHint(2);
71 else
72 ShowHint(1);
73 }
74 }
75
76 return false;
77 }
78};
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.
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
proto external Managed FindComponent(typename typeName)
void UnregisterWaypoint(IEntity waypointEntity)
SCR_TutorialGamemodeComponent m_TutorialComponent
SCR_Waypoint RegisterWaypoint(string entityName, string title=string.Empty, string icon="MISC")
void PlayNarrativeCharacterStage(string characterName, int stage)
override void OnVoiceoverEventFinished(string eventName)