Mercurial > fife-parpg
comparison 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 |
comparison
equal
deleted
inserted
replaced
546:8fee2d2286e9 | 547:e59ece21ab3e |
---|---|
22 # Free Software Foundation, Inc., | 22 # Free Software Foundation, Inc., |
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
24 # #################################################################### | 24 # #################################################################### |
25 # This is the rio de hola client for FIFE. | 25 # This is the rio de hola client for FIFE. |
26 | 26 |
27 import sys, os, re, math, random, shutil, glob | 27 import sys, os, re, math, random, shutil, glob, uuid |
28 | 28 |
29 from fife import fife | 29 from fife import fife |
30 | 30 |
31 from fife.extensions.soundmanager import SoundManager | 31 from fife.extensions.soundmanager import SoundManager |
32 from fife.extensions.loaders import loadImportFile | 32 from fife.extensions.loaders import loadImportFile |
216 arg = arg.strip() | 216 arg = arg.strip() |
217 if arg != "": | 217 if arg != "": |
218 cmd.append(arg) | 218 cmd.append(arg) |
219 | 219 |
220 if cmd[0] == "spawn": | 220 if cmd[0] == "spawn": |
221 result = "Usage: spawn [object template] [posx] [posy]" | 221 result = "Usage: spawn [object template] [posx] [posy] " |
222 if len(cmd) != 4: | 222 if len(cmd) != 4: |
223 return result | 223 return result |
224 else: | 224 else: |
225 try: | 225 try: |
226 obj = self._scene.loadObject(cmd[1]) | 226 id = str(uuid.uuid1()) |
227 valdict = { "posx" : float(cmd[2]), "posy" : float(cmd[3]) } | |
228 obj = self._scene.loadObject(cmd[1], id, valdict) | |
227 except ObjectNotFoundError, e: | 229 except ObjectNotFoundError, e: |
228 result = "Error: Cannot load [" + cmd[1] + "]. It could not be found!" | 230 result = "Error: Cannot load [" + cmd[1] + "]. It could not be found!" |
229 obj = None | 231 obj = None |
230 | 232 |
231 if obj: | 233 if obj: |