home
·
contact
·
privacy
projects
/
plomrogue
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Server/py: Extend command_worldactive().
[plomrogue]
/
plomrogue-server.py
diff --git
a/plomrogue-server.py
b/plomrogue-server.py
index c8cb0eebaa8548018f8fce0f990e7d784180d96b..94925ed2bf0f4886787f35e5fd373a010050d08e 100755
(executable)
--- a/
plomrogue-server.py
+++ b/
plomrogue-server.py
@@
-117,7
+117,7
@@
def record(command):
def save_world():
def save_world():
- """Save all commands needed to reconstruct current world state."""
+ """Save all commands needed to reconstruct current world state."""
# TODO: Misses same optimizations as record() from the original record().
def quote(string):
# TODO: Misses same optimizations as record() from the original record().
def quote(string):
@@
-291,8
+291,8
@@
def play_game():
def remake_map():
def remake_map():
- # DUMMY.
-
print("I'd (re-)make the map now, if only I knew how."
)
+ # DUMMY
map creator
.
+
world_db["MAP"] = bytearray(b'.' * (world_db["MAP_LENGTH"] ** 2)
)
def set_world_inactive():
def set_world_inactive():
@@
-369,7
+369,8
@@
def command_makeworld(seed_string):
def command_maplength(maplength_string):
# DUMMY.
set_world_inactive()
def command_maplength(maplength_string):
# DUMMY.
set_world_inactive()
- # TODO: remove things, map
+ # TODO: remove map
+ world_db["Things"] = {}
setter(None, "MAP_LENGTH", 1, 256)(maplength_string)
setter(None, "MAP_LENGTH", 1, 256)(maplength_string)
@@
-381,14
+382,18
@@
def command_worldactive(worldactive_string):
set_world_inactive()
elif 0 == world_db["WORLD_ACTIVE"]:
wait_exists = False
set_world_inactive()
elif 0 == world_db["WORLD_ACTIVE"]:
wait_exists = False
+ for ThingAction in world_db["ThingActions"]:
+ if "wait" == ThingAction["TA_NAME"]:
+ wait_exists = True
+ break
player_exists = False
player_exists = False
- map_exists = False
-
# TODO: perform tests
:
- # Is there thing action of name 'wait'?
- # Is there a player thing?
- # Is there a map?
+ for Thing in world_db["Things"]:
+
if 0 == ThingAction["T_ID"]
:
+ player_exists = True
+ break
+ map_exists = "MAP" in world_db
if wait_exists and player_exists and map_exists:
if wait_exists and player_exists and map_exists:
- # TODO: rebuild al things' FOVs, map memories
+ # TODO: rebuild al
l
things' FOVs, map memories
world_db["WORLD_ACTIVE"] = 1
world_db["WORLD_ACTIVE"] = 1