home · contact · privacy
Server: Make world initialization conf file choosable.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 6 Feb 2016 00:26:24 +0000 (01:26 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 6 Feb 2016 00:26:24 +0000 (01:26 +0100)
SERVER_COMMANDS
roguelike-server
server/config/io.py
server/utils.py

index 156cd432ebef2e29a29754570d3f3bf6225dc45a..e959f258c37ab04cac61e66dbd26058102b24640 100644 (file)
@@ -6,9 +6,10 @@ Normal mode
 
 In normal mode, the server on start up checks for the existence of ./save and,
 on success, reads all commands from it. If no save file exists, commands from
-./confserver/world are read instead – and written to the file ./record_save.
-Afterwards, the command "MAKE_WORLD" with the current Unix time as argument is
-interpreted (and also written to ./record_save).
+./confserver/world (or any file defined with the -w argument) are read instead
+– and written to the file ./record_save. Afterwards, the command "MAKE_WORLD"
+with the current Unix time as argument is interpreted (and also written to
+./record_save).
 
 In any case, from then on, further commands are read in from ./server_run/in.
 New commands must be appended to the file – which is what the client does. All
index abd2f2fcdfb3a41815cb6002ccfd7e8be9b250ce..ac6601e2a0cbb8edcf04ceb2ff091d76f6e573b8 100755 (executable)
@@ -47,11 +47,10 @@ def play_game():
     if os.access(io_db["path_save"], os.F_OK):
         obey_lines_in_file(io_db["path_save"], "save")
     else:
-        if not os.access(io_db["path_worldconf"], os.F_OK):
+        if not os.access(opts.worldconf, os.F_OK):
             msg = "No world config file from which to start a new world."
             raise SystemExit(msg)
-        obey_lines_in_file(io_db["path_worldconf"], "world config ",
-                           do_record=True)
+        obey_lines_in_file(opts.worldconf, "world config ", do_record=True)
         obey("MAKE_WORLD " + str(int(time.time())), "in file", do_record=True)
     while True:
         try_worldstate_update()
index e134b2f6af6a7d9c1be8430a16a74acd62430a87..ec6a8aedc6c568e17fdc6ddb64debb35591ea8bf 100644 (file)
@@ -7,7 +7,6 @@
 io_db = {
     "path_save": "save",
     "path_record": "record_save",
-    "path_worldconf": "confserver/world",
     "path_server": "server_run/",
     "path_in": "server_run/in",
     "path_out": "server_run/out",
index 22e2454d0f40a46f0384c7852ce2f88ab7475111..db33eba88ebe79c368f72baf6a38e32c00c63c2f 100644 (file)
@@ -95,6 +95,8 @@ def parse_command_line_arguments():
                         action='store')
     parser.add_argument('-l', nargs="?", const="save", dest='savefile',
                         action="store")
+    parser.add_argument('-w', type=str, default="confserver/world",
+                        dest='worldconf', action='store')
     parser.add_argument('-v', dest='verbose', action='store_true')
     opts, unknown = parser.parse_known_args()
     return opts