SpectatorGameplay.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // The general flow of a gane - server's creation, loading and hosting clients, and then destruction is as follows:
  2. // First, a client will always create a server in the event that they want to host a single player
  3. // game. Torque3D treats even single player connections as a soft multiplayer game, with some stuff
  4. // in the networking short-circuited to sidestep around lag and packet transmission times.
  5. // initServer() is called, loading the default server scripts.
  6. // After that, if this is a dedicated server session, initDedicated() is called, otherwise initClient is called
  7. // to prep a playable client session.
  8. // When a local game is started - a listen server - via calling StartGame() a server is created and then the client is
  9. // connected to it via createAndConnectToLocalServer().
  10. function SpectatorGameplay::create( %this )
  11. {
  12. //server scripts
  13. exec("./scripts/server/camera.cs");
  14. exec("./scripts/server/DefaultGame.cs");
  15. exec("./scripts/server/VolumetricFog.cs");
  16. //add DBs
  17. if(isObject(DatablockFilesList))
  18. {
  19. DatablockFilesList.add( "data/spectatorGameplay/scripts/datablocks/camera.cs" );
  20. DatablockFilesList.add( "data/spectatorGameplay/scripts/datablocks/defaultParticle.cs" );
  21. DatablockFilesList.add( "data/spectatorGameplay/scripts/datablocks/lights.cs" );
  22. DatablockFilesList.add( "data/spectatorGameplay/scripts/datablocks/managedDatablocks.cs" );
  23. DatablockFilesList.add( "data/spectatorGameplay/scripts/datablocks/managedDecalData.cs" );
  24. DatablockFilesList.add( "data/spectatorGameplay/scripts/datablocks/managedForestItemData.cs" );
  25. DatablockFilesList.add( "data/spectatorGameplay/scripts/datablocks/managedParticleData.cs" );
  26. DatablockFilesList.add( "data/spectatorGameplay/scripts/datablocks/managedParticleEmitterData.cs" );
  27. DatablockFilesList.add( "data/spectatorGameplay/scripts/datablocks/markers.cs" );
  28. DatablockFilesList.add( "data/spectatorGameplay/scripts/datablocks/ribbons.cs" );
  29. DatablockFilesList.add( "data/spectatorGameplay/scripts/datablocks/sounds.cs" );
  30. }
  31. if(isObject(LevelFilesList))
  32. {
  33. for( %file = findFirstFile( "data/spectatorGameplay/levels/*.mis" );
  34. %file !$= "";
  35. %file = findNextFile( "data/spectatorGameplay/levels/*.mis" ))
  36. {
  37. LevelFilesList.add(%file);
  38. }
  39. }
  40. if (!$Server::Dedicated)
  41. {
  42. //client scripts
  43. $KeybindPath = "data/spectatorGameplay/scripts/client/default.keybinds.cs";
  44. exec($KeybindPath);
  45. %prefPath = getPrefpath();
  46. if(isFile(%prefPath @ "/keybinds.cs"))
  47. exec(%prefPath @ "/keybinds.cs");
  48. exec("data/spectatorGameplay/scripts/client/inputCommands.cs");
  49. //guis
  50. exec("./scripts/gui/playGui.gui");
  51. exec("./scripts/gui/playGui.cs");
  52. }
  53. }
  54. function SpectatorGameplay::destroy( %this )
  55. {
  56. }