1[
EntityEditorProps(
category:
"GameScripted/Editor", description:
"Editor mode", color:
"251 91 0 255", icon:
"WBData/EntityEditorProps/entityEditor.png")]
27 [
Attribute(
"-1",
desc:
"Order in which modes are listed. Lower number means earlier place.",
category:
"Editor Mode")]
30 [
Attribute(
desc:
"Anti-exploit restriction will be in effect when all available modes are marked as limited.",
category:
"Editor Mode")]
31 private bool m_bIsLimited;
33 [
Attribute(
desc:
"When enabled, removing this mode when it's current will close the editor instead of switching to the next available mode.",
category:
"Editor Mode")]
34 private bool m_bCloseAfterRemoval;
44 [
Attribute(
"0",
desc:
"If true will only notify the local player when the mode is added or removed, if false it sends to to all Game Masters and the local player",
category:
"Notification")]
98 bool ShouldCloseAfterRemoval()
100 return m_bCloseAfterRemoval;
108 return m_EditorManager && m_EditorManager.GetCurrentModeEntity() ==
this;
114 static SCR_EditorModeEntity GetInstance()
117 if (!editorManager)
return null;
119 return editorManager.GetCurrentModeEntity();
124 void PreActivateMode()
126 if (!m_EditorManager.IsOpened() && !m_EditorManager.IsInTransition())
129 Event_OnPreActivate.Invoke();
131 void ActivateMode(
bool isInit =
false)
133 if (!m_EditorManager.IsOpened() && !m_EditorManager.IsInTransition())
137 Event_OnActivate.Invoke();
139 void PostActivateMode()
141 if (!m_EditorManager.IsOpened() && !m_EditorManager.IsInTransition())
144 Event_OnPostActivate.Invoke();
146 void DeactivateMode()
148 if (!m_EditorManager.IsOpened() && !m_EditorManager.IsInTransition())
151 Event_OnDeactivate.Invoke();
156 void ActivateModeServer()
158 int playerId = m_EditorManager.GetPlayerID();
159 IEntity character =
GetGame().GetPlayerManager().GetPlayerControlledEntity(playerId);
160 string additionalInfo;
162 additionalInfo =
string.Format(
" while being at %1", character.
GetOrigin());
164 PrintFormat(
"INFO: Editor %1: Player %2 opened the editor%3.",
typename.EnumToString(
EEditorMode, GetModeType()), SCR_PlayerIdentityUtils.GetPlayerLogInfo(playerId), additionalInfo, level:
LogLevel.NORMAL);
165 Event_OnActivateServer.Invoke();
168 void DeactivateModeServer()
170 Event_OnDeactivateServer.Invoke();
178 bool SendNotificationLocalOnly()
184 bool GetPreventClose()
240 return Event_OnPreActivate;
244 return Event_OnActivate;
248 return Event_OnPostActivate;
252 return Event_OnDeactivate;
274 return Event_OnActivateServer;
278 return Event_OnDeactivateServer;
288 return m_EditorManager && m_EditorManager.IsOpened();
292 return m_EditorManager;
296 RplComponent rplEditor = RplComponent.Cast(editorManager.FindComponent(RplComponent));
297 RplComponent rplMode = RplComponent.Cast(
FindComponent(RplComponent));
298 if (!rplEditor || !rplMode)
return;
300 rplMode.Give(Replication.FindOwner(rplEditor.Id()));
302 m_EditorManager = editorManager;
313 if (!m_EditorManager)
315 Print(
"Error when initialized editor mode!",
LogLevel.ERROR);
320 Event_OnInit.Invoke();
322 void SCR_EditorModeEntity(IEntitySource src,
IEntity parent)
324 ChimeraWorld world =
GetGame().GetWorld();
327 world.RegisterEntityToBeUpdatedWhileGameIsPaused(
this);
332 void ~SCR_EditorModeEntity()
334 if (m_EditorManager) m_EditorManager.RemoveMode(
this,
false);
335 Event_OnDeactivate.Invoke();
337 ChimeraWorld world =
GetGame().GetWorld();
340 world.UnregisterEntityToBeUpdatedWhileGameIsPaused(
this);
ArmaReforgerScripted GetGame()
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
override ScriptInvoker GetOnPreActivate()
override ScriptInvoker GetOnActivate()
override ScriptInvoker GetOnRequest()
override ScriptInvoker GetOnOpenedServerCallback()
override ScriptInvoker GetOnClosedServerCallback()
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
override SCR_EditorManagerEntity GetManager()
override ScriptInvoker GetOnClosedServer()
override ScriptInvoker GetOnDeactivateServer()
override ScriptInvoker GetOnOpened()
override ScriptInvoker GetOnActivateServer()
override ScriptInvoker GetOnPostActivate()
override ScriptInvoker GetOnDebug()
override ScriptInvoker GetOnDeactivate()
override ScriptInvoker GetOnClosed()
override ScriptInvoker GetOnOpenedServer()
override ScriptInvoker GetOnInit()
override SCR_UIInfo GetInfo()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
proto external EntityFlags SetFlags(EntityFlags flags, bool recursively=false)
proto external EntityFlags ClearFlags(EntityFlags flags, bool recursively=false)
void InitComponents(bool isServer)
ENotification m_ModeRemovedNotification
bool m_bSendNotificationLocalOnly
ENotification m_ModeAddedNotification
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
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)
SCR_FieldOfViewSettings Attribute
EEditorMode
Editor mode that defines overall functionality.
EntityFlags
Various entity flags.
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.