Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom map. #128

Open
pontuss95 opened this issue May 12, 2024 · 1 comment
Open

Add support for custom map. #128

pontuss95 opened this issue May 12, 2024 · 1 comment

Comments

@pontuss95
Copy link

pontuss95 commented May 12, 2024

I have made local changes myself that adds the possiblity to use RUST_SERVER_LEVELURL in the configuration file. I assume that more people could want this possibility, the changes i propose can be seen below:

~/rust-server$ git diff HEAD~1..HEAD
diff --git a/README.md b/README.md
index adae089..4689430 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,7 @@ RUST_SERVER_PORT (DEFAULT: "" - Rust server port 28015 if left blank or numeric
 RUST_SERVER_QUERYPORT (DEFAULT: "" - Rust server query port 28016 if left blank or numeric value)
 RUST_SERVER_SEED (DEFAULT: "12345" - The server map seed, must be an integer)
 RUST_SERVER_WORLDSIZE (DEFAULT: "3500" - The map size, must be an integer)
+RUST_SERVER_LEVELURL (DEFAULT: "" - An URL pointing towards a custom map. When using this RUST_SERVER_SEED and RUST_SERVER_WORLDSIZE are ignored.)
 RUST_SERVER_NAME (DEFAULT: "Rust Server [DOCKER]" - The publicly visible server name)
 RUST_SERVER_MAXPLAYERS (DEFAULT: "500" - Maximum players on the server, must be an integer)
 RUST_SERVER_DESCRIPTION (DEFAULT: "This is a Rust server running inside a Docker container!" - The publicly visible server description)
diff --git a/start_rust.sh b/start_rust.sh
index ca757e6..482c769 100755
--- a/start_rust.sh
+++ b/start_rust.sh
@@ -218,8 +218,15 @@ add_argument_pair ARGUMENTS "+server.port" "RUST_SERVER_PORT"
 add_argument_pair ARGUMENTS "+server.queryport" "RUST_SERVER_QUERYPORT"
 add_argument_pair ARGUMENTS "+server.identity" "RUST_SERVER_IDENTITY"
 
-add_argument_pair ARGUMENTS "+server.worldsize" "RUST_SERVER_WORLDSIZE"
-add_argument_pair ARGUMENTS "+server.seed" "RUST_SERVER_SEED"
+
+if [ -z "$RUST_SERVER_LEVELURL" ]; then
+       add_argument_pair ARGUMENTS "+server.worldsize" "RUST_SERVER_WORLDSIZE"
+       add_argument_pair ARGUMENTS "+server.seed" "RUST_SERVER_SEED"
+       echo "Generating procedural map.."
+else
+       add_argument_pair ARGUMENTS "+server.levelurl" "RUST_SERVER_LEVELURL"
+       echo "Using custom map.."
+fi
 
 add_argument_pair ARGUMENTS "+server.hostname" "RUST_SERVER_NAME"
 add_argument_pair ARGUMENTS "+server.url" "RUST_SERVER_URL"
@pontuss95
Copy link
Author

I tried creating a pull request however didn't seem i have correct access rights.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant