From 6ba84e6c338c9806e2867ed1d93463b215fc33fc Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 29 Jun 2021 13:40:31 +0200 Subject: [PATCH] fixed the example action breaking when clicking out of bounds --- ExampleMod.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ExampleMod.cs b/ExampleMod.cs index ed35694..8003f86 100644 --- a/ExampleMod.cs +++ b/ExampleMod.cs @@ -67,6 +67,8 @@ namespace ExampleMod { ActionType.Register(new ActionType.TypeSettings("ExampleMod.SitOnGrass", ObjectCategory.Ground, typeof(SitDownOnGrassAction)) { // we set this action to be executable only on grass tiles, not on other ground CanExecute = (info, automatic) => { + if (!info.Map.IsInBounds(info.ActionLocation.ToPoint())) + return ActionType.CanExecuteResult.Hidden; var tile = info.Map.GetTile(info.ActionLocation.ToPoint()); if (tile.Name.StartsWith("Grass")) return ActionType.CanExecuteResult.Valid;