laneya2

cave exploration game
git clone https://git.ce9e.org/laneya2.git

commit
6f7dc5c8ca4d56d2dd1d0c0c746d03c577bd4092
parent
b579a01f3a3d55ad32530060ce6f8df5248e5205
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-09-27 08:14
perf: do not move monsters when out of sight

Diffstat

M monster.go 5 ++++-

1 files changed, 4 insertions, 1 deletions


diff --git a/monster.go b/monster.go

@@ -51,7 +51,10 @@ func (monster *Monster) run() {
   51    51 				}
   52    52 			}
   53    53 
   54    -1 			if bestDist > 10 || !monster.Game.IsFree(monster.Pos.Move(dir)) {
   -1    54 			if bestDist > 10 {
   -1    55 				continue
   -1    56 			}
   -1    57 			if !monster.Game.IsFree(monster.Pos.Move(dir)) {
   55    58 				dir = RandomDir()
   56    59 			}
   57    60