From 7dc03ae17a2c7fe9ec3c27933db7fdbac75d5746 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 4 Aug 2019 23:21:28 -0500 Subject: [PATCH] Implemented initial pass at proper client/server separation handling for module initialization Added GameModeName to Scene Added function to get number of active scenes Added logic to level/client loading to enact gameplay mode logic driven by either Scene's GameModeName or project setting's default game mode Added template module.cs file for module creation and adjusted new module logic in AssetBrowser to create off template Updated FPSGameplay code to have deathmatchGame mode work with new GameMode logic Updated EmptyLevel scene to define deathMatchGame as gamemode Updated FPSGameplay module script to properly client/server initialize --- Engine/source/T3D/Scene.cpp | 13 +- Engine/source/T3D/Scene.h | 4 +- Templates/BaseGame/game/core/Core.cs | 1 - .../clientServer/scripts/client/client.cs | 2 + .../scripts/client/connectionToServer.cs | 24 +-- .../scripts/server/connectionToClient.cs | 30 ++- .../scripts/server/levelDownload.cs | 34 ++- .../clientServer/scripts/server/levelLoad.cs | 94 +++++++- .../clientServer/scripts/server/server.cs | 56 +++-- .../scripts/fonts/ArialItalic 14 (ansi).uft | Bin 2110 -> 2338 bytes .../fonts/Lucida Console 12 (ansi).uft | Bin 5159 -> 5338 bytes Templates/BaseGame/game/core/settings.xml | 5 - .../game/core/utility/Core_Utility.cs | 1 + .../game/core/utility/scripts/module.cs | 20 ++ .../game/core/utility/scripts/scene.cs | 0 .../core/utility/scripts/signalManager.cs | 14 ++ .../tools/assetBrowser/assetImportConfigs.xml | 52 +++++ .../tools/assetBrowser/guis/assetImport.gui | 14 +- .../assetBrowser/scripts/addModuleWindow.cs | 25 +++ .../tools/assetBrowser/scripts/assetImport.cs | 29 ++- .../assetBrowser/scripts/assetImportConfig.cs | 200 +++++++++++++++++- .../tools/assetBrowser/scripts/fieldTypes.cs | 2 +- .../scripts/templateFiles/module.cs.template | 37 ++++ .../guiEditor/scripts/guiEditorTreeView.ed.cs | 14 +- Templates/BaseGame/game/tools/settings.xml | 184 ++++++++-------- Templates/Modules/FPSGameplay/FPSGameplay.cs | 105 ++++----- .../Modules/FPSGameplay/FPSGameplay.module | 4 +- .../FPSGameplay/levels/EmptyLevel.asset.taml | 6 +- .../Modules/FPSGameplay/levels/EmptyLevel.mis | 1 + .../levels/EmptyTerrain.asset.taml | 6 +- .../FPSGameplay/levels/Outpost.asset.taml | 6 +- .../scripts/server/deathMatchGame.cs | 85 ++++---- 32 files changed, 774 insertions(+), 294 deletions(-) create mode 100644 Templates/BaseGame/game/core/utility/scripts/module.cs create mode 100644 Templates/BaseGame/game/core/utility/scripts/scene.cs create mode 100644 Templates/BaseGame/game/core/utility/scripts/signalManager.cs create mode 100644 Templates/BaseGame/game/tools/assetBrowser/scripts/templateFiles/module.cs.template diff --git a/Engine/source/T3D/Scene.cpp b/Engine/source/T3D/Scene.cpp index aeed7399b..b08e59a8f 100644 --- a/Engine/source/T3D/Scene.cpp +++ b/Engine/source/T3D/Scene.cpp @@ -12,7 +12,7 @@ Scene::Scene() : mIsEditing(false), mIsDirty(false) { - + mGameModeName = StringTable->EmptyString(); } Scene::~Scene() @@ -29,6 +29,10 @@ void Scene::initPersistFields() addField("isEditing", TypeBool, Offset(mIsEditing, Scene), "", AbstractClassRep::FIELD_HideInInspectors); addField("isDirty", TypeBool, Offset(mIsDirty, Scene), "", AbstractClassRep::FIELD_HideInInspectors); endGroup("Internal"); + + addGroup("Gameplay"); + addField("gameModeName", TypeString, Offset(mGameModeName, Scene), "The name of the gamemode that this scene utilizes"); + endGroup("Gameplay"); } bool Scene::onAdd() @@ -186,6 +190,13 @@ DefineEngineFunction(getScene, Scene*, (U32 sceneId), (0), return Scene::smSceneList[sceneId]; } +DefineEngineFunction(getSceneCount, S32, (),, + "Get the number of active Scene objects that are loaded.\n" + "@return The number of active scenes") +{ + return Scene::smSceneList.size(); +} + DefineEngineFunction(getRootScene, S32, (), , "Get the root Scene object that is loaded.\n" "@return The id of the Root Scene. Will be 0 if no root scene is loaded") diff --git a/Engine/source/T3D/Scene.h b/Engine/source/T3D/Scene.h index 111044247..8d56ff7aa 100644 --- a/Engine/source/T3D/Scene.h +++ b/Engine/source/T3D/Scene.h @@ -35,6 +35,8 @@ class Scene : public NetObject, public virtual ITickable bool mIsDirty; + StringTableEntry mGameModeName; + protected: static Scene * smRootScene; @@ -76,4 +78,4 @@ public: } static Vector smSceneList; -}; \ No newline at end of file +}; diff --git a/Templates/BaseGame/game/core/Core.cs b/Templates/BaseGame/game/core/Core.cs index af6f97b8a..ae744e7a0 100644 --- a/Templates/BaseGame/game/core/Core.cs +++ b/Templates/BaseGame/game/core/Core.cs @@ -25,7 +25,6 @@ function CoreModule::onCreate(%this) ModuleDatabase.LoadExplicit( "Core_PostFX" ); ModuleDatabase.LoadExplicit( "Core_Components" ); ModuleDatabase.LoadExplicit( "Core_GameObjects" ); - ModuleDatabase.LoadExplicit( "Core_ClientServer" ); new Settings(ProjectSettings) { file = "core/settings.xml"; }; ProjectSettings.read(); diff --git a/Templates/BaseGame/game/core/clientServer/scripts/client/client.cs b/Templates/BaseGame/game/core/clientServer/scripts/client/client.cs index 590119935..6547e9915 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/client/client.cs +++ b/Templates/BaseGame/game/core/clientServer/scripts/client/client.cs @@ -20,6 +20,8 @@ function initClient() exec( %prefPath @ "/clientPrefs.cs" ); else exec( "data/defaults.cs" ); + + callOnModules("initClient"); loadMaterials(); diff --git a/Templates/BaseGame/game/core/clientServer/scripts/client/connectionToServer.cs b/Templates/BaseGame/game/core/clientServer/scripts/client/connectionToServer.cs index e5dff5e78..f0ce66672 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/client/connectionToServer.cs +++ b/Templates/BaseGame/game/core/clientServer/scripts/client/connectionToServer.cs @@ -32,18 +32,7 @@ function GameConnection::onConnectionAccepted(%this) // datablocks and objects are ghosted over. physicsInitWorld( "client" ); - //Get our modules so we can exec any specific client-side loading/handling - %modulesList = ModuleDatabase.findModules(true); - for(%i=0; %i < getWordCount(%modulesList); %i++) - { - %module = getWord(%modulesList, %i); - %moduleID = %module.ModuleId; - - if(%module.scopeSet.isMethod("onCreateClient")) - { - eval(%module.scopeSet @ ".onCreateClient();"); - } - } + callOnModules("onCreateClient", "Game"); } function GameConnection::initialControlSet(%this) @@ -141,14 +130,5 @@ function disconnectedCleanup() // We can now delete the client physics simulation. physicsDestroyWorld( "client" ); - //Get our modules so we can exec any specific client-side loading/handling - %modulesList = ModuleDatabase.findModules(true); - for(%i=0; %i < getWordCount(%modulesList); %i++) - { - %module = getWord(%modulesList, %i); - if(%module.scopeSet.isMethod("onDestroyClient")) - { - eval(%module.scopeSet @ ".onDestroyClient();"); - } - } + callOnModules("onDestroyClient", "Game"); } diff --git a/Templates/BaseGame/game/core/clientServer/scripts/server/connectionToClient.cs b/Templates/BaseGame/game/core/clientServer/scripts/server/connectionToClient.cs index 38709c971..1f6ef8598 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/server/connectionToClient.cs +++ b/Templates/BaseGame/game/core/clientServer/scripts/server/connectionToClient.cs @@ -150,7 +150,35 @@ function GameConnection::onDrop(%client, %reason) } if($missionRunning) - theLevelInfo.onClientLeaveGame(); + { + %hasGameMode = 0; + for(%i=0; %i < %activeSceneCount; %i++) + { + if(getScene(%i).gameModeName !$= "") + { + //if the scene defines a game mode, go ahead and envoke it here + if(isMethod(getScene(%i).gameModeName, "onClientLeaveGame")) + { + eval(getScene(%i).gameModeName @ "::onClientLeaveGame(" @ %client @ ");" ); + %hasGameMode = 1; + } + } + } + + //if none of our scenes have gamemodes, we need to kick off a default + if(%hasGameMode == 0) + { + %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName"); + if(%defaultModeName !$= "") + { + if(isMethod(%defaultModeName, "onClientLeaveGame")) + { + eval(%defaultModeName @ "::onClientLeaveGame(" @ %client @ ");" ); + %hasGameMode = 1; + } + } + } + } removeFromServerGuidList( %client.guid ); diff --git a/Templates/BaseGame/game/core/clientServer/scripts/server/levelDownload.cs b/Templates/BaseGame/game/core/clientServer/scripts/server/levelDownload.cs index e33f80711..fac9b4530 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/server/levelDownload.cs +++ b/Templates/BaseGame/game/core/clientServer/scripts/server/levelDownload.cs @@ -148,12 +148,38 @@ function serverCmdMissionStartPhase3Ack(%client, %seq) %entity.notify("onClientConnect", %client); } - //Have any special game-play handling here - if(theLevelInfo.isMethod("onClientEnterGame")) + %activeSceneCount = getSceneCount(); + + %hasGameMode = 0; + for(%i=0; %i < %activeSceneCount; %i++) { - theLevelInfo.onClientEnterGame(%client); + if(getScene(%i).gameModeName !$= "") + { + //if the scene defines a game mode, go ahead and envoke it here + if(isMethod(getScene(%i).gameModeName, "onClientEnterGame")) + { + eval(getScene(%i).gameModeName @ "::onClientEnterGame(" @ %client @ ");" ); + %hasGameMode = 1; + } + } } - else + + //if none of our scenes have gamemodes, we need to kick off a default + if(%hasGameMode == 0) + { + %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName"); + if(%defaultModeName !$= "") + { + if(isMethod(%defaultModeName, "onClientEnterGame")) + { + eval(%defaultModeName @ "::onClientEnterGame(" @ %client @ ");" ); + %hasGameMode = 1; + } + } + } + + //if that also failed, just spawn a camera + if(%hasGameMode == 0) { //No Game mode class for the level info, so just spawn a default camera // Set the control object to the default camera diff --git a/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.cs b/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.cs index 32da4e9dd..ab25001ea 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.cs +++ b/Templates/BaseGame/game/core/clientServer/scripts/server/levelLoad.cs @@ -135,8 +135,35 @@ function loadMissionStage2() ClientGroup.getObject(%clientIndex).loadMission(); // Go ahead and launch the game - if(TheLevelInfo.isMethod("onMissionStart")) - TheLevelInfo.onMissionStart(); + %activeSceneCount = getSceneCount(); + + %hasGameMode = 0; + for(%i=0; %i < %activeSceneCount; %i++) + { + if(getScene(%i).gameModeName !$= "") + { + //if the scene defines a game mode, go ahead and envoke it here + if(isMethod(getScene(%i).gameModeName, "onMissionStart")) + { + eval(getScene(%i).gameModeName @ "::onMissionStart();" ); + %hasGameMode = 1; + } + } + } + + //if none of our scenes have gamemodes, we need to kick off a default + if(%hasGameMode == 0) + { + %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName"); + if(%defaultModeName !$= "") + { + if(isMethod(%defaultModeName, "onMissionStart")) + { + eval(%defaultModeName @ "::onMissionStart();" ); + %hasGameMode = 1; + } + } + } } function endMission() @@ -147,7 +174,35 @@ function endMission() echo("*** ENDING MISSION"); // Inform the game code we're done. - TheLevelInfo.onMissionEnded(); + %activeSceneCount = getSceneCount(); + + %hasGameMode = 0; + for(%i=0; %i < %activeSceneCount; %i++) + { + if(getScene(%i).gameModeName !$= "") + { + //if the scene defines a game mode, go ahead and envoke it here + if(isMethod(getScene(%i).gameModeName, "onMissionEnded")) + { + eval(getScene(%i).gameModeName @ "::onMissionEnded();" ); + %hasGameMode = 1; + } + } + } + + //if none of our scenes have gamemodes, we need to kick off a default + if(%hasGameMode == 0) + { + %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName"); + if(%defaultModeName !$= "") + { + if(isMethod(%defaultModeName, "onMissionEnded")) + { + eval(%defaultModeName @ "::onMissionEnded();" ); + %hasGameMode = 1; + } + } + } // Inform the clients for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) { @@ -176,6 +231,35 @@ function resetMission() $instantGroup = MissionCleanup; clearServerPaths(); - // - TheLevelInfo.onMissionReset(); + + // Inform the game code we're resetting. + %activeSceneCount = getSceneCount(); + + %hasGameMode = 0; + for(%i=0; %i < %activeSceneCount; %i++) + { + if(getScene(%i).gameModeName !$= "") + { + //if the scene defines a game mode, go ahead and envoke it here + if(isMethod(getScene(%i).gameModeName, "onMissionReset")) + { + eval(getScene(%i).gameModeName @ "::onMissionReset(" @ %client @ ");" ); + %hasGameMode = 1; + } + } + } + + //if none of our scenes have gamemodes, we need to kick off a default + if(%hasGameMode == 0) + { + %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName"); + if(%defaultModeName !$= "") + { + if(isMethod(%defaultModeName, "onMissionReset")) + { + eval(%defaultModeName @ "::onMissionReset(" @ %client @ ");" ); + %hasGameMode = 1; + } + } + } } \ 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 6d82746bd..c53548127 100644 --- a/Templates/BaseGame/game/core/clientServer/scripts/server/server.cs +++ b/Templates/BaseGame/game/core/clientServer/scripts/server/server.cs @@ -52,6 +52,8 @@ function initServer() // Specify where the mission files are. $Server::MissionFileSpec = "data/levels/*.mis"; + + callOnModules("initServer"); } //----------------------------------------------------------------------------- @@ -156,17 +158,8 @@ function createServer(%serverType, %level) schedule(0,0,startHeartbeat); } - //Get our modules so we can exec any specific server-side loading/handling - %modulesList = ModuleDatabase.findModules(true); - for(%i=0; %i < getWordCount(%modulesList); %i++) - { - %module = getWord(%modulesList, %i); - if(%module.scopeSet.isMethod("onCreateServer")) - { - eval(%module.scopeSet @ ".onCreateServer();"); - } - } - + callOnModules("onCreateServer", "Game"); + // Let the game initialize some things now that the // the server has been created onServerCreated(); @@ -241,15 +234,7 @@ function destroyServer() deleteDataBlocks(); //Get our modules so we can exec any specific server-side loading/handling - %modulesList = ModuleDatabase.findModules(true); - for(%i=0; %i < getWordCount(%modulesList); %i++) - { - %module = getWord(%modulesList, %i); - if(%module.scopeSet.isMethod("onDestroyServer")) - { - eval(%module.scopeSet @ ".onDestroyServer();"); - } - } + callOnModules("onDestroyServer", "Game"); // Save any server settings %prefPath = getPrefpath(); @@ -273,8 +258,35 @@ function onServerDestroyed() echo("*** ENDING MISSION"); // Inform the game code we're done. - if(TheLevelInfo.isMethod("onMissionEnded")) - TheLevelInfo.onMissionEnded(); + %activeSceneCount = getSceneCount(); + + %hasGameMode = 0; + for(%i=0; %i < %activeSceneCount; %i++) + { + if(getScene(%i).gameModeName !$= "") + { + //if the scene defines a game mode, go ahead and envoke it here + if(isMethod(getScene(%i).gameModeName, "onMissionEnded")) + { + eval(getScene(%i).gameModeName @ "::onMissionEnded();" ); + %hasGameMode = 1; + } + } + } + + //if none of our scenes have gamemodes, we need to kick off a default + if(%hasGameMode == 0) + { + %defaultModeName = ProjectSettings.value("Gameplay/GameModes/defaultModeName"); + if(%defaultModeName !$= "") + { + if(isMethod(%defaultModeName, "onMissionEnded")) + { + eval(%defaultModeName @ "::onMissionEnded();" ); + %hasGameMode = 1; + } + } + } // Inform the clients for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) { diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/ArialItalic 14 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/ArialItalic 14 (ansi).uft index 0e9d41ff3c834771d3e9021027bfa4cb612f581d..df3a2de7c99a3cee7e5377de986cd58b9502ddd1 100644 GIT binary patch delta 1303 zcmdldut;cv2BXqO&30yP28M+U5WqIMpGlN)`D8{$SmVw-?s(vvqZtJkwQdb&7< zRLpsMMShBMq{#7)`Yc>btc?zbn;jM?UJ%I8;1FS9YIInTpdi3u!XgC(Y)rh3txXOI z3Ks-8L`+!Nn3!1`o0=RP7c5YCey8=zo13=E+_t+v{r1>feBXBcz4_I842`~tpTFA7 zoD!UMT8qEX^6#QK4316{#A|2lt+$yqb7t-051c|VhT7^ro0A+apP5%Eslu3Rti60k z&-L9lOkxG|rwiXoOXIxz$L2_?g|zcy7xUHgUha!u6}x-lnRBHT8jCAhj5ohpnVn|# z#BTMz4aS?}w881{twOuL}Tuxa1?p8)~fS$ij)6l(apV7Bm4m!r}=*Ou6pE6QJe zwb{g?zv1ER?^<1>xAgB&es|`h7>`2vLCL0; zzf=0o49+`T~x=se+1`{w&JCOm9)Z(=#cw)d(X!-sQn4iQHl?|NtSNMA?Ypq{0pPw)4S$4PCc3nU-MzCH3(ZH>&2&6hh=>KRV_GCwXb{o>zu zj=K3yTfeX!{aSRb`PuVr4b3x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LhRweh z4$oe^<7t?CQ&XY1p)lhSzj%sXRqBqGYhpjr4B3s1*=ycTwlv!Q=TLR}EFQ7%JYBBr zaY+o#7kP{}XI=gG=O4S~z0T``o-Rge?|*0V)Uz1t-w|FCVD@5f9uvd+7mO{gOy`#U ztJyxFm0ch3{<&xSto42$-j*0VmRwu5K7VbpcLIqMFcYP7fH z@nmjTQ@@qJQ1b5kd(Xe0zjo%0R`GM^h10|Rcg*Q+FIVC{kYKi=rlEk<;q{fK3^U7P zEtQ6fUI(n}dBq(zbP6#nYB@7;>w~?l4??GR-pb|(bea;Ne^}KxdfL}u-gSKX-hwlg&Hf?r+U`{8|0?n?!zG+NJASVCi=6uU@Y(<0RddhiukX75 zYgyPTA(SQBp-1kq}_O8B2_Wx{!zf;#dKdC-lQ3)5Q$0b2E z@%gXv4|*@`;GJ}T8v_t{y85}Sb4qAh2;wj>*5 z?|#4ce?}SCXT_veKASk7o-U6ywt^F7R`f@58C~O^AyY17_36*YWgDwD2d?j%+xzZ? mw9JAF_RVweT3!F*`u*4%Rz?X24y|wgRV91k?Jg*PI068}==8Aw diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Lucida Console 12 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Lucida Console 12 (ansi).uft index b3a06bb07490b0e5a607997f6ce1d1bc82782d69..49ab3d536f14a9cdba49d76f9dca5c2c5e214e82 100644 GIT binary patch delta 2462 zcmcgu`8yN}7oLr=jO8jq%}AD{;SwP`sZfnvOO{ciG{RskS;jJ!q&`c!D#m`PkgQWw zGsaRV2HhyeO!g(aF&M*)KKK6g{RQ9qJnwtnvpmoF;rw#SHAYTkodjO5M^=l00f2AW zzRWV0l;>zuIFoEf3YQ(UX|iLnN=SCs=5JH`L@dVb6)eaq&eru6+DGnig@0+E)zv*S75<4 z6C8foc%Z@^=Xum6Wu;X7o|D^~GVFaK)iwJmB^R9;tA_-;8879nb{+>pL~S7s6SVRT zzR~7eLacpe$F6Zcn$R9|v5y_Si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30^OUQLE8;pLJL0dS5?EyMWU9)4&wen_~Pxcu|W$Mg}1<2L= zwac#SEOzQhw4;h4rHf-)dFLM7!D~HBR?IH(S@&v1e}yo&BUL1A@kvr}lvC8core/ - - - a - - diff --git a/Templates/BaseGame/game/core/utility/Core_Utility.cs b/Templates/BaseGame/game/core/utility/Core_Utility.cs index e38d474d5..bfc09a85b 100644 --- a/Templates/BaseGame/game/core/utility/Core_Utility.cs +++ b/Templates/BaseGame/game/core/utility/Core_Utility.cs @@ -6,6 +6,7 @@ function Core_Utility::onCreate(%this) exec("./scripts/helperFunctions.cs"); exec("./scripts/gameObjectManagement.cs"); exec("./scripts/persistanceManagement.cs"); + exec("./scripts/module.cs"); } function Core_Utility::onDestroy(%this) diff --git a/Templates/BaseGame/game/core/utility/scripts/module.cs b/Templates/BaseGame/game/core/utility/scripts/module.cs new file mode 100644 index 000000000..91f869498 --- /dev/null +++ b/Templates/BaseGame/game/core/utility/scripts/module.cs @@ -0,0 +1,20 @@ +function callOnModules(%functionName, %moduleGroup) +{ + //Get our modules so we can exec any specific client-side loading/handling + %modulesList = ModuleDatabase.findModules(false); + for(%i=0; %i < getWordCount(%modulesList); %i++) + { + %module = getWord(%modulesList, %i); + + if(%moduleGroup !$= "") + { + if(%module.group !$= %moduleGroup) + continue; + } + + if(isObject(%module.scopeSet) && %module.scopeSet.isMethod(%functionName)) + { + eval(%module.scopeSet @ "." @ %functionName @ "();"); + } + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/utility/scripts/scene.cs b/Templates/BaseGame/game/core/utility/scripts/scene.cs new file mode 100644 index 000000000..e69de29bb diff --git a/Templates/BaseGame/game/core/utility/scripts/signalManager.cs b/Templates/BaseGame/game/core/utility/scripts/signalManager.cs new file mode 100644 index 000000000..810888905 --- /dev/null +++ b/Templates/BaseGame/game/core/utility/scripts/signalManager.cs @@ -0,0 +1,14 @@ +function SimObject::notify(%this, %signalName) +{ + +} + +function SimObject::removeNotify(%this, %signalName) +{ + +} + +function SimObject::removeNotify(%this, %signalName) +{ + +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml b/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml index 4bc243e71..80ad5ae94 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml +++ b/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml @@ -1,3 +1,55 @@ + + + LOS + 1 + CollisionMesh + 1 + Col + CollisionMesh + + + 0 + 1 + TrailingNumber + 0 + Z_AXIS + 0 + 0 + 0 + + + 1.0 + 0 + 1.0 + + + _AO,_AMBIENT,_AMBIENTOCCLUSION + _NORMAL,_NORM + 1 + _SMOOTH,_SMOOTHNESS + 1 + 1.0 + _ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL + Bilinear + 1 + _ROUGH,_ROUGHNESS + _COMP,_COMPOSITE + N/A + 0 + _METAL,_MET,_METALNESS,_METALLIC + 1 + + + 1 + 1 + 1 + 1 + + + 1 + 1 + + diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui index f3d432a3a..9f355396d 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui @@ -1,7 +1,7 @@ //--- OBJECT WRITE BEGIN --- %guiContent = new GuiControl(AssetImportCtrl) { position = "0 0"; - extent = "1440 900"; + extent = "1024 768"; minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; @@ -296,7 +296,7 @@ anchorBottom = "0"; anchorLeft = "1"; anchorRight = "0"; - position = "140 98"; + position = "145 133"; extent = "733 502"; minExtent = "48 92"; horizSizing = "center"; @@ -625,9 +625,9 @@ anchorBottom = "0"; anchorLeft = "1"; anchorRight = "0"; - position = "524 332"; - extent = "376 50"; - minExtent = "48 92"; + position = "348 332"; + extent = "376 70"; + minExtent = "48 70"; horizSizing = "center"; vertSizing = "center"; profile = "ToolsGuiWindowProfile"; @@ -695,7 +695,7 @@ groupNum = "-1"; buttonType = "PushButton"; useMouseEvents = "0"; - position = "301 27"; + position = "301 45"; extent = "64 22"; minExtent = "8 2"; horizSizing = "left"; @@ -703,7 +703,7 @@ profile = "ToolsGuiButtonProfile"; visible = "1"; active = "1"; - command = "ImportAssetConfigEditorWindow.saveAssetOptionsConfig();"; + command = "ImportAssetConfigEditorWindow.createNewImportConfig();"; tooltipProfile = "ToolsGuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs index 036b3bee6..a5c04da64 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs @@ -75,6 +75,31 @@ function AssetBrowser_addModuleWindow::CreateNewModule(%this) //Now generate the script file for it %file = new FileObject(); + %templateFile = new FileObject(); + + %moduleTemplateCodeFilePath = AssetBrowser.templateFilesPath @ "module.cs.template"; + + if(%file.openForWrite(%moduleScriptFilePath) && %templateFile.openForRead(%moduleTemplateCodeFilePath)) + { + while( !%templateFile.isEOF() ) + { + %line = %templateFile.readline(); + %line = strreplace( %line, "@@", %newModuleName ); + + %file.writeline(%line); + echo(%line); + } + + %file.close(); + %templateFile.close(); + } + else + { + %file.close(); + %templateFile.close(); + + warnf("CreateNewModule - Something went wrong and we couldn't write the script file!"); + } if(%file.openForWrite(%moduleScriptFilePath)) { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs index d7d5a0282..788f38bf4 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs @@ -513,7 +513,7 @@ function ImportAssetWindow::reloadImportOptionConfigs(%this) if(%xmlDoc.loadFile($AssetBrowser::importConfigsFile)) { //StateMachine element - if(!%xmlDoc.pushFirstChildElement("AssetImportConfigs")) + if(!%xmlDoc.pushFirstChildElement("AssetImportSettings")) { error("Invalid Import Configs file"); return; @@ -521,26 +521,21 @@ function ImportAssetWindow::reloadImportOptionConfigs(%this) //Config Groups %configCount = 0; - while(%xmlDoc.pushChildElement(%configCount)) + %hasGroup = %xmlDoc.pushFirstChildElement("Group"); + while(%hasGroup) { - %configName = %xmlDoc.attribute("Name"); - - %xmlDoc.popElement(); - %configCount++; + %configName = %xmlDoc.attribute("name"); ImportAssetWindow.importConfigsList.add(%configName); + ImportAssetConfigList.add(%configName); + + %hasGroup = %xmlDoc.nextSiblingElement("Group"); } - + %xmlDoc.popElement(); } - ImportAssetWindow.importConfigsList.add(%configName); - - for(%i = 0; %i < ImportAssetWindow.importConfigsList.count(); %i++) - { - %configName = ImportAssetWindow.importConfigsList.getKey(%i); - ImportAssetConfigList.add(%configName); - } + %xmlDoc.delete(); %importConfigIdx = ImportAssetWindow.activeImportConfigIndex; if(%importConfigIdx $= "") @@ -620,14 +615,14 @@ function ImportAssetWindow::processNewImportAssets(%this, %id) if(isObject(%assetItem) && %assetItem.processed == false) { - %assetConfigObj = ImportAssetWindow.activeImportConfig.clone(); - %assetConfigObj.assetIndex = %i; + //%assetConfigObj = ImportAssetWindow.activeImportConfig.clone(); + //%assetConfigObj.assetIndex = %i; //sanetize before modifying our asset name(suffix additions, etc) if(%assetItem.assetName !$= %assetItem.cleanAssetName) %assetItem.assetName = %assetItem.cleanAssetName; - %assetConfigObj.assetName = %assetItem.assetName; + //%assetConfigObj.assetName = %assetItem.assetName; if(%assetItem.assetType $= "Model") { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs index e84725b6e..69f45259f 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs @@ -12,6 +12,79 @@ function ImportAssetConfigList::onSelect( %this, %id, %text ) AssetBrowser.reloadImportingFiles(); } +function setupImportConfigSettingsList() +{ + if(!isObject(ImportAssetConfigSettingsList)) + { + new ArrayObject(ImportAssetConfigSettingsList); + + ImportAssetConfigSettingsList.addNewConfigSetting("Mesh/ImportMesh", "Import Mesh", "bool", "", "1", "", "ToggleImportMesh"); + ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/DoUpAxisOverride", "Do Up-axis Override", "bool", "", "0", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/UpAxisOverride", "Up-axis Override", "list", "", "Z_AXIS", "X_AXIS,Y_AXIS,Z_AXIS"); + ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/ScaleOverride", "Do Scale Override", "bool", "", "0", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/ScaleOverride", "Scale Override", "float", "", "1", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/IgnoreNodeScale", "Ignore Node Scale", "bool", "", "0", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/AdjustCenter", "Adjust Center", "bool", "", "0", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/AdjustFloor", "Adjust Floor", "bool", "", "0", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/LODType", "LOD Type", "list", "", "TrailingNumber", "TrailingNumber,DetectDTS"); + //ImportAssetConfigSettingsList.addNewConfigSetting("TrailingNumber", "Trailing Number", "float", "", "2", "", "Mesh"); + ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/ImportedNodes", "Imported Nodes", "command", "", "", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/IgnoreNodes", "Ignore Nodes", "command", "", "", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/ImportMeshes", "Import Meshes", "command", "", "", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/IgnoreMeshes", "Imported Meshes", "command", "", "", ""); + + //Materials + ImportAssetConfigSettingsList.addNewConfigSetting("Materials/ImportMaterials", "Import Materials", "bool", "", "1", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Materials/CreateComposites", "Create Composites", "bool", "", "1", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Materials/UseDiffuseSuffixOnOriginImage", "Use Diffuse Suffix for Origin Image", "bool", "", "1", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Materials/UseExistingMaterials", "Use Existing Materials", "bool", "", "1", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Materials/IgnoreMaterials", "Ignore Materials", "command", "", "", ""); + + //Animations + ImportAssetConfigSettingsList.addNewConfigSetting("Animations/ImportAnimations", "Import Animations", "bool", "", "1", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Animations/SeparateAnimations", "Separate Animations", "bool", "", "1", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Animations/SeparateAnimationPrefix", "Separate Animation Prefix", "string", "", "", ""); + + //Collision + ImportAssetConfigSettingsList.addNewConfigSetting("Collision/GenerateCollisions", "Generate Collisions", "bool", "", "1", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Collision/GenCollisionType", "Generate Collision Type", "list", "", "CollisionMesh", "CollisionMesh,ConvexHull"); + ImportAssetConfigSettingsList.addNewConfigSetting("Collision/CollisionMeshPrefix", "CollisionMesh Prefix", "string", "", "Col", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Collision/GenerateLOSCollisions", "Generate LOS Collisions", "bool", "", "1", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Collision/GenLOSCollisionType", "Generate LOS Collision Type", "list", "", "CollisionMesh", "CollisionMesh,ConvexHull"); + ImportAssetConfigSettingsList.addNewConfigSetting("Collision/LOSCollisionMeshPrefix", "LOS CollisionMesh Prefix", "string", "", "LOS", ""); + + //Images + ImportAssetConfigSettingsList.addNewConfigSetting("Images/ImageType", "Image Type", "list", "", "N/A", "N/A,Diffuse,Normal,Specular,Metalness,Roughness,AO,Composite,GUI"); + ImportAssetConfigSettingsList.addNewConfigSetting("Images/DiffuseTypeSuffixes", "Diffuse Type Suffixes", "command", "", "_ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Images/NormalTypeSuffixes", "Normal Type Suffixes", "command", "", "_NORMAL,_NORM", ""); + + ImportAssetConfigSettingsList.addNewConfigSetting("Images/MetalnessTypeSuffixes", "Metalness Type Suffixes", "command", "", "_METAL,_MET,_METALNESS,_METALLIC", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Images/RoughnessTypeSuffixes", "Roughness Type Suffixes", "command", "", "_ROUGH,_ROUGHNESS", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Images/SmoothnessTypeSuffixes", "Smoothness Type Suffixes", "command", "", "_SMOOTH,_SMOOTHNESS", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Images/AOTypeSuffixes", "AO Type Suffixes", "command", "", "_AO,_AMBIENT,_AMBIENTOCCLUSION", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Images/CompositeTypeSuffixes", "Composite Type Suffixes", "command", "", "_COMP,_COMPOSITE", ""); + + ImportAssetConfigSettingsList.addNewConfigSetting("Images/TextureFilteringMode", "Texture Filtering Mode", "list", "", "Bilinear", "None,Bilinear,Trilinear"); + ImportAssetConfigSettingsList.addNewConfigSetting("Images/UseMips", "Use Mipmaps", "bool", "", "1", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Images/IsHDR", "Is HDR", "bool", "", "0", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Images/Scaling", "Scaling", "float", "", "1.0", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Images/Compressed", "Is Compressed", "bool", "", "1", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Images/GenerateMaterialOnImport", "Generate Material On Import", "bool", "", "1", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Images/PopulateMaterialMaps", "Populate Material Maps", "bool", "", "1", ""); + + //Sounds + ImportAssetConfigSettingsList.addNewConfigSetting("Sounds/VolumeAdjust", "Volume Adjustment", "float", "", "1.0", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Sounds/PitchAdjust", "Pitch Adjustment", "float", "", "1.0", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Sounds/Compressed", "Is Compressed", "bool", "", "0", ""); + } +} + +function ImportAssetConfigSettingsList::addNewConfigSetting(%this, %settingName, %settingFieldLabel, %type, %tooltip, %defaultValue, %fieldData) +{ + %this.add(%settingName TAB %settingFieldLabel TAB %type TAB %tooltip, %defaultValue TAB %fieldData); +} + function ImportAssetOptionsWindow::findMissingFile(%this, %assetItem) { if(%assetItem.assetType $= "Model") @@ -99,6 +172,7 @@ function ImportAssetOptionsWindow::editImportSettings(%this, %assetItem) if(%meshCount > 0) { ImportOptionsList.startGroup("Mesh"); + ImportOptionsList.addField("AutogenCollisions", "Auto-gen Collisions", "bool", "", "0", "", %assetConfigObj); ImportOptionsList.addField("CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", "", %assetConfigObj); ImportOptionsList.addField("UpAxisOverride", "Up-Axis Override", "list", "", "Z_AXIS", "Z_AXIS,Y_AXIS,X_AXIS", %assetConfigObj); @@ -194,15 +268,21 @@ function getAssetImportConfigValue(%fieldName, %defaultValue) return AssetImportSettings.value(ImportAssetWindow.activeImportConfig @ "/" @ %fieldName, %defaultValue); } -function ImportAssetConfigEditorWindow::populateConfigList(%this, %optionsObj) +function ImportAssetConfigEditorWindow::populateConfigList(%this, %configName) { - AssetImportConfigName.setText(%optionsObj.Name); + //Ensure our config list is set up + setupImportConfigSettingsList(); + + AssetImportConfigName.setText(%configName); ImportOptionsConfigList.clearFields(); - ImportOptionsConfigList.startGroup("Mesh"); - ImportOptionsConfigList.addSettingsField("Mesh/ImportMesh", "Import Mesh", "bool", "Should meshes be imported", ""); - ImportOptionsConfigList.endGroup(); + %this.populateConfigListByGroup("Meshes"); + %this.populateConfigListByGroup("Materials"); + %this.populateConfigListByGroup("Animations"); + %this.populateConfigListByGroup("Images"); + %this.populateConfigListByGroup("Collision"); + %this.populateConfigListByGroup("Sound"); /*ImportOptionsConfigList.addCallbackField("ImportMesh", "Import Mesh", "bool", "", "1", "", "ToggleImportMesh", %optionsObj); ImportOptionsConfigList.addField("DoUpAxisOverride", "Do Up-axis Override", "bool", "", "0", "", %optionsObj); @@ -283,8 +363,31 @@ function ImportAssetConfigEditorWindow::populateConfigList(%this, %optionsObj) ImportOptionsConfigList.endGroup();*/ } +function ImportAssetConfigEditorWindow::populateConfigListByGroup(%this, %groupName) +{ + ImportOptionsConfigList.startGroup(%groupName); + for(%i=0; %i < ImportAssetConfigSettingsList.count(); %i++) + { + %settingName = getField(ImportAssetConfigSettingsList.getKey(%i),0); + if(startsWith(%settingName, %groupName@"/")) + { + %labelName = getField(ImportAssetConfigSettingsList.getKey(%i), 1); + %type = getField(ImportAssetConfigSettingsList.getKey(%i), 2); + %tooltip = getField(ImportAssetConfigSettingsList.getKey(%i), 3); + + %defaultValue = getField(ImportAssetConfigSettingsList.getValue(%i), 0); + %dataValues = getField(ImportAssetConfigSettingsList.getValue(%i), 1); + ImportOptionsConfigList.addSettingsField(%settingName, %labelName, %type, %tooltip, %defaultValue, %dataValues); + } + } + ImportOptionsConfigList.endGroup(); +} + function ImportAssetConfigEditorWindow::addNewConfig(%this) { + //Ensure our list is set up + setupImportConfigSettingsList(); + ImportAssetNewConfigEditorWindow.setVisible(1); ImportAssetNewConfigEditorWindow.selectWindow(); @@ -358,6 +461,7 @@ function ImportAssetConfigEditorWindow::addNewConfig(%this) function ImportAssetConfigEditorWindow::editConfig(%this) { + //Ensure our list is set up ImportAssetConfigEditorWindow.setVisible(1); ImportAssetConfigEditorWindow.selectWindow(); @@ -366,6 +470,10 @@ function ImportAssetConfigEditorWindow::editConfig(%this) function ImportAssetConfigEditorWindow::deleteConfig(%this) { + for(%i=0; %i < %configList.count(); %i++) + { + + } ImportAssetWindow.importConfigsList.erase(ImportAssetWindow.activeImportConfigIndex); ImportAssetConfigList.setSelected(0); //update it @@ -380,11 +488,89 @@ function ImportAssetConfigEditorWindow::saveAssetOptionsConfig(%this) ImportAssetWindow.reloadImportOptionConfigs(); } -function ImportOptionsConfigList::addSettingsField(%this, %settingsFieldName, %labelText, %fieldType, %tooltip, %fieldData) +function ImportAssetConfigEditorWindow::createNewImportConfig(%this) +{ + %configName = AssetImportNewConfigName.getText(); + %configList = ImportAssetConfigSettingsList; + + AssetImportSettings.beginGroup(%configName); + + for(%i=0; %i < %configList.count(); %i++) + { + %settingName = getField(%configList.getKey(%i),0); + if(startsWith(%settingName, "Meshes/")) + { + %defaultValue = getField(%configList.getValue(%i), 0); + AssetImportSettings.setValue(%settingName, %defaultValue); + } + } + + for(%i=0; %i < %configList.count(); %i++) + { + %settingName = getField(%configList.getKey(%i),0); + if(startsWith(%settingName, "Materials/")) + { + %defaultValue = getField(%configList.getValue(%i), 0); + AssetImportSettings.setValue(%settingName, %defaultValue); + } + } + + for(%i=0; %i < %configList.count(); %i++) + { + %settingName = getField(%configList.getKey(%i),0); + if(startsWith(%settingName, "Animations/")) + { + %defaultValue = getField(%configList.getValue(%i), 0); + AssetImportSettings.setValue(%settingName, %defaultValue); + } + } + + for(%i=0; %i < %configList.count(); %i++) + { + %settingName = getField(%configList.getKey(%i),0); + if(startsWith(%settingName, "Collision/")) + { + %defaultValue = getField(%configList.getValue(%i), 0); + AssetImportSettings.setValue(%settingName, %defaultValue); + } + } + + for(%i=0; %i < %configList.count(); %i++) + { + %settingName = getField(%configList.getKey(%i),0); + if(startsWith(%settingName, "Images/")) + { + %defaultValue = getField(%configList.getValue(%i), 0); + AssetImportSettings.setValue(%settingName, %defaultValue); + } + } + + for(%i=0; %i < %configList.count(); %i++) + { + %settingName = getField(%configList.getKey(%i),0); + if(startsWith(%settingName, "Sounds/")) + { + %defaultValue = getField(%configList.getValue(%i), 0); + AssetImportSettings.setValue(%settingName, %defaultValue); + } + } + + AssetImportSettings.endGroup(); + + %success = AssetImportSettings.write(); + + ImportAssetNewConfigEditorWindow.setVisible(0); +} + +function ImportOptionsConfigList::addSettingsField(%this, %settingsFieldName, %labelText, %fieldType, %tooltip, %fieldValue, %fieldData) { %moddedSettingsFieldName = strreplace(%settingsFieldName, "/", "-"); - %this.addCallbackField(%moddedSettingsFieldName, %labelText, %fieldType, "", AssetImportSettings.value(%settingsFieldName), %fieldData, "changeEditorSetting"); + %value = AssetImportSettings.value(%settingsFieldName); + if(%value $= "") + %value = %fieldValue; + + %this.addCallbackField(%moddedSettingsFieldName, %labelText, %fieldType, "", %value, %fieldData, "changeEditorSetting"); } function ImportOptionsConfigList::changeEditorSetting(%this, %varName, %value) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs index fe524ce65..6dd6a2368 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs @@ -90,7 +90,7 @@ function GuiInspectorVariableGroup::buildListField(%this, %fieldName, %fieldLabe if(%fieldName $= "") %editControl.setText(%fieldName); } - else + else if(isObject(%ownerObj)) { //regular variable %setCommand = %editControl @ ".setText(" @ %ownerObj @ "." @ %fieldName @ ");"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/templateFiles/module.cs.template b/Templates/BaseGame/game/tools/assetBrowser/scripts/templateFiles/module.cs.template new file mode 100644 index 000000000..1b6dda406 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/templateFiles/module.cs.template @@ -0,0 +1,37 @@ +function @@::onCreate(%this) +{ +} + +function @@::onDestroy(%this) +{ +} + +//This is called when the server is initially set up by the game application +function @@::initServer(%this) +{ +} + +//This is called when the server is created for an actual game/map to be played +function @@::onCreateServer(%this) +{ +} + +//This is called when the server is shut down due to the game/map being exited +function @@::onDestroyServer(%this) +{ +} + +//This is called when the client is initially set up by the game application +function @@::initClient(%this) +{ +} + +//This is called when a client connects to a server +function @@::onCreateClient(%this) +{ +} + +//This is called when a client disconnects from a server +function @@::onDestroyClient(%this) +{ +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs index 5db0e049d..881f2a752 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs @@ -107,15 +107,15 @@ function GuiEditorTreeView::onRightMouseDown( %this, %item, %pts, %obj ) object = %obj; }; - %popup.item[ 0 ] = "Rename" TAB "" TAB "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId(" @ %popup.object @ ") );"; - %popup.item[ 1 ] = "Delete" TAB "" TAB "GuiEditor.deleteControl(" @ %popup.object @ ");"; + %popup.item[ 0 ] = "Rename" TAB "" TAB "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId(" @ %obj @ ") );"; + %popup.item[ 1 ] = "Delete" TAB "" TAB "GuiEditor.deleteControl(" @ %obj @ ");"; %popup.item[ 2 ] = "-"; - %popup.item[ 3 ] = "Locked" TAB "" TAB "%this.object.setLocked( !" @ %popup.object @ ".locked); GuiEditorTreeView.update();"; - %popup.item[ 4 ] = "Hidden" TAB "" TAB "%this.object.setVisible( !" @ %popup.object @ ".isVisible() ); GuiEditorTreeView.update();"; + %popup.item[ 3 ] = "Locked" TAB "" TAB %obj @ ".setLocked( !" @ %obj @ ".locked); GuiEditorTreeView.update();"; + %popup.item[ 4 ] = "Hidden" TAB "" TAB %obj @ ".setVisible( !" @ %obj @ ".isVisible() ); GuiEditorTreeView.update();"; %popup.item[ 5 ] = "-"; - %popup.item[ 6 ] = "Add New Controls Here" TAB "" TAB "GuiEditor.setCurrentAddSet( " @ %popup.object @ ");"; - %popup.item[ 7 ] = "Add Child Controls to Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %popup.object @ ", false );"; - %popup.item[ 8 ] = "Remove Child Controls from Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %popup.object @ ", true );"; + %popup.item[ 6 ] = "Add New Controls Here" TAB "" TAB "GuiEditor.setCurrentAddSet( " @ %obj @ ");"; + %popup.item[ 7 ] = "Add Child Controls to Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %obj @ ", false );"; + %popup.item[ 8 ] = "Remove Child Controls from Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %obj @ ", true );"; %popup.checkItem( 3, %obj.locked ); %popup.checkItem( 4, !%obj.isVisible() ); diff --git a/Templates/BaseGame/game/tools/settings.xml b/Templates/BaseGame/game/tools/settings.xml index 6b444f490..c5c0f3d28 100644 --- a/Templates/BaseGame/game/tools/settings.xml +++ b/Templates/BaseGame/game/tools/settings.xml @@ -1,142 +1,145 @@ - 50 - WorldEditorInspectorPlugin - AssetWork_Debug.exe 6 + 50 + AssetWork_Debug.exe screenCenter - 40 0 + WorldEditorInspectorPlugin 1 - - ../../../Documentation/Official Documentation.html - http://www.garagegames.com/products/torque-3d/documentation/user - http://www.garagegames.com/products/torque-3d/forums - ../../../Documentation/Torque 3D - Script Manual.chm - - - 180 180 180 255 - 255 255 255 255 - 48 48 48 255 - 215 215 215 255 - 50 50 50 255 - - - 0 - 255 - 20 - 8 - 1 - - - 0 0 255 255 - 255 255 255 255 - 100 100 100 255 - 255 0 0 255 - 255 255 0 255 - 0 255 0 255 - 255 255 0 255 - - - 2 - 0 - 1 - 0 - 100 - 1 - 0 - + 40 - 1 1 - 1 - 1 + 1 1 + 1 + 1 + 1 255 255 255 100 0 51 51 51 100 102 102 102 100 - 1 + + + 255 255 0 255 + 0 255 0 255 + 0 0 255 255 + 255 255 0 255 + 255 255 255 255 + 100 100 100 255 + 255 0 0 255 + + + 1 + 0 + 100 + 1 + 0 + 2 + 0 + + + 1 + 0 + 255 + 20 + 8 + + + 215 215 215 255 + 180 180 180 255 + 255 255 255 255 + 50 50 50 255 + 48 48 48 255 tools/worldEditor/images/LockedHandle tools/worldEditor/images/DefaultHandle tools/worldEditor/images/SelectHandle + + ../../../Documentation/Official Documentation.html + http://www.garagegames.com/products/torque-3d/documentation/user + http://www.garagegames.com/products/torque-3d/forums + ../../../Documentation/Torque 3D - Script Manual.chm + + + + 100 + 0 + 15 + 0.8 + 0.8 + 1 + 0 + + 500 + 0 + 0 + 0 + 255 255 255 20 + 10 10 10 + - 178 175 172 255 - 240 240 240 255 + 96 94 92 255 32 31 30 255 255 255 255 255 - 59 58 57 255 - 50 49 48 255 - 50 49 48 255 - 43 43 43 255 + 178 175 172 255 17 16 15 255 - 72 70 68 255 - 72 70 68 255 - 50 49 48 255 - 234 232 230 255 - 100 98 96 255 236 234 232 255 - 96 94 92 255 - 37 36 35 255 + 59 58 57 255 + 100 98 96 255 + 72 70 68 255 + 72 70 68 255 + 240 240 240 255 59 58 57 255 + 234 232 230 255 + 50 49 48 255 + 37 36 35 255 + 50 49 48 255 + 50 49 48 255 + 43 43 43 255 - tools/gui 1024 768 + tools/gui + 0 0 0 - 0 - 0 1 8 1 + 0 1 1 2 1 - - http://www.garagegames.com/products/torque-3d/documentation/user - ../../../Documentation/Torque 3D - Script Manual.chm - ../../../Documentation/Official Documentation.html - - - 0 - 1 1 + + ../../../Documentation/Torque 3D - Script Manual.chm + ../../../Documentation/Official Documentation.html + http://www.garagegames.com/products/torque-3d/documentation/user + + + 0 + Categorized - - 0 - 0.8 - 1 - 100 - 15 - 0.8 - 0 - - 10 10 10 - 0 - 255 255 255 20 - 500 - 0 - 0 - + + Grid_512_Orange AIPlayer @@ -144,15 +147,12 @@ data/FPSGameplay/levels - - 5 - 25 + + 5 + - - Grid_512_Orange - diff --git a/Templates/Modules/FPSGameplay/FPSGameplay.cs b/Templates/Modules/FPSGameplay/FPSGameplay.cs index 8eaebce46..51e40f887 100644 --- a/Templates/Modules/FPSGameplay/FPSGameplay.cs +++ b/Templates/Modules/FPSGameplay/FPSGameplay.cs @@ -12,7 +12,17 @@ // When a local game is started - a listen server - via calling StartGame() a server is created and then the client is // connected to it via createAndConnectToLocalServer(). -function FPSGameplay::create( %this ) +function FPSGameplay::onCreate( %this ) +{ + echo("Made it"); + +} + +function FPSGameplay::onDestroy( %this ) +{ +} + +function FPSGameplay::initServer(%this) { //server scripts exec("./scripts/server/aiPlayer.cs"); @@ -39,8 +49,10 @@ function FPSGameplay::create( %this ) exec("./scripts/server/VolumetricFog.cs"); exec("./scripts/server/weapon.cs"); exec("./scripts/server/physicsShape.cs"); - - //add DBs +} + +function FPSGameplay::onCreateServer(%this) +{ if(isObject(DatablockFilesList)) { for( %file = findFirstFile( "data/FPSGameplay/scripts/datablocks/*.cs.dso" ); @@ -61,53 +73,50 @@ function FPSGameplay::create( %this ) DatablockFilesList.add(%file); } } - - if(isObject(LevelFilesList)) - { - for( %file = findFirstFile( "data/FPSGameplay/levels/*.mis" ); - %file !$= ""; - %file = findNextFile( "data/FPSGameplay/levels/*.mis" )) - { - LevelFilesList.add(%file); - } - } - - if (!$Server::Dedicated) - { - exec("data/FPSGameplay/scripts/client/gameProfiles.cs"); - - //client scripts - $KeybindPath = "data/FPSGameplay/scripts/client/default.keybinds.cs"; - exec($KeybindPath); - - %prefPath = getPrefpath(); - if(isFile(%prefPath @ "/keybinds.cs")) - exec(%prefPath @ "/keybinds.cs"); - - exec("data/FPSGameplay/scripts/client/inputCommands.cs"); - - //guis - exec("./scripts/gui/chatHud.gui"); - exec("./scripts/gui/playerList.gui"); - exec("./scripts/gui/playGui.gui"); - exec("./scripts/gui/hudlessGui.gui"); - - exec("data/FPSGameplay/scripts/client/playGui.cs"); - exec("data/FPSGameplay/scripts/client/hudlessGui.cs"); - - exec("data/FPSGameplay/scripts/client/message.cs"); - exec("data/FPSGameplay/scripts/client/chatHud.cs"); - exec("data/FPSGameplay/scripts/client/clientCommands.cs"); - exec("data/FPSGameplay/scripts/client/messageHud.cs"); - exec("data/FPSGameplay/scripts/client/playerList.cs"); - exec("data/FPSGameplay/scripts/client/centerPrint.cs"); - exec("data/FPSGameplay/scripts/client/recordings.cs"); - - exec("data/FPSGameplay/scripts/client/screenshot.cs"); - } } -function FPSGameplay::destroy( %this ) +function FPSGameplay::onDestroyServer(%this) { +} + +function FPSGameplay::initClient(%this) +{ + exec("data/FPSGameplay/scripts/client/gameProfiles.cs"); + + //client scripts + $KeybindPath = "data/FPSGameplay/scripts/client/default.keybinds.cs"; + exec($KeybindPath); + %prefPath = getPrefpath(); + if(isFile(%prefPath @ "/keybinds.cs")) + exec(%prefPath @ "/keybinds.cs"); + + exec("data/FPSGameplay/scripts/client/inputCommands.cs"); + + //guis + exec("./scripts/gui/chatHud.gui"); + exec("./scripts/gui/playerList.gui"); + exec("./scripts/gui/playGui.gui"); + exec("./scripts/gui/hudlessGui.gui"); + + exec("data/FPSGameplay/scripts/client/playGui.cs"); + exec("data/FPSGameplay/scripts/client/hudlessGui.cs"); + + exec("data/FPSGameplay/scripts/client/message.cs"); + exec("data/FPSGameplay/scripts/client/chatHud.cs"); + exec("data/FPSGameplay/scripts/client/clientCommands.cs"); + exec("data/FPSGameplay/scripts/client/messageHud.cs"); + exec("data/FPSGameplay/scripts/client/playerList.cs"); + exec("data/FPSGameplay/scripts/client/centerPrint.cs"); + exec("data/FPSGameplay/scripts/client/recordings.cs"); + + exec("data/FPSGameplay/scripts/client/screenshot.cs"); +} + +function FPSGameplay::onCreateClient(%this) +{ +} + +function FPSGameplay::onDestroyClient(%this) +{ } \ No newline at end of file diff --git a/Templates/Modules/FPSGameplay/FPSGameplay.module b/Templates/Modules/FPSGameplay/FPSGameplay.module index a650d8587..5fdc35a81 100644 --- a/Templates/Modules/FPSGameplay/FPSGameplay.module +++ b/Templates/Modules/FPSGameplay/FPSGameplay.module @@ -3,8 +3,8 @@ VersionId="1" Description="Starter module for FPS gameplay." ScriptFile="FPSGameplay.cs" - CreateFunction="create" - DestroyFunction="destroy" + CreateFunction="onCreate" + DestroyFunction="onDestroy" Group="Game" Dependencies="UI=1"> diff --git a/Templates/Modules/FPSGameplay/levels/EmptyLevel.mis b/Templates/Modules/FPSGameplay/levels/EmptyLevel.mis index db7b8dc56..a03dc8c83 100644 --- a/Templates/Modules/FPSGameplay/levels/EmptyLevel.mis +++ b/Templates/Modules/FPSGameplay/levels/EmptyLevel.mis @@ -2,6 +2,7 @@ new Scene(EmptyLevel) { canSave = "1"; canSaveDynamicFields = "1"; + gameModeName="DeathMatchGame"; cdTrack = "2"; CTF_scoreLimit = "5"; enabled = "1"; diff --git a/Templates/Modules/FPSGameplay/levels/EmptyTerrain.asset.taml b/Templates/Modules/FPSGameplay/levels/EmptyTerrain.asset.taml index 657070e50..cc0e68aaa 100644 --- a/Templates/Modules/FPSGameplay/levels/EmptyTerrain.asset.taml +++ b/Templates/Modules/FPSGameplay/levels/EmptyTerrain.asset.taml @@ -2,7 +2,7 @@ canSave="true" canSaveDynamicFields="true" AssetName="EmptyTerrain" - FriendlyName="Empty Terrain" - LevelFile="data/FPSGameplay/levels/Empty Terrain.mis" - Description="A Empty level with terrain." + LevelName="Empty Terrain" + LevelFile="Empty Terrain.mis" + LevelDescription="A Empty level with terrain." VersionId="1" /> diff --git a/Templates/Modules/FPSGameplay/levels/Outpost.asset.taml b/Templates/Modules/FPSGameplay/levels/Outpost.asset.taml index 3f70498f0..589d1bdae 100644 --- a/Templates/Modules/FPSGameplay/levels/Outpost.asset.taml +++ b/Templates/Modules/FPSGameplay/levels/Outpost.asset.taml @@ -2,7 +2,7 @@ canSave="true" canSaveDynamicFields="true" AssetName="Outpost" - FriendlyName="Outpost" - LevelFile="data/FPSGameplay/levels/Outpost.mis" - Description="Outpost level" + LevelName="Outpost" + LevelFile="Outpost.mis" + LevelDescription="Outpost level" VersionId="1" /> diff --git a/Templates/Modules/FPSGameplay/scripts/server/deathMatchGame.cs b/Templates/Modules/FPSGameplay/scripts/server/deathMatchGame.cs index 06d947367..345e7f3fd 100644 --- a/Templates/Modules/FPSGameplay/scripts/server/deathMatchGame.cs +++ b/Templates/Modules/FPSGameplay/scripts/server/deathMatchGame.cs @@ -30,7 +30,7 @@ // - gameType = "Deathmatch"; // If this information is missing then the GameCore will default to Deathmatch. // ---------------------------------------------------------------------------- -function DeathMatchGame::initGameVars(%game) +function DeathMatchGame::initGameVars() { //echo (%game @"\c4 -> "@ %game.class @" -> DeathMatchGame::initGameVars"); @@ -60,23 +60,23 @@ function DeathMatchGame::initGameVars(%game) $Game::defaultCameraSpawnGroups = "CameraSpawnPoints PlayerSpawnPoints PlayerDropPoints"; // Set the gameplay parameters - %game.duration = 30 * 60; - %game.endgameScore = 20; - %game.endgamePause = 10; - %game.allowCycling = false; // Is mission cycling allowed? + $Game::Duration = 30 * 60; + $Game::EndGameScore = 20; + $Game::EndGamePause = 10; + $Game::AllowCycling = false; // Is mission cycling allowed? } -function DeathMatchGame::onGameDurationEnd(%game) +function DeathMatchGame::onGameDurationEnd() { // This "redirect" is here so that we can abort the game cycle if // the $Game::Duration variable has been cleared, without having // to have a function to cancel the schedule. if ($Game::Duration && !(EditorIsActive() && GuiEditorIsActive())) - Game.onGameDurationEnd(); + DeathMatchGame::onGameDurationEnd(); } -function DeathMatchGame::onClientEnterGame(%this, %client) +function DeathMatchGame::onClientEnterGame(%client) { // This function currently relies on some helper functions defined in // core/scripts/spawn.cs. For custom spawn behaviors one can either @@ -110,7 +110,7 @@ function DeathMatchGame::onClientEnterGame(%this, %client) %client.RefreshWeaponHud(0, "", ""); // Prepare the player object. - %this.preparePlayer(%client); + DeathMatchGame::preparePlayer(%client); // Inform the client of all the other clients %count = ClientGroup.getCount(); @@ -162,25 +162,26 @@ function DeathMatchGame::onClientEnterGame(%this, %client) %client.isSuperAdmin); } -function DeathMatchGame::onClientLeaveGame(%this, %client) +function DeathMatchGame::onClientLeaveGame(%client) { // Cleanup the camera - if (isObject(%this.camera)) - %this.camera.delete(); + if (isObject(%client.camera)) + %client.camera.delete(); } //----------------------------------------------------------------------------- // The server has started up so do some game start up //----------------------------------------------------------------------------- -function DeathMatchGame::onMissionStart(%this) +function DeathMatchGame::onMissionStart() { //set up the game and game variables - %this.initGameVars(); + DeathMatchGame::initGameVars(); - $Game::Duration = %this.duration; - $Game::EndGameScore = %this.endgameScore; - $Game::EndGamePause = %this.endgamePause; + $Game::Duration = 30 * 60; + $Game::EndGameScore = 20; + $Game::EndGamePause = 10; + $Game::AllowCycling = false; // Is mission cycling allowed? //echo (%game @"\c4 -> "@ %game.class @" -> GameCore::onStartGame"); if ($Game::Running) @@ -203,14 +204,14 @@ function DeathMatchGame::onMissionStart(%this) // Start the game timer if ($Game::Duration) - $Game::Schedule = %this.schedule($Game::Duration * 1000, "onGameDurationEnd"); + $Game::Schedule = schedule($Game::Duration * 1000, "onGameDurationEnd"); $Game::Running = true; - $Game = %this; + $Game = DeathMatchGame; } -function DeathMatchGame::onMissionEnded(%this) +function DeathMatchGame::onMissionEnded() { if (!$Game::Running) { @@ -232,11 +233,11 @@ function DeathMatchGame::onMissionEnded(%this) $Game = ""; } -function DeathMatchGame::onMissionReset(%this) +function DeathMatchGame::onMissionReset() { // Called by resetMission(), after all the temporary mission objects // have been deleted. - %this.initGameVars(); + DeathMatchGame::initGameVars(); $Game::Duration = %this.duration; $Game::EndGameScore = %this.endgameScore; @@ -251,7 +252,7 @@ function DeathMatchGame::onMissionReset(%this) // Added this stage to creating a player so game types can override it easily. // This is a good place to initiate team selection. -function DeathMatchGame::preparePlayer(%this, %client) +function DeathMatchGame::preparePlayer(%client) { //echo (%game @"\c4 -> "@ %game.class @" -> GameCore::preparePlayer"); @@ -263,13 +264,13 @@ function DeathMatchGame::preparePlayer(%this, %client) %playerSpawnPoint = pickPlayerSpawnPoint($Game::DefaultPlayerSpawnGroups); // Spawn a camera for this client using the found %spawnPoint //%client.spawnPlayer(%playerSpawnPoint); - %this.spawnPlayer(%client, %playerSpawnPoint); + DeathMatchGame::spawnPlayer(%client, %playerSpawnPoint); // Starting equipment - %this.loadOut(%client.player); + DeathMatchGame::loadOut(%client.player); } -function DeathMatchGame::loadOut(%game, %player) +function DeathMatchGame::loadOut(%player) { //echo (%game @"\c4 -> "@ %game.class @" -> GameCore::loadOut"); @@ -328,7 +329,7 @@ function sendMsgClientKilled_Default( %msgType, %client, %sourceClient, %damLoc messageAll( %msgType, '%1 gets nailed by %2!', %client.playerName, %sourceClient.playerName ); } -function DeathMatchGame::onDeath(%game, %client, %sourceObject, %sourceClient, %damageType, %damLoc) +function DeathMatchGame::onDeath(%client, %sourceObject, %sourceClient, %damageType, %damLoc) { //echo (%game @"\c4 -> "@ %game.class @" -> GameCore::onDeath"); @@ -355,18 +356,18 @@ function DeathMatchGame::onDeath(%game, %client, %sourceObject, %sourceClient, % // Dole out points and check for win if (( %damageType $= "Suicide" || %sourceClient == %client ) && isObject(%sourceClient)) { - %game.incDeaths( %client, 1, true ); - %game.incScore( %client, -1, false ); + DeathMatchGame::incDeaths( %client, 1, true ); + DeathMatchGame::incScore( %client, -1, false ); } else { - %game.incDeaths( %client, 1, false ); - %game.incScore( %sourceClient, 1, true ); - %game.incKills( %sourceClient, 1, false ); + DeathMatchGame::incDeaths( %client, 1, false ); + DeathMatchGame::incScore( %sourceClient, 1, true ); + DeathMatchGame::incKills( %sourceClient, 1, false ); // If the game may be ended by a client getting a particular score, check that now. if ( $Game::EndGameScore > 0 && %sourceClient.kills >= $Game::EndGameScore ) - %game.cycleGame(); + DeathMatchGame::cycleGame(); } } @@ -374,7 +375,7 @@ function DeathMatchGame::onDeath(%game, %client, %sourceObject, %sourceClient, % // Scoring // ---------------------------------------------------------------------------- -function DeathMatchGame::incKills(%game, %client, %kill, %dontMessageAll) +function DeathMatchGame::incKills(%client, %kill, %dontMessageAll) { %client.kills += %kill; @@ -382,7 +383,7 @@ function DeathMatchGame::incKills(%game, %client, %kill, %dontMessageAll) messageAll('MsgClientScoreChanged', "", %client.score, %client.kills, %client.deaths, %client); } -function DeathMatchGame::incDeaths(%game, %client, %death, %dontMessageAll) +function DeathMatchGame::incDeaths(%client, %death, %dontMessageAll) { %client.deaths += %death; @@ -390,7 +391,7 @@ function DeathMatchGame::incDeaths(%game, %client, %death, %dontMessageAll) messageAll('MsgClientScoreChanged', "", %client.score, %client.kills, %client.deaths, %client); } -function DeathMatchGame::incScore(%game, %client, %score, %dontMessageAll) +function DeathMatchGame::incScore(%client, %score, %dontMessageAll) { %client.score += %score; @@ -422,7 +423,7 @@ function DeathMatchGame::getTeamScore(%client) // Spawning // ---------------------------------------------------------------------------- -function DeathMatchGame::spawnPlayer(%game, %client, %spawnPoint, %noControl) +function DeathMatchGame::spawnPlayer(%client, %spawnPoint, %noControl) { //echo (%game @"\c4 -> "@ %game.class @" -> GameCore::spawnPlayer"); @@ -465,7 +466,7 @@ function DeathMatchGame::spawnPlayer(%game, %client, %spawnPoint, %noControl) if (isObject(%player)) { // Pick a location within the spawn sphere. - %spawnLocation = %game.pickPointInSpawnSphere(%player, %spawnPoint); + %spawnLocation = DeathMatchGame::pickPointInSpawnSphere(%player, %spawnPoint); %player.setTransform(%spawnLocation); } else @@ -588,7 +589,7 @@ function DeathMatchGame::spawnPlayer(%game, %client, %spawnPoint, %noControl) %client.setControlObject(%control); } -function DeathMatchGame::pickPointInSpawnSphere(%this, %objectToSpawn, %spawnSphere) +function DeathMatchGame::pickPointInSpawnSphere(%objectToSpawn, %spawnSphere) { %SpawnLocationFound = false; %attemptsToSpawn = 0; @@ -647,18 +648,18 @@ function DeathMatchGame::pickPointInSpawnSphere(%this, %objectToSpawn, %spawnSph // Observer // ---------------------------------------------------------------------------- -function DeathMatchGame::spawnObserver(%game, %client) +function DeathMatchGame::spawnObserver(%client) { //echo (%game @"\c4 -> "@ %game.class @" -> GameCore::spawnObserver"); // Position the camera on one of our observer spawn points - %client.camera.setTransform(%game.pickObserverSpawnPoint()); + %client.camera.setTransform(DeathMatchGame::pickObserverSpawnPoint()); // Set control to the camera %client.setControlObject(%client.camera); } -function DeathMatchGame::pickObserverSpawnPoint(%game) +function DeathMatchGame::pickObserverSpawnPoint() { //echo (%game @"\c4 -> "@ %game.class @" -> GameCore::pickObserverSpawnPoint");