From 9f7e248d3c9dc4d5924de12bce775aed7d705851 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Sun, 13 Aug 2023 15:45:11 -0400 Subject: [PATCH] Initial Commit --- Infern's Factorio Server/start_server.sh | 33 ++++++++++++++++++++++++ Infern's Factorio Server/stop_server.sh | 2 ++ README.md | 0 3 files changed, 35 insertions(+) create mode 100644 Infern's Factorio Server/start_server.sh create mode 100644 Infern's Factorio Server/stop_server.sh create mode 100644 README.md diff --git a/Infern's Factorio Server/start_server.sh b/Infern's Factorio Server/start_server.sh new file mode 100644 index 0000000..e61cc38 --- /dev/null +++ b/Infern's Factorio Server/start_server.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +cd /home/aa/Desktop/Factorio/ # You'll want to change this path to wherever you're running the Factorio server from. + +save_name="default" # Set this to the name of your save file. + +# Don't change this unless you know what you're doing. +# Set this to the custom parameters you want the --create command to use. +extra_params_create="--map-gen-settings ./data/map-gen-settings.json --map-settings ./data/map-settings.json" + +# Don't change this unless you know what you're doing. +# Set this to the custom parameters you want the --start_server command to use. +extra_params_start_server="--server-settings ./data/server-settings.json" + +# This handles automatically updating the Factorio binary. +wget https://factorio.com/get-download/stable/headless/linux64 -O factorio_headless.tar.xz + +tar -xf factorio_headless.tar.xz --strip-components=1 --overwrite + +rm -f factorio_headless.tar.xz + +# This checks if the ./saves/$save_name.zip save file exists or not... +if [ ! -f "./saves/${save_name}.zip" ]; then + # ...if not, create the save file + ./bin/x64/factorio ${extra_params_create} --create "./saves/${save_name}.zip" +fi + +# This creates a byobu session that starts the server. +byobu new-session -d -s factorio "./bin/x64/factorio ${extra_params_start_server} --start-server ./saves/${save_name}.zip" + +# This attaches the current terminal to the byobu session. +# Comment this out if you don't want this functionality. +byobu attach -t factorio \ No newline at end of file diff --git a/Infern's Factorio Server/stop_server.sh b/Infern's Factorio Server/stop_server.sh new file mode 100644 index 0000000..4e8d5fa --- /dev/null +++ b/Infern's Factorio Server/stop_server.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +byobu -S factorio send-keys "/quit" C-m diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29