From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 8 Nov 2020 01:16:16 +0000 (+0100)
Subject: Add thing collision detection on movement.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D/booking/static/day?a=commitdiff_plain;h=6a42c14f0f393f8866689e3b19e950cdc299938b;p=plomrogue2-experiments

Add thing collision detection on movement.
---

diff --git a/new2/plomrogue/tasks.py b/new2/plomrogue/tasks.py
index bb78b98..99bb41f 100644
--- a/new2/plomrogue/tasks.py
+++ b/new2/plomrogue/tasks.py
@@ -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')