Browse Source

build feedback

master
Nicholas Hayashi 4 years ago
parent
commit
e874428cd3
  1. 14
      src/game.lua
  2. 2
      src/tower.lua

14
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

2
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

Loading…
Cancel
Save