home · contact · privacy
Server: Start modularizing into separate files.
[plomrogue] / roguelike-server
index 753961d1cb5323a4c231a76236215eec4cccf183..773a2fa4a5827fb6639974ff9cc2ef03637b9fc5 100755 (executable)
@@ -15,6 +15,10 @@ import ctypes
 import math
 
 
+from server.config.world_data import world_db, directions_db
+from server.config.io import io_db
+
+
 class RandomnessIO:
     """"Interface to libplomrogue's pseudo-randomness generator."""
 
@@ -34,7 +38,7 @@ def prep_library():
     """Prepare ctypes library at ./libplomrogue.so"""
     libpath = ("./libplomrogue.so")
     if not os.access(libpath, os.F_OK):
-        raise SystemExit("No library " + libpath + ", run ./redo first?")
+        raise SystemExit("No library " + libpath + ", run ./build.sh first?")
     libpr = ctypes.cdll.LoadLibrary(libpath)
     libpr.seed_rrand.restype = ctypes.c_uint32
     return libpr
@@ -1712,37 +1716,6 @@ commands_db = {
 # TODO: Unhandled cases: (Un-)killing animates (esp. player!) with T_LIFEPOINTS.
 
 
-"""World state database. With sane default values. (Randomness is in rand.)"""
-world_db = {
-    "TURN": 0,
-    "MAP_LENGTH": 64,
-    "PLAYER_TYPE": 0,
-    "WORLD_ACTIVE": 0,
-    "MAP": False,
-    "ThingActions": {},
-    "ThingTypes": {},
-    "Things": {}
-}
-
-"""Mapping of direction names to internal direction chars."""
-directions_db = {"east": "d", "south-east": "c", "south-west": "x",
-                 "west": "s", "north-west": "w", "north-east": "e"}
-
-"""File IO database."""
-io_db = {
-    "path_save": "save",
-    "path_record": "record_save",
-    "path_worldconf": "confserver/world",
-    "path_server": "server/",
-    "path_in": "server/in",
-    "path_out": "server/out",
-    "path_worldstate": "server/worldstate",
-    "tmp_suffix": "_tmp",
-    "kicked_by_rival": False,
-    "worldstate_updateable": False
-}
-
-
 try:
     libpr = prep_library()
     rand = RandomnessIO()