mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Refine steam server install function
Tidyed up, ensure dirs exist, separate game and steamcmd files, add better comments, fix page reload after install
This commit is contained in:
parent
cec44103c6
commit
235e086ea1
@ -233,22 +233,43 @@ class ImportHelpers:
|
|||||||
|
|
||||||
def create_steam_server(self, app_id, server_id, server_dir, server_exe):
|
def create_steam_server(self, app_id, server_id, server_dir, server_exe):
|
||||||
# TODO: what is the server exe called @zedifus
|
# TODO: what is the server exe called @zedifus
|
||||||
server_exe = "steamcmd.exe"
|
# @pretzel As we are not able to use steamcmd to launch game it
|
||||||
# Sets the steamCMD install directory for next install.
|
# is not possible to be populate as we dont know the executable.
|
||||||
self.steam = SteamCMD(server_dir)
|
server_exe = "game.exe"
|
||||||
|
|
||||||
|
# Initiate SteamCMD & game installing status.
|
||||||
|
ServersController.set_import(server_id)
|
||||||
|
|
||||||
|
# Set our storage locations
|
||||||
|
steamcmd_path = os.path.join(server_dir, "steamcmd_files")
|
||||||
|
gamefiles_path = os.path.join(server_dir, "gameserver_files")
|
||||||
|
|
||||||
|
# Ensure game and steam directories exist in server directory.
|
||||||
|
self.helper.ensure_dir_exists(steamcmd_path)
|
||||||
|
self.helper.ensure_dir_exists(gamefiles_path)
|
||||||
|
|
||||||
|
# Set the SteamCMD install directory for next install.
|
||||||
|
self.steam = SteamCMD(steamcmd_path)
|
||||||
|
|
||||||
|
# Install SteamCMD for managing game server files.
|
||||||
self.steam.install()
|
self.steam.install()
|
||||||
|
|
||||||
full_jar_path = os.path.join(server_dir, server_exe)
|
# Set the server execuion command. TODO brainstorm how to approach.
|
||||||
|
full_jar_path = os.path.join(steamcmd_path, server_exe)
|
||||||
if Helpers.is_os_windows():
|
if Helpers.is_os_windows():
|
||||||
server_command = f'"{full_jar_path}"'
|
server_command = f'"{full_jar_path}"' # TODO why called jar
|
||||||
else:
|
else:
|
||||||
server_command = f"./{server_exe}"
|
server_command = f"./{server_exe}"
|
||||||
logger.debug("command: " + server_command)
|
logger.debug("command: " + server_command)
|
||||||
|
|
||||||
ServersController.set_import(server_id)
|
# Install the game server files.
|
||||||
self.steam.app_update(app_id, "./gamefiles")
|
self.steam.app_update(app_id, gamefiles_path)
|
||||||
|
|
||||||
|
# Finalise SteamCMD & game installing status.
|
||||||
ServersController.finish_import(server_id)
|
ServersController.finish_import(server_id)
|
||||||
|
server_users = PermissionsServers.get_server_user_list(server_id)
|
||||||
|
for user in server_users:
|
||||||
|
WebSocketManager().broadcast_user(user, "send_start_reload", {})
|
||||||
|
|
||||||
def download_bedrock_server(self, path, new_id):
|
def download_bedrock_server(self, path, new_id):
|
||||||
download_thread = threading.Thread(
|
download_thread = threading.Thread(
|
||||||
|
Loading…
Reference in New Issue
Block a user