1. //-----------------------------------------------------------------------------
  2. // Torque Game Engine
  3. // Copyright (C) GarageGames.com, Inc.
  4. //-----------------------------------------------------------------------------
  5.  
  6. //-----------------------------------------------------------------------------
  7.  
  8. // Variables used by server scripts & code.  The ones marked with (c)
  9. // are accessed from code.  Variables preceeded by Pref:: are server
  10. // preferences and stored automatically in the ServerPrefs.cs file
  11. // in between server sessions.
  12. //
  13. //    (c) Server::ServerType              {SinglePlayer, MultiPlayer}
  14. //    (c) Server::GameType                Unique game name
  15. //    (c) Server::Dedicated               Bool
  16. //    ( ) Server::MissionFile             Mission .mis file name
  17. //    (c) Server::MissionName             DisplayName from .mis file
  18. //    (c) Server::MissionType             Not used
  19. //    (c) Server::PlayerCount             Current player count
  20. //    (c) Server::GuidList                Player GUID (record list?)
  21. //    (c) Server::Status                  Current server status
  22. //
  23. //    (c) Pref::Server::Name              Server Name
  24. //    (c) Pref::Server::Password          Password for client connections
  25. //    ( ) Pref::Server::AdminPassword     Password for client admins
  26. //    (c) Pref::Server::Info              Server description
  27. //    (c) Pref::Server::MaxPlayers        Max allowed players
  28. //    (c) Pref::Server::RegionMask        Registers this mask with master server
  29. //    ( ) Pref::Server::BanTime           Duration of a player ban
  30. //    ( ) Pref::Server::KickBanTime       Duration of a player kick & ban
  31. //    ( ) Pref::Server::MaxChatLen        Max chat message len
  32. //    ( ) Pref::Server::FloodProtectionEnabled Bool
  33.  
  34. //-----------------------------------------------------------------------------
  35.  
  36.  
  37. //-----------------------------------------------------------------------------
  38.  
  39. function initServer()
  40. {
  41.  
  42.    echo("\n--------- Initializing MOD: RTS Starter Kit: Server ---------");
  43.  
  44.    // Server::Status is returned in the Game Info Query and represents the
  45.    // current status of the server. This string sould be very short.
  46.    $Server::Status = "Unknown";
  47.  
  48.    // Turn on testing/debug script functions
  49.    $Server::TestCheats = false;
  50.  
  51.    // Specify where the mission files are.
  52.    $Server::MissionFileSpec = "*/missions/*.mis";
  53.  
  54.    // The common module provides the basic server functionality
  55.    initBaseServer();
  56.  
  57.    // Load up game server support scripts
  58.    exec("./scripts/audio/audioProfiles.cs");
  59.    exec("./scripts/audio/player.cs");
  60.    exec("./scripts/fx/player.cs");
  61.    exec("./scripts/fx/environment.cs");
  62.    exec("./scripts/fx/chimneyfire.cs");
  63.    exec("./scripts/avatars/base.cs");
  64.    exec("./scripts/avatars/player.cs");
  65.    exec("./scripts/avatars/warrior.cs");     // JY Warrior
  66.    exec("./scripts/avatars/archer.cs");      // JY Archer
  67.    exec("./scripts/avatars/knightress.cs");  // JY Knightress
  68.    exec("./scripts/avatars/beast.cs");     // JY beast
  69.    exec("./scripts/avatars/guardian.cs");     // JY goblin dungeon guardian  
  70.    exec("./scripts/avatars/shaman.cs");     // JY goblin dungeon guardian  
  71.      
  72.    exec("./scripts/avatars/goblin.cs");      // JY Archer
  73.    exec("./scripts/avatars/stoneman.cs");      // JY Archer
  74.    
  75.    exec("./scripts/core/centerPrint.cs");
  76.    exec("./scripts/core/commands.cs");
  77.    exec("./scripts/core/gameConnection.cs");
  78.    exec("./scripts/core/item.cs");
  79.    exec("./scripts/core/radiusDamage.cs");
  80.    exec("./scripts/core/shapeBase.cs");
  81.    exec("./scripts/core/teams.cs");
  82.    exec("./scripts/core/triggers.cs");
  83.    exec("./scripts/core/weapon.cs");
  84.    exec("./scripts/core/stats.cs");
  85.    exec("./scripts/core/buffs.cs");
  86.    exec("./scripts/globals.cs");
  87.  
  88.    exec("./scripts/items/camera.cs");
  89.    exec("./scripts/items/crossbow.cs");
  90.    exec("./scripts/items/equipment.cs");   // JY
  91.    exec("./scripts/items/staticShape.cs");
  92.    exec("./scripts/items/building.cs");
  93.    
  94.    exec("./scripts/resources/resources-server.cs");   // world dom mod - JY
  95.    
  96.    exec("./scripts/core/game.cs");
  97. }
  98.  
  99.  
  100. //-----------------------------------------------------------------------------
  101.  
  102. function initDedicated()
  103. {
  104.    enableWinConsole(true);
  105.    echo("\n--------- Starting Dedicated Server ---------");
  106.  
  107.    // Make sure this variable reflects the correct state.
  108.    $Server::Dedicated = true;
  109.  
  110.    // The server isn't started unless a mission has been specified.
  111.    if ($missionArg !$= "") {
  112.       createServer("MultiPlayer", $missionArg);
  113.    }
  114.    else
  115.       echo("No mission specified (use -game filename)");
  116. }
  117.  
  118. function debugTxt( %text )
  119. {
  120.    // only display in debug mode ... otherwise, dont  
  121.    if (! (getBuildString() $= "Debug"))
  122.       return;
  123.      
  124.    if ($DEBUG == false)
  125.       return;
  126.      
  127.    // else
  128.    echo( %text );  
  129. }