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_PersistenceSystem.c
Go to the documentation of this file.
1
void
SCR_PersistenceSystem_OnStateChanged
(
EPersistenceSystemState
oldState,
EPersistenceSystemState
newState);
2
typedef
func
SCR_PersistenceSystem_OnStateChanged
;
3
4
void
SCR_PersistenceSystem_OnBeforeSave
(
ESaveGameType
saveType);
5
typedef
func
SCR_PersistenceSystem_OnBeforeSave
;
6
7
void
SCR_PersistenceSystem_OnAfterSave
(
ESaveGameType
saveType,
bool
success);
8
typedef
func
SCR_PersistenceSystem_OnAfterSave
;
9
10
class
SCR_PersistenceSystem
:
PersistenceSystem
11
{
12
protected
ref ScriptInvokerBase<SCR_PersistenceSystem_OnStateChanged>
m_OnStateChanged
=
new
ScriptInvokerBase<SCR_PersistenceSystem_OnStateChanged>();
13
protected
ref ScriptInvokerBase<SCR_PersistenceSystem_OnBeforeSave>
m_OnBeforeSave
=
new
ScriptInvokerBase<SCR_PersistenceSystem_OnBeforeSave>();
14
protected
ref ScriptInvokerBase<SCR_PersistenceSystem_OnAfterSave>
m_OnAfterSave
=
new
ScriptInvokerBase<SCR_PersistenceSystem_OnAfterSave>();
15
16
//------------------------------------------------------------------------------------------------
17
override
protected
void
OnStateChanged
(
EPersistenceSystemState
oldState,
EPersistenceSystemState
newState)
18
{
19
m_OnStateChanged
.Invoke(oldState, newState);
20
}
21
22
//------------------------------------------------------------------------------------------------
23
override
protected
void
OnBeforeSave
(
ESaveGameType
saveType)
24
{
25
m_OnBeforeSave
.Invoke(saveType);
26
}
27
28
//------------------------------------------------------------------------------------------------
29
override
protected
void
OnAfterSave
(
ESaveGameType
saveType,
bool
success)
30
{
31
m_OnAfterSave
.Invoke(saveType, success);
32
33
if
(success)
34
SCR_NotificationsComponent.SendLocal(
ENotification
.EDITOR_SESSION_SAVE_SUCCESS);
35
else
36
SCR_NotificationsComponent.SendLocal(
ENotification
.EDITOR_SESSION_SAVE_FAIL);
37
}
38
39
//------------------------------------------------------------------------------------------------
40
override
protected
void
OnAfterLoad
(
bool
success)
41
{
42
if
(
System
.IsConsoleApp())
43
return
;
44
45
if
(!success)
46
{
47
GetGame
().GetCallqueue().Call(
DeferredNotifcation
,
ENotification
.EDITOR_SESSION_LOAD_FAIL);
48
return
;
49
}
50
51
const
SaveGameManager
manager =
GetGame
().GetSaveGameManager();
52
if
(manager && manager.GetActiveSave())
53
GetGame
().GetCallqueue().Call(
DeferredNotifcation
,
ENotification
.EDITOR_SESSION_LOAD_SUCCESS);
54
}
55
56
//------------------------------------------------------------------------------------------------
57
override
protected
void
HandleDelete
(
IEntity
entity)
58
{
59
SCR_EntityHelper
.DeleteBuilding(entity);
60
}
61
62
//------------------------------------------------------------------------------------------------
63
protected
void
DeferredNotifcation
(
ENotification
notification)
64
{
65
SCR_NotificationsComponent.SendLocal(notification);
66
}
67
68
//------------------------------------------------------------------------------------------------
69
sealed ScriptInvokerBase<SCR_PersistenceSystem_OnStateChanged>
GetOnStateChanged
()
70
{
71
return
m_OnStateChanged
;
72
}
73
74
//------------------------------------------------------------------------------------------------
75
sealed ScriptInvokerBase<SCR_PersistenceSystem_OnBeforeSave>
GetOnBeforeSave
()
76
{
77
return
m_OnBeforeSave
;
78
}
79
80
//------------------------------------------------------------------------------------------------
81
sealed ScriptInvokerBase<SCR_PersistenceSystem_OnAfterSave>
GetOnAfterSave
()
82
{
83
return
m_OnAfterSave
;
84
}
85
86
//------------------------------------------------------------------------------------------------
91
sealed
static
bool
IsLoadInProgress
(
float
msSinceLoad = 1000.0)
92
{
93
// TODO: We need to know if and what data to load ahead of even world systems init. Add pre world load phase.
94
if
(!
GetGame
().GetSaveGameManager().GetActiveSave())
95
return
false
;
96
97
const
PersistenceSystem
instance = GetInstance();
98
if
(!instance)
99
return
false
;
100
101
const
EPersistenceSystemState
state = instance.GetState();
102
if
(instance.GetState() <
EPersistenceSystemState
.ACTIVE)
103
return
true
;
104
105
return
instance.WasDataLoaded() && (
GetGame
().GetWorld().GetWorldTime() < msSinceLoad);
106
}
107
108
//------------------------------------------------------------------------------------------------
109
sealed
static
SCR_PersistenceSystem
GetScriptedInstance
()
110
{
111
return
SCR_PersistenceSystem
.Cast(GetInstance());
112
}
113
114
//------------------------------------------------------------------------------------------------
115
sealed
static
SCR_PersistenceSystem
GetByCurrentWorld
()
116
{
117
ChimeraWorld
world =
ChimeraWorld
.CastFrom(
GetGame
().GetWorld());
118
if
(!world)
119
return
null;
120
121
return
SCR_PersistenceSystem
.Cast(world.FindSystem(
SCR_PersistenceSystem
));
122
}
123
124
//------------------------------------------------------------------------------------------------
125
sealed
static
SCR_PersistenceSystem
GetByEntityWorld
(
IEntity
entity)
126
{
127
ChimeraWorld
world =
ChimeraWorld
.CastFrom(entity.
GetWorld
());
128
if
(!world)
129
return
null;
130
131
return
SCR_PersistenceSystem
.Cast(world.FindSystem(
SCR_PersistenceSystem
));
132
}
133
}
ENotification
ENotification
Definition
ENotification.c:5
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
func
func
Definition
SCR_AIThreatSystem.c:6
SCR_PersistenceSystem_OnBeforeSave
func SCR_PersistenceSystem_OnBeforeSave
Definition
SCR_PersistenceSystem.c:5
SCR_PersistenceSystem_OnStateChanged
func SCR_PersistenceSystem_OnStateChanged
Definition
SCR_PersistenceSystem.c:2
SCR_PersistenceSystem_OnAfterSave
func SCR_PersistenceSystem_OnAfterSave
Definition
SCR_PersistenceSystem.c:8
ChimeraWorld
Definition
ChimeraWorld.c:13
IEntity
Definition
IEntity.c:13
IEntity::GetWorld
proto external BaseWorld GetWorld()
PersistenceSystem
Definition
PersistenceSystem.c:13
SCR_EntityHelper
Definition
SCR_EntityHelper.c:2
SCR_PersistenceSystem
Definition
SCR_PersistenceSystem.c:11
SCR_PersistenceSystem::GetByCurrentWorld
static sealed SCR_PersistenceSystem GetByCurrentWorld()
Definition
SCR_PersistenceSystem.c:115
SCR_PersistenceSystem::OnStateChanged
void OnStateChanged(EPersistenceSystemState oldState, EPersistenceSystemState newState)
Definition
SCR_PersistenceSystem.c:17
SCR_PersistenceSystem::m_OnBeforeSave
ref ScriptInvokerBase< SCR_PersistenceSystem_OnBeforeSave > m_OnBeforeSave
Definition
SCR_PersistenceSystem.c:13
SCR_PersistenceSystem::IsLoadInProgress
static sealed bool IsLoadInProgress(float msSinceLoad=1000.0)
Definition
SCR_PersistenceSystem.c:91
SCR_PersistenceSystem::HandleDelete
void HandleDelete(IEntity entity)
Definition
SCR_PersistenceSystem.c:57
SCR_PersistenceSystem::GetByEntityWorld
static sealed SCR_PersistenceSystem GetByEntityWorld(IEntity entity)
Definition
SCR_PersistenceSystem.c:125
SCR_PersistenceSystem::GetScriptedInstance
static sealed SCR_PersistenceSystem GetScriptedInstance()
Definition
SCR_PersistenceSystem.c:109
SCR_PersistenceSystem::OnAfterLoad
void OnAfterLoad(bool success)
Definition
SCR_PersistenceSystem.c:40
SCR_PersistenceSystem::OnAfterSave
void OnAfterSave(ESaveGameType saveType, bool success)
Definition
SCR_PersistenceSystem.c:29
SCR_PersistenceSystem::GetOnAfterSave
sealed ScriptInvokerBase< SCR_PersistenceSystem_OnAfterSave > GetOnAfterSave()
Definition
SCR_PersistenceSystem.c:81
SCR_PersistenceSystem::GetOnStateChanged
sealed ScriptInvokerBase< SCR_PersistenceSystem_OnStateChanged > GetOnStateChanged()
Definition
SCR_PersistenceSystem.c:69
SCR_PersistenceSystem::DeferredNotifcation
void DeferredNotifcation(ENotification notification)
Definition
SCR_PersistenceSystem.c:63
SCR_PersistenceSystem::GetOnBeforeSave
sealed ScriptInvokerBase< SCR_PersistenceSystem_OnBeforeSave > GetOnBeforeSave()
Definition
SCR_PersistenceSystem.c:75
SCR_PersistenceSystem::m_OnStateChanged
ref ScriptInvokerBase< SCR_PersistenceSystem_OnStateChanged > m_OnStateChanged
Definition
SCR_PersistenceSystem.c:12
SCR_PersistenceSystem::m_OnAfterSave
ref ScriptInvokerBase< SCR_PersistenceSystem_OnAfterSave > m_OnAfterSave
Definition
SCR_PersistenceSystem.c:14
SCR_PersistenceSystem::OnBeforeSave
void OnBeforeSave(ESaveGameType saveType)
Definition
SCR_PersistenceSystem.c:23
SaveGameManager
Definition
SaveGameManager.c:13
System
Definition
System.c:13
ESaveGameType
ESaveGameType
Definition
ESaveGameType.c:13
EPersistenceSystemState
EPersistenceSystemState
Definition
EPersistenceSystemState.c:13
scripts
Game
Plugins
Persistence
System
SCR_PersistenceSystem.c
Generated by
1.17.0