Merge branch 'development' of https://github.com/TorqueGameEngines/Torque3D into alpha41/DamageModel

# Conflicts:
#	Engine/source/T3D/vehicles/vehicle.cpp
This commit is contained in:
AzaezelX 2025-04-28 10:53:53 -05:00
commit be35c27411
64 changed files with 619 additions and 371 deletions

View file

@ -111,8 +111,12 @@ function handleConnectionErrorMessage(%msgType, %msgString, %msgError)
//-----------------------------------------------------------------------------
// Disconnect
//-----------------------------------------------------------------------------
function disconnect()
{
callOnModules("disconnect");
}
function Core_ClientServer::disconnect(%this)
{
// We need to stop the client side simulation
// else physics resources will not cleanup properly.
@ -158,3 +162,16 @@ function disconnectedCleanup()
moduleExec("onDestroyClientConnection", "Game");
}
function clientCmdsetMoveMap(%movemap)
{
if (!isObject(%movemap)) return;
if(isObject(ServerConnection) && isObject(ServerConnection.curMoveMap))
ServerConnection.curMoveMap.pop();
// clear movement
$mvForwardAction = 0;
$mvBackwardAction = 0;
%movemap.push();
ServerConnection.curMoveMap = %movemap;
}

View file

@ -275,7 +275,9 @@ function GameConnection::onPostSpawn( %this )
if (%this.numModsNeedingLoaded)
callOnObjectList("onPostSpawn", %modulesIdList, %this);
else
%this.listener.onPostSpawnComplete(%this);
%this.listener.onPostSpawnComplete(%this);
if (isObject(%this.player.getDatablock().controlMap))
commandToClient(%this, 'setMoveMap', %this.player.getDatablock().controlMap);
}
function GameConnectionListener::onPostSpawnComplete(%this, %client)

View file

@ -78,17 +78,15 @@ function spawnGameObject(%name, %addToScene)
return 0;
}
function GameBaseData::onNewDataBlock(%this, %obj)
function GameBaseData::onNewDataBlock(%this, %obj, %reload)
{
if (%obj.firstDataCheck)
if (%reload)
{
if(%this.isMethod("onRemove"))
%this.onRemove(%obj);
if(%this.isMethod("onAdd"))
%this.onAdd(%obj);
}
else
%obj.firstDataCheck = true;
}
function saveGameObject(%name, %tamlPath, %scriptPath)

View file

@ -23,4 +23,13 @@ function ToolsModule::onCreate(%this)
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);
}
}

View file

@ -164,40 +164,3 @@ function toggleEditor(%make)
//------------------------------------------------------------------------------
// The editor action maps are defined in editor.bind.tscript
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 );