Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_TutorialLogic_Driving.c
Go to the documentation of this file.
1
[
BaseContainerProps
()]
2
class
SCR_TutorialLogic_Driving
:
SCR_BaseTutorialCourseLogic
3
{
4
protected
Vehicle
m_CourseVehicle
;
5
6
//------------------------------------------------------------------------------------------------
7
protected
void
OnCompartmentLeft
(
IEntity
targetEntity,
BaseCompartmentManagerComponent
manager,
int
mgrID,
int
slotID,
bool
move)
8
{
9
SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
10
if
(tutorial)
11
tutorial.RequestBreakCourse(
SCR_ETutorialBreakType
.FORCED);
12
}
13
14
//------------------------------------------------------------------------------------------------
15
protected
void
OnHitZoneDamageStateChanged
(
SCR_HitZone
hitzone)
16
{
17
if
(hitzone.GetDamageState() !=
EDamageState
.DESTROYED)
18
return
;
19
20
SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
21
if
(tutorial)
22
tutorial.RequestBreakCourse(
SCR_ETutorialBreakType
.FORCED);
23
}
24
25
//------------------------------------------------------------------------------------------------
26
protected
void
OnVehicleDamaged
(
EDamageState
state)
27
{
28
if
(state !=
EDamageState
.DESTROYED)
29
return
;
30
31
SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
32
if
(tutorial)
33
tutorial.RequestBreakCourse(
SCR_ETutorialBreakType
.FORCED);
34
}
35
36
//------------------------------------------------------------------------------------------------
37
protected
void
OnEngineStoppedJeep
()
38
{
39
if
(!
m_CourseVehicle
)
40
return
;
41
42
VehicleControllerComponent vehicleController = VehicleControllerComponent.Cast(
m_CourseVehicle
.FindComponent(VehicleControllerComponent));
43
if
(!vehicleController || !vehicleController.GetEngineDrowned())
44
return
;
45
46
vehicleController.GetOnEngineStop().Remove(
OnEngineStoppedJeep
);
47
48
SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
49
if
(tutorial)
50
tutorial.RequestBreakCourse(
SCR_ETutorialBreakType
.FORCED);
51
}
52
53
//------------------------------------------------------------------------------------------------
54
override
void
OnCourseStart
()
55
{
56
SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
57
if
(!tutorial)
58
return
;
59
60
m_CourseVehicle
=
Vehicle
.Cast(
GetGame
().GetWorld().FindEntityByName(
"SmallJeep"
));
61
62
SCR_VehicleDamageManagerComponent
damageManager =
SCR_VehicleDamageManagerComponent
.Cast(
m_CourseVehicle
.GetDamageManager());
63
if
(damageManager)
64
{
65
damageManager.GetOnDamageStateChanged().Insert(
OnVehicleDamaged
);
66
67
SCR_HitZone
engine =
SCR_HitZone
.Cast(damageManager.GetHitZoneByName(
"Engine_01"
));
68
69
if
(engine)
70
engine.
GetOnDamageStateChanged
().Insert(
OnHitZoneDamageStateChanged
);
71
72
SCR_HitZone
gearbox =
SCR_HitZone
.Cast(damageManager.GetHitZoneByName(
"Gearbox_01"
));
73
74
if
(gearbox)
75
gearbox.
GetOnDamageStateChanged
().Insert(
OnHitZoneDamageStateChanged
);
76
}
77
78
VehicleControllerComponent vehicleController = VehicleControllerComponent.Cast(
m_CourseVehicle
.FindComponent(VehicleControllerComponent));
79
if
(vehicleController)
80
vehicleController.GetOnEngineStop().Insert(
OnEngineStoppedJeep
);
81
82
IEntity
instructor =
GetGame
().
GetWorld
().FindEntityByName(
"DRIVING_Copilot"
);
83
if
(!instructor)
84
return
;
85
86
SCR_CompartmentAccessComponent
compartmentAccess =
SCR_CompartmentAccessComponent
.Cast(instructor.
FindComponent
(
SCR_CompartmentAccessComponent
));
87
if
(compartmentAccess)
88
compartmentAccess.
GetOnCompartmentLeft
().Insert(
OnCompartmentLeft
);
89
};
90
91
//------------------------------------------------------------------------------------------------
92
void
HandleOldAssets
()
93
{
94
SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
95
if
(!tutorial)
96
return
;
97
98
IEntity
oldEnt =
GetGame
().
GetWorld
().FindEntityByName(
"DRIVING_Copilot"
);
99
if
(oldEnt)
100
{
101
oldEnt.
SetName
(
string
.Empty);
102
tutorial.InsertIntoGarbage(oldEnt);
103
104
SCR_TutorialInstructorComponent instructorComp = SCR_TutorialInstructorComponent.Cast(oldEnt.
FindComponent
(SCR_TutorialInstructorComponent));
105
if
(instructorComp)
106
instructorComp.EnableCourse(
false
);
107
}
108
109
oldEnt =
GetGame
().
GetWorld
().FindEntityByName(
"SmallJeep"
);
110
if
(oldEnt)
111
{
112
oldEnt.
SetName
(
string
.Empty);
113
tutorial.InsertIntoGarbage(oldEnt);
114
tutorial.ChangeVehicleLockState(oldEnt,
true
);
115
}
116
}
117
118
//------------------------------------------------------------------------------------------------
119
override
void
OnCourseEnd
()
120
{
121
IEntity
instructor =
GetGame
().
GetWorld
().FindEntityByName(
"DRIVING_Copilot"
);
122
if
(instructor)
123
{
124
SCR_CompartmentAccessComponent
compartmentAccess =
SCR_CompartmentAccessComponent
.Cast(instructor.
FindComponent
(
SCR_CompartmentAccessComponent
));
125
if
(compartmentAccess)
126
compartmentAccess.
GetOnCompartmentLeft
().Remove(
OnCompartmentLeft
);
127
}
128
129
if
(!
m_CourseVehicle
)
130
return
;
131
132
SCR_VehicleDamageManagerComponent
damageManager =
SCR_VehicleDamageManagerComponent
.Cast(
m_CourseVehicle
.GetDamageManager());
133
if
(damageManager)
134
{
135
damageManager.GetOnDamageStateChanged().Remove(
OnVehicleDamaged
);
136
137
SCR_HitZone
engine =
SCR_HitZone
.Cast(damageManager.GetHitZoneByName(
"Engine_01"
));
138
if
(engine)
139
engine.
GetOnDamageStateChanged
().Remove(
OnHitZoneDamageStateChanged
);
140
141
SCR_HitZone
gearbox =
SCR_HitZone
.Cast(damageManager.GetHitZoneByName(
"Gearbox_01"
));
142
if
(gearbox)
143
gearbox.
GetOnDamageStateChanged
().Remove(
OnHitZoneDamageStateChanged
);
144
}
145
146
VehicleControllerComponent vehicleController = VehicleControllerComponent.Cast(
m_CourseVehicle
.FindComponent(VehicleControllerComponent));
147
if
(vehicleController)
148
vehicleController.GetOnEngineStop().Remove(
OnEngineStoppedJeep
);
149
150
SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
151
if
(!tutorial)
152
return
;
153
154
if
(tutorial.CanBreakCourse())
155
HandleOldAssets
();
156
};
157
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
SCR_ETutorialBreakType
SCR_ETutorialBreakType
Definition
SCR_ETutorialBreakType.c:2
SCR_VehicleDamageManagerComponent
void SCR_VehicleDamageManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_VehicleDamageManagerComponent.c:2166
BaseCompartmentManagerComponent
Definition
BaseCompartmentManagerComponent.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
IEntity::GetWorld
proto external BaseWorld GetWorld()
IEntity::SetName
proto external void SetName(string name)
SCR_BaseTutorialCourseLogic
Definition
SCR_BaseTutorialCourseLogic.c:3
SCR_CompartmentAccessComponent
Definition
SCR_CompartmentAccessComponent.c:16
SCR_CompartmentAccessComponent::GetOnCompartmentLeft
ScriptInvoker GetOnCompartmentLeft(bool createNew=true)
Definition
SCR_CompartmentAccessComponent.c:38
SCR_HitZone
Definition
SCR_HitZone.c:2
SCR_HitZone::GetOnDamageStateChanged
ScriptInvoker GetOnDamageStateChanged(bool createNew=true)
Definition
SCR_HitZone.c:32
SCR_TutorialLogic_Driving
Definition
SCR_TutorialLogic_Driving.c:3
SCR_TutorialLogic_Driving::OnVehicleDamaged
void OnVehicleDamaged(EDamageState state)
Definition
SCR_TutorialLogic_Driving.c:26
SCR_TutorialLogic_Driving::HandleOldAssets
void HandleOldAssets()
Definition
SCR_TutorialLogic_Driving.c:92
SCR_TutorialLogic_Driving::OnHitZoneDamageStateChanged
void OnHitZoneDamageStateChanged(SCR_HitZone hitzone)
Definition
SCR_TutorialLogic_Driving.c:15
SCR_TutorialLogic_Driving::OnCourseStart
override void OnCourseStart()
Definition
SCR_TutorialLogic_Driving.c:54
SCR_TutorialLogic_Driving::m_CourseVehicle
Vehicle m_CourseVehicle
Definition
SCR_TutorialLogic_Driving.c:4
SCR_TutorialLogic_Driving::OnCourseEnd
override void OnCourseEnd()
Definition
SCR_TutorialLogic_Driving.c:119
SCR_TutorialLogic_Driving::OnEngineStoppedJeep
void OnEngineStoppedJeep()
Definition
SCR_TutorialLogic_Driving.c:37
SCR_TutorialLogic_Driving::OnCompartmentLeft
void OnCompartmentLeft(IEntity targetEntity, BaseCompartmentManagerComponent manager, int mgrID, int slotID, bool move)
Definition
SCR_TutorialLogic_Driving.c:7
Vehicle
enum EPhysicsLayerPresets Vehicle
Definition
gameLib.c:24
EDamageState
EDamageState
Definition
EDamageState.c:13
scripts
Game
GameMode
Tutorial
Stages
DrivingSimple
SCR_TutorialLogic_Driving.c
Generated by
1.17.0