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
Add basic save file mechanism.
[plomrogue2-experiments]
/
new2
/
plomrogue
/
tasks.py
diff --git
a/new2/plomrogue/tasks.py
b/new2/plomrogue/tasks.py
index 402dfcb47c191ea86d9cc133c55813683b3f117e..fffb36a117421bdf04a9082d5e4d3d3649995ef4 100644
(file)
--- a/
new2/plomrogue/tasks.py
+++ b/
new2/plomrogue/tasks.py
@@
-1,5
+1,4
@@
from plomrogue.errors import GameError
from plomrogue.errors import GameError
-#from plomrogue.misc import quote
from plomrogue.mapping import YX
from plomrogue.mapping import YX
@@
-26,21
+25,29
@@
class Task_WAIT(Task):
class Task_MOVE(Task):
class Task_MOVE(Task):
+ todo = 1
argtypes = 'string:direction'
def get_move_target(self):
argtypes = 'string:direction'
def get_move_target(self):
- moves = {
- 'UP': YX(-1, 0),
- 'DOWN': YX(1, 0),
- 'LEFT': YX(0, -1),
- 'RIGHT': YX(0, 1),
- }
- return self.thing.position + moves[self.args[0]]
+ return self.thing.game.map_geometry.move(self.thing.position,
+ self.args[0])
def check(self):
test_pos = self.get_move_target()
def check(self):
test_pos = self.get_move_target()
- if test_pos
.y < 0 or test_pos.x < 0 or test_pos.y >= 24 or test_pos.x >= 40:
+ if test_pos
is None:
raise GameError('would move out of map')
def do(self):
self.thing.position = self.get_move_target()
raise GameError('would move out of map')
def do(self):
self.thing.position = self.get_move_target()
+
+
+
+class Task_WRITE(Task):
+ todo = 1
+ argtypes = 'string:char'
+
+ def check(self):
+ pass
+
+ def do(self):
+ self.thing.game.map[self.thing.position] = self.args[0]