From: Christian Heller Date: Sun, 13 Mar 2016 10:46:49 +0000 (+0100) Subject: TCE: Add help system infrastructure. X-Git-Tag: tce~24 X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bprefix%7D%7D/calendar?a=commitdiff_plain;h=21503b48480374b5f1f7a76398a6d57fe51fdba6;p=plomrogue TCE: Add help system infrastructure. --- diff --git a/plugins/client/TheCrawlingEater.py b/plugins/client/TheCrawlingEater.py index 1123af2..fa1ae6c 100644 --- a/plugins/client/TheCrawlingEater.py +++ b/plugins/client/TheCrawlingEater.py @@ -166,3 +166,7 @@ from client.config.commands import commands commands["S"] = (command_sender("drop"),) commands["D"] = (command_sender("drink"),) commands["P"] = (command_sender("pee"),) +commands["1"] = (command_sender("HELP 1"),) +commands["2"] = (command_sender("HELP 2"),) +commands["3"] = (command_sender("HELP 3"),) +commands["4"] = (command_sender("HELP 4"),) diff --git a/plugins/server/TheCrawlingEater.py b/plugins/server/TheCrawlingEater.py index b055888..898f102 100644 --- a/plugins/server/TheCrawlingEater.py +++ b/plugins/server/TheCrawlingEater.py @@ -6,6 +6,18 @@ from server.config.world_data import world_db +def command_help(str_int): + val = integer_test(str_int, 0, 4) + if None != val: + log(str_int) + + +def command_ai(): + if world_db["WORLD_ACTIVE"]: + world_db["ai"](world_db["Things"][0]) + world_db["turn_over"]() + + def play_drink(): if not (action_exists("drink") and world_db["WORLD_ACTIVE"] and world_db["Things"][0]["T_LIFEPOINTS"] > 0): @@ -470,12 +482,6 @@ def write_wetmap(): return write_map(visible_wetmap, world_db["MAP_LENGTH"]) -def command_ai(): - if world_db["WORLD_ACTIVE"]: - world_db["ai"](world_db["Things"][0]) - world_db["turn_over"]() - - def get_dir_to_target(t, target): from server.utils import rand, libpr, c_pointer_to_bytearray @@ -757,6 +763,7 @@ import server.config.make_world_helpers server.config.make_world_helpers.make_map = make_map from server.config.commands import commands_db commands_db["THINGS_HERE"] = (2, True, lambda x, y: None) +commands_db["HELP"] = (1, False, command_help) commands_db["ai"] = (0, False, command_ai) commands_db["move"] = (1, False, play_move) commands_db["eat"] = (1, False, play_move)