Fixed crash caused resulting by a previous fix which incorrectly unset target entity

This commit is contained in:
Collin Smith
2020-09-10 23:28:02 -07:00
parent 30f4190ead
commit 0590ddc166

View File

@ -126,7 +126,10 @@ public class CursorMovementSystem extends BaseSystem {
if (target != null) {
int targetId = target.target;
Vector2 srcPos = mPosition.get(src).position;
if (!mPosition.has(targetId)) mTarget.remove(src);
if (mPosition.has(targetId)) {
setTarget(src, Engine.INVALID_ENTITY);
return;
}
Vector2 targetPos = mPosition.get(targetId).position;
// not interactable -> attacking? check weapon range to auto attack or cast spell
Interactable interactable = mInteractable.get(targetId);