- write(f, 'THING_POS %s %s' % (thing.id_,
- stringify_yx(thing.position)))
- task = thing.task
- if task is not None:
- task_args = task.get_args_string()
- task_name = [k for k in game.tasks.keys()
- if game.tasks[k] == task.__class__][0]
- write(f, 'SET_TASK:%s %s %s %s' % (task_name, thing.id_,
- task.todo, task_args))
+ write(f, 'THING_POS %s %s %s' % (thing.id_,
+ stringify_yx(thing.position[0]),
+ stringify_yx(thing.position[1])))
+ if hasattr(thing, 'health'):
+ write(f, 'THING_HEALTH %s %s' % (thing.id_, thing.health))
+ if len(thing.inventory) > 0:
+ write(f, 'THING_INVENTORY %s %s' %
+ (thing.id_,','.join([str(i) for i in thing.inventory])))
+ else:
+ write(f, 'THING_INVENTORY %s ,' % thing.id_)
+ if hasattr(thing, 'task'):
+ task = thing.task
+ if task is not None:
+ task_args = task.get_args_string()
+ task_name = [k for k in game.tasks.keys()
+ if game.tasks[k] == task.__class__][0]
+ write(f, 'SET_TASK:%s %s %s %s' % (task_name, thing.id_,
+ task.todo, task_args))