Mercurial > fife-parpg
diff demos/rpg/scripts/gamecontroller.py @ 547:e59ece21ab3e
Item serialization will now assume some default values if they are not found in the save files.
The 'spawn' console command can now spawn items with default values.
Cleaned up some print statements.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 04 Jun 2010 21:01:34 +0000 |
parents | 8fee2d2286e9 |
children | d0282579668c |
line wrap: on
line diff
--- a/demos/rpg/scripts/gamecontroller.py Thu Jun 03 21:35:06 2010 +0000 +++ b/demos/rpg/scripts/gamecontroller.py Fri Jun 04 21:01:34 2010 +0000 @@ -24,7 +24,7 @@ # #################################################################### # This is the rio de hola client for FIFE. -import sys, os, re, math, random, shutil, glob +import sys, os, re, math, random, shutil, glob, uuid from fife import fife @@ -218,12 +218,14 @@ cmd.append(arg) if cmd[0] == "spawn": - result = "Usage: spawn [object template] [posx] [posy]" + result = "Usage: spawn [object template] [posx] [posy] " if len(cmd) != 4: return result else: try: - obj = self._scene.loadObject(cmd[1]) + id = str(uuid.uuid1()) + valdict = { "posx" : float(cmd[2]), "posy" : float(cmd[3]) } + obj = self._scene.loadObject(cmd[1], id, valdict) except ObjectNotFoundError, e: result = "Error: Cannot load [" + cmd[1] + "]. It could not be found!" obj = None