-def play_move(str_arg):
- if action_exists("move"):
- from server.config.world_data import directions_db, symbols_passable
- t = world_db["Things"][0]
- if not str_arg in directions_db:
- print("Illegal move direction string.")
- return
- dir = ord(directions_db[str_arg])
- global mv_yx_in_dir_legal
- move_result = mv_yx_in_dir_legal(chr(dir), t["T_POSY"], t["T_POSX"])
- if 1 == move_result[0]:
- pos = (move_result[1] * world_db["MAP_LENGTH"]) + move_result[2]
- if ord("~") == world_db["MAP"][pos]:
- log("You can't SWIM.")
- return
- if (ord("X") == world_db["MAP"][pos]
- or ord("|") == world_db["MAP"][pos]):
- carries_axe = False
- for id in t["T_CARRIES"]:
- type = world_db["Things"][id]["T_TYPE"]
- if world_db["ThingTypes"][type]["TT_TOOL"] == "axe":
- world_db["Things"][0]["T_ARGUMENT"] = dir
- set_command("move")
- return
- if chr(world_db["MAP"][pos]) in symbols_passable:
- world_db["Things"][0]["T_ARGUMENT"] = dir
+def play_move_attempt_hook(t, direction, pos):
+ if (ord("X") == world_db["MAP"][pos] or ord("|") == world_db["MAP"][pos]):
+ carries_axe = False
+ for tid in t["T_CARRIES"]:
+ ty = world_db["Things"][tid]["T_TYPE"]
+ if world_db["ThingTypes"][ty]["TT_TOOL"] == "axe":
+ world_db["Things"][0]["T_ARGUMENT"] = direction