From b1b8e10249230618e74f04d8d4ed4fd23e36d5b9 Mon Sep 17 00:00:00 2001 From: Shinmera Date: Sun, 7 Jul 2019 19:25:04 +0200 Subject: [PATCH] Check entities against collides-p --- chunk.lisp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/chunk.lisp b/chunk.lisp index 1046ae2af..c18fa2fc0 100644 --- a/chunk.lisp +++ b/chunk.lisp @@ -301,9 +301,11 @@ void main(){ (when (and (not (eq entity target)) (typep entity 'solid)) (let ((hit (scan entity target))) - (when (and hit (or (null result) - (< (vsqrdist2 pos (hit-location hit)) - (vsqrdist2 pos (hit-location result))))) + (when (and hit + (collides-p target entity hit) + (or (null result) + (< (vsqrdist2 pos (hit-location hit)) + (vsqrdist2 pos (hit-location result))))) (setf result hit))))) (when result (collide target (hit-object result) result)