FPSGameplay.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 FPSGameplay::create( %this )
  11. {
  12. //server scripts
  13. exec("./scripts/server/aiPlayer.cs");
  14. exec("./scripts/server/camera.cs");
  15. exec("./scripts/server/chat.cs");
  16. exec("./scripts/server/cheetah.cs");
  17. exec("./scripts/server/commands.cs");
  18. exec("./scripts/server/centerPrint.cs");
  19. exec("./scripts/server/deathMatchGame.cs");
  20. exec("./scripts/server/health.cs");
  21. exec("./scripts/server/inventory.cs");
  22. exec("./scripts/server/item.cs");
  23. exec("./scripts/server/player.cs");
  24. exec("./scripts/server/projectile.cs");
  25. exec("./scripts/server/proximityMine.cs");
  26. exec("./scripts/server/radiusDamage.cs");
  27. exec("./scripts/server/shapeBase.cs");
  28. exec("./scripts/server/spawn.cs");
  29. exec("./scripts/server/teleporter.cs");
  30. exec("./scripts/server/triggers.cs");
  31. exec("./scripts/server/turret.cs");
  32. exec("./scripts/server/vehicle.cs");
  33. exec("./scripts/server/vehicleWheeled.cs");
  34. exec("./scripts/server/VolumetricFog.cs");
  35. exec("./scripts/server/weapon.cs");
  36. exec("./scripts/server/physicsShape.cs");
  37. //add DBs
  38. if(isObject(DatablockFilesList))
  39. {
  40. for( %file = findFirstFile( "data/FPSGameplay/scripts/datablocks/*.cs.dso" );
  41. %file !$= "";
  42. %file = findNextFile( "data/FPSGameplay/scripts/datablocks/*.cs.dso" ))
  43. {
  44. // Only execute, if we don't have the source file.
  45. %csFileName = getSubStr( %file, 0, strlen( %file ) - 4 );
  46. if( !isFile( %csFileName ) )
  47. DatablockFilesList.add(%csFileName);
  48. }
  49. // Load all source material files.
  50. for( %file = findFirstFile( "data/FPSGameplay/scripts/datablocks/*.cs" );
  51. %file !$= "";
  52. %file = findNextFile( "data/FPSGameplay/scripts/datablocks/*.cs" ))
  53. {
  54. DatablockFilesList.add(%file);
  55. }
  56. }
  57. if(isObject(LevelFilesList))
  58. {
  59. for( %file = findFirstFile( "data/FPSGameplay/levels/*.mis" );
  60. %file !$= "";
  61. %file = findNextFile( "data/FPSGameplay/levels/*.mis" ))
  62. {
  63. LevelFilesList.add(%file);
  64. }
  65. }
  66. if (!$Server::Dedicated)
  67. {
  68. exec("data/FPSGameplay/scripts/client/gameProfiles.cs");
  69. //client scripts
  70. $KeybindPath = "data/FPSGameplay/scripts/client/default.keybinds.cs";
  71. exec($KeybindPath);
  72. %prefPath = getPrefpath();
  73. if(isFile(%prefPath @ "/keybinds.cs"))
  74. exec(%prefPath @ "/keybinds.cs");
  75. exec("data/FPSGameplay/scripts/client/inputCommands.cs");
  76. //guis
  77. exec("./scripts/gui/chatHud.gui");
  78. exec("./scripts/gui/playerList.gui");
  79. exec("./scripts/gui/playGui.gui");
  80. exec("./scripts/gui/hudlessGui.gui");
  81. exec("data/FPSGameplay/scripts/client/playGui.cs");
  82. exec("data/FPSGameplay/scripts/client/hudlessGui.cs");
  83. exec("data/FPSGameplay/scripts/client/message.cs");
  84. exec("data/FPSGameplay/scripts/client/chatHud.cs");
  85. exec("data/FPSGameplay/scripts/client/clientCommands.cs");
  86. exec("data/FPSGameplay/scripts/client/messageHud.cs");
  87. exec("data/FPSGameplay/scripts/client/playerList.cs");
  88. exec("data/FPSGameplay/scripts/client/centerPrint.cs");
  89. exec("data/FPSGameplay/scripts/client/recordings.cs");
  90. exec("data/FPSGameplay/scripts/client/screenshot.cs");
  91. }
  92. }
  93. function FPSGameplay::destroy( %this )
  94. {
  95. }