home · contact · privacy
Add thing collision detection on movement.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 8 Nov 2020 01:16:16 +0000 (02:16 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 8 Nov 2020 01:16:16 +0000 (02:16 +0100)
new2/plomrogue/tasks.py

index bb78b98699a84ac507699074de4d45dd37237fbd..99bb41f516249e81dc3470caa09444e18c21047d 100644 (file)
@@ -36,6 +36,8 @@ class Task_MOVE(Task):
         test_pos = self.get_move_target()
         if test_pos is None:
             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 PlayError('would move into illegal territory')