From 07b8619bf3a05330c7dcc8a20a33e178b5922a7f Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 28 Aug 2019 00:56:24 -0500 Subject: [PATCH] Changed findModule default version value to 1 to match default module version number Added running of onCreateGameServer and onDestoyGameServer callOnModules for core modules as well to enable default datablock stuffs Added default datablocks, materials and shaders for some base required objects such as spawn markers, ribbon particles and the like. Includes ExampleModule to act as a template/documentation case for how modules should be set up Includes GameUI module so there's a PlayGUI gui object by default. --- .../module/moduleManager_ScriptBinding.h | 6 +- .../clientServer/scripts/server/server.cs | 5 +- .../game/core/gameObjects/Core_GameObjects.cs | 25 ++ .../game/core/utility/scripts/module.cs | 35 ++ Templates/BaseGame/game/tools/settings.xml | 310 +++++++++--------- 5 files changed, 221 insertions(+), 160 deletions(-) diff --git a/Engine/source/module/moduleManager_ScriptBinding.h b/Engine/source/module/moduleManager_ScriptBinding.h index 8abc8aab5..646ab1e6f 100644 --- a/Engine/source/module/moduleManager_ScriptBinding.h +++ b/Engine/source/module/moduleManager_ScriptBinding.h @@ -1,4 +1,4 @@ -//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Copyright (c) 2013 GarageGames, LLC // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -115,7 +115,7 @@ DefineEngineMethod(ModuleManager, unloadExplicit, bool, (const char* pModuleId), //----------------------------------------------------------------------------- -DefineEngineMethod(ModuleManager, findModule, String, (const char* pModuleId, U32 pVersionId), ("", 0), +DefineEngineMethod(ModuleManager, findModule, String, (const char* pModuleId, U32 pVersionId), ("", 1), "Find the specific module Id optionally at the specified version Id.\n" "@param moduleId The module Id to find.\n" "@param versionId The version Id to find.\n" @@ -386,4 +386,4 @@ DefineEngineMethod(ModuleManager, ignoreLoadedGroups, void, (bool doIgnore), (fa { // Check whether the merge modules can current happen or not. return object->setIgnoreLoadedGroups(doIgnore); -} \ No newline at end of file +} diff --git a/Templates/BaseGame/game/core/clientServer/scripts/server/server.cs b/Templates/BaseGame/game/core/clientServer/scripts/server/server.cs index 06721bc4b..de43a641d 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/server/server.cs +++ b/Templates/BaseGame/game/core/clientServer/scripts/server/server.cs @@ -164,7 +164,8 @@ function createServer(%serverType, %level) schedule(0,0,startHeartbeat); } - callOnModules("onCreateServer", "Game"); + callOnModules("onCreateGameServer", "Core"); + callOnModules("onCreateGameServer", "Game"); // Let the game initialize some things now that the // the server has been created @@ -240,7 +241,7 @@ function destroyServer() deleteDataBlocks(); //Get our modules so we can exec any specific server-side loading/handling - callOnModules("onDestroyServer", "Game"); + callOnModules("onDestroyGameServer", "Game"); // Save any server settings %prefPath = getPrefpath(); diff --git a/Templates/BaseGame/game/core/gameObjects/Core_GameObjects.cs b/Templates/BaseGame/game/core/gameObjects/Core_GameObjects.cs index 93362577e..c62131e0f 100644 --- a/Templates/BaseGame/game/core/gameObjects/Core_GameObjects.cs +++ b/Templates/BaseGame/game/core/gameObjects/Core_GameObjects.cs @@ -4,4 +4,29 @@ function Core_GameObjects::onCreate(%this) function Core_GameObjects::onDestroy(%this) { +} + +function Core_GameObjects::initServer( %this ) +{ +} + +function Core_GameObjects::onCreateGameServer(%this) +{ + %this.registerDatablock("./datablocks/defaultDatablocks.cs"); +} + +function Core_GameObjects::onDestroyGameServer(%this) +{ +} + +function Core_GameObjects::initClient( %this ) +{ +} + +function Core_GameObjects::onCreateClientConnection(%this) +{ +} + +function Core_GameObjects::onDestroyClientConnection(%this) +{ } \ No newline at end of file diff --git a/Templates/BaseGame/game/core/utility/scripts/module.cs b/Templates/BaseGame/game/core/utility/scripts/module.cs index fcbfb12df..2ff14c1e1 100644 --- a/Templates/BaseGame/game/core/utility/scripts/module.cs +++ b/Templates/BaseGame/game/core/utility/scripts/module.cs @@ -56,4 +56,39 @@ function loadModuleMaterials(%moduleGroup) exec( %file ); } } +} + +function SimSet::getModulePath(%scopeSet) +{ + %name = %scopeSet.getName(); + %moduleDef = ModuleDatabase.findModule(%name); + + if(isObject(%moduleDef)) + return %moduleDef.ModulePath; + + return ""; +} + +function SimSet::registerDatablock(%scopeSet, %datablockFilePath) +{ + %name = %scopeSet.getName(); + %moduleDef = ModuleDatabase.findModule(%name); + + if(!isObject(%moduleDef)) + { + error("Module::registerDatablock() - unable to find a module with the moduleID of " @ %name); + return; + } + + if(!isObject(DatablockFilesList)) + { + error("Module::registerDatablock() - DatablockFilesList array object doesn't exist!"); + return; + } + + %relativePath = makeRelativePath(%datablockFilePath); + + %fullPath = pathConcat(%moduleDef.ModulePath, %relativePath); + + DatablockFilesList.add(%fullPath); } \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/settings.xml b/Templates/BaseGame/game/tools/settings.xml index 4006c5fe1..84d4b1bc6 100644 --- a/Templates/BaseGame/game/tools/settings.xml +++ b/Templates/BaseGame/game/tools/settings.xml @@ -1,187 +1,187 @@ - - 255 255 255 255 - 10 - 5 - 0 255 0 255 - 0 0 1 - 255 0 0 255 - - - 1024 768 - tools/gui - - 0 - - - 0 - 0 - 0 - - - 1 - 0 - 8 - 1 - 1 - 1 - 1 - 2 - - - ../../../Documentation/Torque 3D - Script Manual.chm - http://www.garagegames.com/products/torque-3d/documentation/user - ../../../Documentation/Official Documentation.html - - - 1 - 1 - - - Categorized + + data/FPSGameplay/levels + + + 5 + + + 25 + - - AssetWork_Debug.exe - 6 - 0 - 1 - 50 - 40 - WorldEditorInspectorPlugin - screenCenter - - 1 - 1 - 1 - 1 - 1 - - - 255 255 0 255 - 100 100 100 255 - 0 0 255 255 - 0 255 0 255 - 255 255 0 255 - 255 0 0 255 - 255 255 255 255 - - - 215 215 215 255 - 50 50 50 255 - 48 48 48 255 - 255 255 255 255 - 180 180 180 255 - - - 100 - 1 - 2 - 0 - 0 - 0 - 1 - + + 15 + 0.8 + 0 + 0 + 0.8 + 1 + 100 - 0 - 102 102 102 100 - 255 255 255 100 - 51 51 51 100 - 1 - - - ../../../Documentation/Torque 3D - Script Manual.chm - http://www.garagegames.com/products/torque-3d/documentation/user - ../../../Documentation/Official Documentation.html - http://www.garagegames.com/products/torque-3d/forums - - - 1 - 8 - 20 - 255 - 0 - - - tools/worldEditor/images/SelectHandle - tools/worldEditor/images/DefaultHandle - tools/worldEditor/images/LockedHandle + 255 255 255 20 + 0 + 500 + 0 + 10 10 10 + 0 lowerHeight - ellipse - 40 40 - 40 40 1 + ellipse + 40 40 1 + 40 40 - 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 - 10 - 100 - 1 - 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 - 0 1 - 50 - 0.1 + 10 + 0 90 + 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 + 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 + 0.1 + 1 + 50 + 100 - - 15 - 0.8 - 0.8 - 1 - 0 - 100 - 0 - - 0 - 10 10 10 - 500 - 0 - 0 - 255 255 255 20 + + 6 + 1 + 40 + screenCenter + AssetWork_Debug.exe + 0 + 50 + WorldEditorInspectorPlugin + + ../../../Documentation/Torque 3D - Script Manual.chm + http://www.garagegames.com/products/torque-3d/forums + ../../../Documentation/Official Documentation.html + http://www.garagegames.com/products/torque-3d/documentation/user + + 255 0 0 255 + 100 100 100 255 + 255 255 0 255 + 255 255 0 255 + 255 255 255 255 + 0 255 0 255 + 0 0 255 255 + + + 1 + 1 + 1 + 1 + 1 + + + 255 255 255 100 + 1 + 102 102 102 100 + 51 51 51 100 + 0 + + + 100 + 1 + 0 + 0 + 2 + 0 + 1 + + + 50 50 50 255 + 180 180 180 255 + 215 215 215 255 + 255 255 255 255 + 48 48 48 255 + + + tools/worldEditor/images/DefaultHandle + tools/worldEditor/images/SelectHandle + tools/worldEditor/images/LockedHandle + + + 20 + 8 + 1 + 0 + 255 + + + + 1024 768 + tools/gui + + 0 + 1 + 1 + 1 + 1 + 8 + 2 + 1 + + + 1 + 1 + + + http://www.garagegames.com/products/torque-3d/documentation/user + ../../../Documentation/Torque 3D - Script Manual.chm + ../../../Documentation/Official Documentation.html + + + 0 + + + 0 + 0 + 0 + + + Categorized + + + + 0 0 1 + 10 + 0 255 0 255 + 255 0 0 255 + 255 255 255 255 + 5 - 100 98 96 255 43 43 43 255 - 32 31 30 255 255 255 255 255 - 96 94 92 255 240 240 240 255 - 72 70 68 255 - 50 49 48 255 - 50 49 48 255 - 234 232 230 255 - 236 234 232 255 - 50 49 48 255 - 59 58 57 255 - 37 36 35 255 - 178 175 172 255 - 59 58 57 255 - 17 16 15 255 72 70 68 255 + 59 58 57 255 + 234 232 230 255 + 37 36 35 255 + 50 49 48 255 + 50 49 48 255 + 100 98 96 255 + 32 31 30 255 + 96 94 92 255 + 17 16 15 255 + 178 175 172 255 + 72 70 68 255 + 236 234 232 255 + 50 49 48 255 + 59 58 57 255 Grid_512_Orange - - data/FPSGameplay/levels - - - 25 - - - 5 - - - AIPlayer