mirror of
https://github.com/Ellpeck/TinyLifeExampleMod.git
synced 2024-11-25 21:28:33 +01:00
fixed the example action breaking when clicking out of bounds
This commit is contained in:
parent
31e9187f90
commit
6ba84e6c33
1 changed files with 2 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue