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_ScenarioFrameworkPluginOnDestroyEvent.c
Go to the documentation of this file.
1
[
BaseContainerProps
(),
SCR_ContainerActionTitle
()]
2
class
SCR_ScenarioFrameworkPluginOnDestroyEvent
:
SCR_ScenarioFrameworkPlugin
3
{
4
[
Attribute
(
UIWidgets
.Auto,
desc
:
"What to do once object gets destroyed"
,
category
:
"OnDestroy"
)]
5
ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnDestroy;
6
7
IEntity
m_Asset;
8
9
//------------------------------------------------------------------------------------------------
12
override
void
Init
(
SCR_ScenarioFrameworkLayerBase
object
)
13
{
14
if
(!
object
)
15
return
;
16
17
super.Init(
object
);
18
IEntity
entity =
object
.GetSpawnedEntity();
19
if
(!entity)
20
{
21
Print
(
"ScenarioFramework: No entity was spawned by layer to add OnDestroy event to"
,
LogLevel
.ERROR);
22
return
;
23
}
24
25
m_Asset = entity;
26
27
SCR_AIGroup
group =
SCR_AIGroup
.Cast(m_Asset);
28
if
(!group)
29
{
30
SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.GetDamageManager(m_Asset);
31
if
(objectDmgManager)
32
objectDmgManager.GetOnDamageStateChanged().Insert(OnObjectDamage);
33
else
34
PrintFormat
(
"ScenarioFramework: Registering OnDestroy of entity %1 failed! The entity doesn't have damage manager"
, entity,
LogLevel
.ERROR);
35
36
if
(
Vehicle
.Cast(m_Asset))
37
{
38
VehicleControllerComponent vehicleController = VehicleControllerComponent.Cast(m_Asset.FindComponent(VehicleControllerComponent));
39
if
(vehicleController)
40
vehicleController.GetOnEngineStop().Insert(CheckEngineDrowned);
41
42
//---- REFACTOR NOTE START: This code will need to be refactored as current implementation is not conforming to the standards ----
43
44
// Since there is no invoker and no reliable way how to tackle drowned vehicles, in order to make it reliable,
45
// We cannot solely rely on GetOnEngineStop because vehicle could have been pushed/moved into the water without started engine.
46
SCR_ScenarioFrameworkSystem
.
GetCallQueuePausable
().CallLater(CheckEngineDrowned, 5000,
true
);
47
48
//---- REFACTOR NOTE END ----
49
}
50
}
51
else
52
{
53
group.
GetOnEmpty
().Insert(OnGroupEmpty);
54
}
55
}
56
57
//------------------------------------------------------------------------------------------------
58
void
OnActivate
()
59
{
60
foreach
(
SCR_ScenarioFrameworkActionBase
action : m_aActionsOnDestroy)
61
{
62
action.OnActivate(m_Asset);
63
}
64
}
65
66
//------------------------------------------------------------------------------------------------
68
void
OnObjectDamage(
EDamageState
state)
69
{
70
// Here you can debug specific Plugin instance.
71
// This can be also adjusted during runtime via Debug Menu > ScenarioFramework > Plugin Inspector
72
if
(m_bDebug)
73
Print
(
"[SCR_ScenarioFrameworkPluginOnDestroyEvent.OnObjectDamage] debug line ("
+ __FILE__ +
" L"
+ __LINE__ +
")"
,
LogLevel
.WARNING);
74
75
if
(state !=
EDamageState
.DESTROYED || !m_Asset)
76
return
;
77
78
SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.GetDamageManager(m_Asset);
79
if
(objectDmgManager)
80
{
81
objectDmgManager.GetOnDamageStateChanged().Remove(OnObjectDamage);
82
SCR_ScenarioFrameworkSystem
.
GetCallQueuePausable
().Remove(CheckEngineDrowned);
83
84
VehicleControllerComponent vehicleController = VehicleControllerComponent.Cast(m_Asset.FindComponent(VehicleControllerComponent));
85
if
(vehicleController)
86
vehicleController.GetOnEngineStop().Remove(CheckEngineDrowned);
87
}
88
89
OnActivate
();
90
}
91
92
//------------------------------------------------------------------------------------------------
94
void
CheckEngineDrowned()
95
{
96
// Here you can debug specific Plugin instance.
97
// This can be also adjusted during runtime via Debug Menu > ScenarioFramework > Plugin Inspector
98
if
(m_bDebug)
99
Print
(
"[SCR_ScenarioFrameworkPluginOnDestroyEvent.CheckEngineDrowned] debug line ("
+ __FILE__ +
" L"
+ __LINE__ +
")"
,
LogLevel
.WARNING);
100
101
if
(!m_Asset)
102
return
;
103
104
VehicleControllerComponent vehicleController = VehicleControllerComponent.Cast(m_Asset.FindComponent(VehicleControllerComponent));
105
if
(vehicleController && vehicleController.GetEngineDrowned())
106
{
107
vehicleController.GetOnEngineStop().Remove(CheckEngineDrowned);
108
SCR_ScenarioFrameworkSystem
.
GetCallQueuePausable
().Remove(CheckEngineDrowned);
109
110
SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.GetDamageManager(m_Asset);
111
if
(objectDmgManager)
112
objectDmgManager.GetOnDamageStateChanged().Remove(OnObjectDamage);
113
114
OnActivate
();
115
}
116
}
117
118
//------------------------------------------------------------------------------------------------
119
void
OnGroupEmpty(AIGroup group)
120
{
121
SCR_AIGroup
aiGroup =
SCR_AIGroup
.Cast(group);
122
if
(!aiGroup)
123
return
;
124
125
aiGroup.
GetOnEmpty
().Remove(OnGroupEmpty);
126
OnActivate
();
127
}
128
129
//------------------------------------------------------------------------------------------------
130
override
array<ref SCR_ScenarioFrameworkActionBase>
GetActions
()
131
{
132
return
m_aActionsOnDestroy;
133
}
134
}
Init
override void Init()
Definition
CharacterCameraHandlerComponent.c:40
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
OnActivate
override void OnActivate()
Definition
SCR_CharacterCommandLoiter.c:31
GetActions
array< ref SCR_MenuActionPreset > GetActions()
Definition
SCR_MenuActionsComponent.c:186
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
SCR_ScenarioFrameworkLayerBase
void SCR_ScenarioFrameworkLayerBase(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_ScenarioFrameworkLayerBase.c:1411
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
IEntity
Definition
IEntity.c:13
SCR_AIGroup
Definition
SCR_AIGroup.c:75
SCR_AIGroup::GetOnEmpty
ScriptInvoker_AIGroupOnEmpty GetOnEmpty()
Definition
SCR_AIGroup.c:2228
SCR_ContainerActionTitle
Definition
SCR_ContainerActionTitle.c:2
SCR_ScenarioFrameworkActionBase
Definition
SCR_ScenarioFrameworkActionBase.c:3
SCR_ScenarioFrameworkPlugin
Definition
SCR_ScenarioFrameworkPlugin.c:3
SCR_ScenarioFrameworkPluginOnDestroyEvent
Definition
SCR_ScenarioFrameworkPluginOnDestroyEvent.c:3
SCR_ScenarioFrameworkSystem
Definition
SCR_ScenarioFrameworkSystem.c:2
SCR_ScenarioFrameworkSystem::GetCallQueuePausable
static ScriptCallQueue GetCallQueuePausable()
Definition
SCR_ScenarioFrameworkSystem.c:87
UIWidgets
Definition
attributes.c:40
Vehicle
enum EPhysicsLayerPresets Vehicle
Definition
gameLib.c:24
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
PrintFormat
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EDamageState
EDamageState
Definition
EDamageState.c:13
scripts
Game
ScenarioFramework
Plugins
SCR_ScenarioFrameworkPluginOnDestroyEvent.c
Generated by
1.17.0