mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
Adjusts the handling of the disconnect call to not utilize package overrides, but instead a callOnModules invoke like most other cross-module calls.
This allows the editor to issue a disconnect call properly again.
This commit is contained in:
parent
28c8690d72
commit
7b7de1f10f
3 changed files with 14 additions and 38 deletions
|
|
@ -111,8 +111,12 @@ function handleConnectionErrorMessage(%msgType, %msgString, %msgError)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Disconnect
|
// Disconnect
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
function disconnect()
|
function disconnect()
|
||||||
|
{
|
||||||
|
callOnModules("disconnect");
|
||||||
|
}
|
||||||
|
|
||||||
|
function Core_ClientServer::disconnect(%this)
|
||||||
{
|
{
|
||||||
// We need to stop the client side simulation
|
// We need to stop the client side simulation
|
||||||
// else physics resources will not cleanup properly.
|
// else physics resources will not cleanup properly.
|
||||||
|
|
|
||||||
|
|
@ -24,3 +24,12 @@ function ToolsModule::onDestroy(%this)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ToolsModule::disconnect(%this)
|
||||||
|
{
|
||||||
|
if ( isObject( Editor ) && Editor.isEditorEnabled() )
|
||||||
|
{
|
||||||
|
EditorGui.saveAs = false; //whatever edits we were doing are irrelevent now
|
||||||
|
Editor.close(MainMenuGui);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -164,40 +164,3 @@ function toggleEditor(%make)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// The editor action maps are defined in editor.bind.tscript
|
// The editor action maps are defined in editor.bind.tscript
|
||||||
GlobalActionMap.bind(keyboard, "f11", fastLoadWorldEdit);
|
GlobalActionMap.bind(keyboard, "f11", fastLoadWorldEdit);
|
||||||
|
|
||||||
|
|
||||||
// The scenario:
|
|
||||||
// The editor is open and the user closes the level by any way other than
|
|
||||||
// the file menu ( exit level ), eg. typing disconnect() in the console.
|
|
||||||
//
|
|
||||||
// The problem:
|
|
||||||
// Editor::close() is not called in this scenario which means onEditorDisable
|
|
||||||
// is not called on objects which hook into it and also gEditingMission will no
|
|
||||||
// longer be valid.
|
|
||||||
//
|
|
||||||
// The solution:
|
|
||||||
// Override the stock disconnect() function which is in game scripts from here
|
|
||||||
// in tools so we avoid putting our code in there.
|
|
||||||
//
|
|
||||||
// Disclaimer:
|
|
||||||
// If you think of a better way to do this feel free. The thing which could
|
|
||||||
// be dangerous about this is that no one will ever realize this code overriding
|
|
||||||
// a fairly standard and core game script from a somewhat random location.
|
|
||||||
// If it 'did' have unforscene sideeffects who would ever find it?
|
|
||||||
|
|
||||||
package EditorDisconnectOverride
|
|
||||||
{
|
|
||||||
function disconnect()
|
|
||||||
{
|
|
||||||
if ( isObject( Editor ) && Editor.isEditorEnabled() )
|
|
||||||
{
|
|
||||||
EditorGui.saveAs = false; //whatever edits we were doing are irrelevent now
|
|
||||||
%mainMenuGUI = ProjectSettings.value("UI/mainMenuName");
|
|
||||||
if (isObject( %mainMenuGUI ))
|
|
||||||
Editor.close( %mainMenuGUI );
|
|
||||||
}
|
|
||||||
|
|
||||||
Parent::disconnect();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
activatePackage( EditorDisconnectOverride );
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue