From: Christian Heller Date: Fri, 13 Nov 2020 22:52:34 +0000 (+0100) Subject: Make some things block movement, and others not. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/task?a=commitdiff_plain;h=0747716a70ba46dbd6a8d7091b864e02b754f56f;p=plomrogue2 Make some things block movement, and others not. --- 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)