X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=new2%2Fplomrogue%2Ftasks.py;h=99bb41f516249e81dc3470caa09444e18c21047d;hb=6a42c14f0f393f8866689e3b19e950cdc299938b;hp=e60012250baed701d8c99f61e6508d90a5980dcd;hpb=0d6e4ded54a3cff9ec068dc329796b781b9d7e16;p=plomrogue2-experiments diff --git a/new2/plomrogue/tasks.py b/new2/plomrogue/tasks.py index e600122..99bb41f 100644 --- a/new2/plomrogue/tasks.py +++ b/new2/plomrogue/tasks.py @@ -1,4 +1,4 @@ -from plomrogue.errors import GameError +from plomrogue.errors import PlayError from plomrogue.mapping import YX @@ -35,9 +35,11 @@ class Task_MOVE(Task): def check(self): test_pos = self.get_move_target() if test_pos is None: - raise GameError('would move out of map') + raise PlayError('would move out of map') + elif test_pos in [t.position for t in self.thing.game.things]: + raise PlayError('would collide with other things') elif self.thing.game.map[test_pos] != '.': - raise GameError('would move into illegal territory') + raise PlayError('would move into illegal territory') def do(self): self.thing.position = self.get_move_target() @@ -53,3 +55,17 @@ class Task_WRITE(Task): def do(self): self.thing.game.map[self.thing.position] = self.args[0] + + + +class Task_FLATTEN_SURROUNDINGS(Task): + todo = 10 + + def check(self): + pass + + def do(self): + self.thing.game.map[self.thing.position] = '.' + for yx in self.thing.game.map_geometry.get_neighbors(self.thing.position).values(): + if yx is not None: + self.thing.game.map[yx] = '.'