From e874428cd36346fe6e118d434d252ed182c40bea Mon Sep 17 00:00:00 2001 From: Nicholas Hayashi Date: Thu, 4 Feb 2021 00:52:59 -0500 Subject: [PATCH] build feedback --- src/game.lua | 14 +++++++++++++- src/tower.lua | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/game.lua b/src/game.lua index 5eedeb9..0245b53 100644 --- a/src/game.lua +++ b/src/game.lua @@ -25,7 +25,19 @@ local function get_initial_game_state(seed) end local function can_do_build(hex, tile, tower_type) - return can_afford_tower(state.money, tower_type) and tower_is_buildable_on(hex, tile, tower_type) + if not can_afford_tower(state.money, tower_type) then + return false + end + + if not tower_is_buildable_on(hex, tile, tower_type) then + local node = WIN.scene("cursor"):child(1) + node.color = COLORS.CLARET + node:action(am.tween(0.1, { color = COLORS.TRANSPARENT })) + + return false + end + + return true end -- initialized later, as part of the init of the toolbelt diff --git a/src/tower.lua b/src/tower.lua index f46cb73..e675a4d 100644 --- a/src/tower.lua +++ b/src/tower.lua @@ -154,7 +154,7 @@ function tower_is_buildable_on(hex, tile, tower_type) elseif tower_type == TOWER_TYPE.LIGHTHOUSE then local has_water_neighbour = false for _,h in pairs(hex_neighbours(hex)) do - local tile = HEX_MAP.get(h.x, h.y) + local tile = state.map.get(h.x, h.y) if tile and tile.elevation < -0.5 then has_water_neighbour = true