home
·
contact
·
privacy
projects
/
plomrogue2-experiments
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move re-positioning of things in inventory to Thing code.
[plomrogue2-experiments]
/
new
/
plomrogue
/
tasks.py
diff --git
a/new/plomrogue/tasks.py
b/new/plomrogue/tasks.py
index dfd22f7d50094d3732a327e370080e1085ef81ca..330eff9b158e41357adbaa91bc207087af0d13c0 100644
(file)
--- a/
new/plomrogue/tasks.py
+++ b/
new/plomrogue/tasks.py
@@
-19,6
+19,8
@@
class Task:
for arg in self.args:
if type(arg) == str:
stringed_args += [quote(arg)]
for arg in self.args:
if type(arg) == str:
stringed_args += [quote(arg)]
+ elif type(arg) == int:
+ stringed_args += [str(arg)]
else:
raise GameError('stringifying arg type not implemented')
return ' '.join(stringed_args)
else:
raise GameError('stringifying arg type not implemented')
return ' '.join(stringed_args)
@@
-36,21
+38,20
@@
class Task_MOVE(Task):
argtypes = 'string:direction'
def check(self):
argtypes = 'string:direction'
def check(self):
- test_pos = self.thing.world.map_.move(self.thing.position, self.args[0])
- if test_pos is None:
+ test_pos = ((0,0),
+ self.thing.world.maps[(0,0)].
+ move(self.thing.position[1], self.args[0]))
+ if test_pos == ((0,0), None):
raise GameError('would move outside map bounds')
raise GameError('would move outside map bounds')
- if self.thing.world.map
_[test_pos
] != '.':
+ if self.thing.world.map
s[test_pos[0]][test_pos[1]
] != '.':
raise GameError('%s would move into illegal terrain' % self.thing.id_)
for t in self.thing.world.things_at_pos(test_pos):
if t.blocking:
raise GameError('%s would move into other thing' % self.thing.id_)
def do(self):
raise GameError('%s would move into illegal terrain' % self.thing.id_)
for t in self.thing.world.things_at_pos(test_pos):
if t.blocking:
raise GameError('%s would move into other thing' % self.thing.id_)
def do(self):
- self.thing.position = self.thing.world.map_.move(self.thing.position,
- self.args[0])
- for id_ in self.thing.inventory:
- t = self.thing.world.get_thing(id_)
- t.position = self.thing.position
+ self.thing.position = (0,0), self.thing.world.maps[(0,0)].\
+ move(self.thing.position[1], self.args[0])