From ae2cb6598aaa80190eabe0256572118db1d8849c Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Mon, 8 Jun 2020 23:41:33 +0100 Subject: [PATCH] Fix WarpRover when warping onto itself --- pkg/game/world.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/game/world.go b/pkg/game/world.go index 6b88918..a0a24b7 100644 --- a/pkg/game/world.go +++ b/pkg/game/world.go @@ -146,6 +146,11 @@ func (w *World) WarpRover(id uuid.UUID, pos Vector) error { defer w.worldMutex.Unlock() if i, ok := w.Rovers[id]; ok { + // Nothing to do if these positions match + if i.Attributes.Pos == pos { + return nil + } + // Update the world tile // TODO: Make this (and other things) transactional // TODO: Check this worldtile is free