From 0747716a70ba46dbd6a8d7091b864e02b754f56f Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Fri, 13 Nov 2020 23:52:34 +0100 Subject: [PATCH] Make some things block movement, and others not. --- plomrogue/tasks.py | 5 +++-- plomrogue/things.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plomrogue/tasks.py b/plomrogue/tasks.py index 2c0c3fc..e73b174 100644 --- a/plomrogue/tasks.py +++ b/plomrogue/tasks.py @@ -36,8 +36,9 @@ 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 test_pos in [t.position for t in self.thing.game.things + if t.blocking]: + raise PlayError('blocked by other thing') elif self.thing.game.map[test_pos] != '.': raise PlayError('would move into illegal territory') diff --git a/plomrogue/things.py b/plomrogue/things.py index ecddc87..d1fc711 100644 --- a/plomrogue/things.py +++ b/plomrogue/things.py @@ -17,6 +17,7 @@ class ThingBase: class Thing(ThingBase): + blocking = False def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -39,6 +40,7 @@ class Thing_Stone(Thing): class ThingAnimate(Thing): + blocking = True def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) -- 2.30.2