X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=plomrogue%2Fcommands.py;fp=plomrogue%2Fcommands.py;h=aed5830b5d64c6ea1615fdb57210f8229b3ab50d;hb=aab94ffb12aa0dedc240d7b29001699b95c49249;hp=df4b7e204a26b353c8e46db71281e7b9d345717e;hpb=1ae4633dc3322876c494f710de67dfdbb0a2a5ba;p=plomrogue2
diff --git a/plomrogue/commands.py b/plomrogue/commands.py
index df4b7e2..aed5830 100644
--- a/plomrogue/commands.py
+++ b/plomrogue/commands.py
@@ -347,6 +347,26 @@ def cmd_PLAYER_FACE(game, face, connection_id):
game.record_fov_change(t.position)
cmd_PLAYER_FACE.argtypes = 'string'
+def cmd_PLAYER_HAT(game, hat, connection_id):
+ t = game.get_player(connection_id)
+ if not t:
+ raise GameError('can only edit hat when already logged in')
+ if not t.name in game.hats:
+ raise GameError('not currently wearing an editable hat')
+ if len(hat) != 18:
+ raise GameError('wrong hat string length')
+ legal_chars = t.get_cookie_chars()
+ for c in hat:
+ if c not in legal_chars:
+ raise GameError('used illegal character: "%s" â '
+ 'allowed characters: %s'
+ % (c, legal_chars))
+ game.hats[t.name] = hat
+ game.changed = True
+ # FIXME: pseudo-FOV-change actually
+ game.record_fov_change(t.position)
+cmd_PLAYER_HAT.argtypes = 'string'
+
def cmd_GOD_PLAYER_FACE(game, name, face):
if len(face) != 18:
raise GameError('wrong face string length')
@@ -359,6 +379,10 @@ def cmd_GOD_PLAYER_HAT(game, name, hat):
game.hats[name] = hat
cmd_GOD_PLAYER_HAT.argtypes = 'string string'
+def cmd_GOD_PLAYERS_HAT_CHARS(game, name, hat_chars):
+ game.players_hat_chars[name] = hat_chars
+cmd_GOD_PLAYERS_HAT_CHARS.argtypes = 'string string'
+
def cmd_THING_HAT_DESIGN(game, thing_id, design):
if len(design) != 18:
raise GameError('hat design of wrong length')