mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Ensures that if no client camera is defined when attempting to swap into an editor camera mode, it makes one so that the normal editor camera modes can work as expected
Adds sanity check to default onNewDatablock function on the GameDatablock namespace in case the onAdd or onRemove functions aren't defined, we don't spam the console
This commit is contained in:
parent
6c8dfdbe4c
commit
0e0cc0b83a
|
|
@ -80,8 +80,10 @@ function spawnGameObject(%name, %addToScene)
|
|||
|
||||
function GameBaseData::onNewDataBlock(%this, %obj)
|
||||
{
|
||||
%this.onRemove(%obj);
|
||||
%this.onAdd(%obj);
|
||||
if(%this.isMethod("onRemove"))
|
||||
%this.onRemove(%obj);
|
||||
if(%this.isMethod("onAdd"))
|
||||
%this.onAdd(%obj);
|
||||
}
|
||||
|
||||
function saveGameObject(%name, %tamlPath, %scriptPath)
|
||||
|
|
|
|||
|
|
@ -47,6 +47,15 @@ function serverCmdToggleCamera(%client)
|
|||
{
|
||||
if (%client.getControlObject() == %client.player)
|
||||
{
|
||||
if (!isObject(%client.camera))
|
||||
{
|
||||
%client.camera = spawnObject("Camera", Observer);
|
||||
MissionCleanup.add( %client.camera );
|
||||
%client.camera.scopeToClient(%client);
|
||||
|
||||
%client.camera.setPosition(%client.player.getPosition());
|
||||
}
|
||||
|
||||
%client.camera.setVelocity("0 0 0");
|
||||
%control = %client.camera;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue