home
·
contact
·
privacy
projects
/
plomrogue2
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve player error messages, and log them to clients.
[plomrogue2]
/
plomrogue
/
commands.py
diff --git
a/plomrogue/commands.py
b/plomrogue/commands.py
index 3b2464b42baa6d7c429832ea34138c970d00570d..643988e63258a49480b185450a6d6632cfe86734 100644
(file)
--- a/
plomrogue/commands.py
+++ b/
plomrogue/commands.py
@@
-4,7
+4,7
@@
from plomrogue.mapping import YX, MapGeometrySquare, MapGeometryHex, Map
-# TODO: instead of sending tasks
and thing types
on request, send them on connection
+# TODO: instead of sending tasks
, thing types etc.
on request, send them on connection
def cmd_TASKS(game, connection_id):
tasks = []
def cmd_TASKS(game, connection_id):
tasks = []
@@
-13,10
+13,16
@@
cmd_TASKS.argtypes = ''
def cmd_THING_TYPES(game, connection_id):
for t_t in game.thing_types.values():
def cmd_THING_TYPES(game, connection_id):
for t_t in game.thing_types.values():
- game.io.send('THING_TYPE %s %s' % (t_t.get_type(),
t_t.symbol_hint
),
+ game.io.send('THING_TYPE %s %s' % (t_t.get_type(),
quote(t_t.symbol_hint)
),
connection_id)
cmd_THING_TYPES.argtypes = ''
connection_id)
cmd_THING_TYPES.argtypes = ''
+def cmd_TERRAINS(game, connection_id):
+ for t in game.terrains.keys():
+ game.io.send('TERRAIN %s %s' % (quote(t), quote(game.terrains[t])),
+ connection_id)
+cmd_TERRAINS.argtypes = ''
+
def cmd_ALL(game, msg, connection_id):
def lower_msg_by_volume(msg, volume):
def cmd_ALL(game, msg, connection_id):
def lower_msg_by_volume(msg, volume):
@@
-211,3
+217,10
@@
def cmd_THING(game, yx, thing_type, thing_id):
game.things += [t_new]
game.changed = True
cmd_THING.argtypes = 'yx_tuple:nonneg string:thing_type int:nonneg'
game.things += [t_new]
game.changed = True
cmd_THING.argtypes = 'yx_tuple:nonneg string:thing_type int:nonneg'
+
+def cmd_THING_NAME(game, thing_id, name):
+ t = game.get_thing(thing_id)
+ if not t:
+ raise GameError('thing of ID %s not found' % thing_id)
+ t.name = name
+cmd_THING_NAME.argtypes = 'int:pos string'