home
·
contact
·
privacy
projects
/
plomrogue2
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactor change recording; don't regen FOV on non-FOV changes.
[plomrogue2]
/
plomrogue
/
tasks.py
diff --git
a/plomrogue/tasks.py
b/plomrogue/tasks.py
index 537663469392a019d05c5af6ff4ac9571c2b1610..8af4bb957f683227decdcd2f2066a79a766004e5 100644
(file)
--- a/
plomrogue/tasks.py
+++ b/
plomrogue/tasks.py
@@
-42,9
+42,13
@@
class Task_MOVE(Task):
raise PlayError('blocked by impassable tile')
def do(self):
raise PlayError('blocked by impassable tile')
def do(self):
- self.thing.game.record_fov_change(self.thing.position)
+ self.thing.game.record_change(self.thing.position, 'other')
+ if self.thing.blocking:
+ self.thing.game.record_change(self.thing.position, 'fov')
self.thing.position = self._get_move_target()
self.thing.position = self._get_move_target()
- self.thing.game.record_fov_change(self.thing.position)
+ self.thing.game.record_change(self.thing.position, 'other')
+ if self.thing.blocking:
+ self.thing.game.record_change(self.thing.position, 'fov')
if self.thing.carrying:
self.thing.carrying.position = self.thing.position
if self.thing.carrying:
self.thing.carrying.position = self.thing.position
@@
-62,7
+66,7
@@
class Task_WRITE(Task):
big_yx = self.thing.position[0]
little_yx = self.thing.position[1]
self.thing.game.maps[big_yx][little_yx] = self.args[0]
big_yx = self.thing.position[0]
little_yx = self.thing.position[1]
self.thing.game.maps[big_yx][little_yx] = self.args[0]
- self.thing.game.record_
fov_change((big_yx, little_yx)
)
+ self.thing.game.record_
change((big_yx, little_yx), 'fov'
)
@@
-79,7
+83,7
@@
class Task_FLATTEN_SURROUNDINGS(Task):
if not self.thing.game.can_do_tile_with_pw(*yxyx, self.args[0]):
continue
self.thing.game.maps[yxyx[0]][yxyx[1]] = self.thing.game.get_flatland()
if not self.thing.game.can_do_tile_with_pw(*yxyx, self.args[0]):
continue
self.thing.game.maps[yxyx[0]][yxyx[1]] = self.thing.game.get_flatland()
- self.thing.game.record_
fov_change(yxyx
)
+ self.thing.game.record_
change(yxyx, 'fov'
)
@@
-111,8
+115,7
@@
class Task_PICK_UP(Task):
to_pick_up.position = self.thing.position[:]
self.thing.carrying = to_pick_up
to_pick_up.carried = True
to_pick_up.position = self.thing.position[:]
self.thing.carrying = to_pick_up
to_pick_up.carried = True
- # FIXME: pseudo-FOV-change actually
- self.thing.game.record_fov_change(self.thing.position)
+ self.thing.game.record_change(self.thing.position, 'other')
@@
-155,8
+158,7
@@
class Task_DROP(Task):
and t.position == dropped.position]:
t.accept(dropped)
break
and t.position == dropped.position]:
t.accept(dropped)
break
- # FIXME: pseudo-FOV-change actually
- self.thing.game.record_fov_change(self.thing.position)
+ self.thing.game.record_change(self.thing.position, 'other')
@@
-171,7
+173,8
@@
class Task_DOOR(Task):
t.open()
else:
t.close()
t.open()
else:
t.close()
- self.thing.game.record_fov_change(t.position)
+ self.thing.game.record_change(t.position, 'other')
+ self.thing.game.record_change(t.position, 'fov')
@@
-193,8
+196,8
@@
class Task_INTOXICATE(Task):
self.thing.send_msg('RANDOM_COLORS')
self.thing.send_msg('CHAT "You are drunk now."')
self.thing.drunk = 10000
self.thing.send_msg('RANDOM_COLORS')
self.thing.send_msg('CHAT "You are drunk now."')
self.thing.drunk = 10000
- # FIXME: pseudo-FOV-change actually
- self.thing.game.record_
fov_change(self.thing.position
)
+ self.thing.invalidate('fov')
+ self.thing.game.record_
change(self.thing.position, 'other'
)
elif self.thing.carrying.type_ == 'Cookie':
self.thing.send_msg('CHAT ' + quote('You eat a cookie and gain the ability to draw the following character: "%s"' % self.thing.carrying.thing_char))
self.thing.add_cookie_char(self.thing.carrying.thing_char)
elif self.thing.carrying.type_ == 'Cookie':
self.thing.send_msg('CHAT ' + quote('You eat a cookie and gain the ability to draw the following character: "%s"' % self.thing.carrying.thing_char))
self.thing.add_cookie_char(self.thing.carrying.thing_char)
@@
-248,8
+251,7
@@
class Task_INSTALL(Task):
else:
self._get_uninstallables()[0].uninstall()
self.thing.send_msg('CHAT "You uninstall the thing here."')
else:
self._get_uninstallables()[0].uninstall()
self.thing.send_msg('CHAT "You uninstall the thing here."')
- # FIXME: pseudo-FOV-change actually
- self.thing.game.record_fov_change(self.thing.position)
+ self.thing.game.record_change(self.thing.position, 'other')
@@
-287,8
+289,7
@@
class Task_WEAR(Task):
self.thing.send_msg('CHAT "You put on a hat."')
dropped = self.thing.uncarry()
self.thing.game.remove_thing(dropped)
self.thing.send_msg('CHAT "You put on a hat."')
dropped = self.thing.uncarry()
self.thing.game.remove_thing(dropped)
- # FIXME: pseudo-FOV-change actually
- self.thing.game.record_fov_change(self.thing.position)
+ self.thing.game.record_change(self.thing.position, 'other')