Browse Source

fix redeye bug

master
Nicholas Hayashi 3 years ago
parent
commit
ed57668c41
  1. 2
      src/game.lua
  2. 19
      src/tower.lua

2
src/game.lua

@ -687,7 +687,7 @@ local function game_scene()
-- dangling actions run before the main action -- dangling actions run before the main action
scene:late_action(game_action) scene:late_action(game_action)
--play_track(SOUNDS.MAIN_THEME)
play_track(SOUNDS.MAIN_THEME)
return scene return scene
end end

19
src/tower.lua

@ -262,7 +262,23 @@ function init_tower_specs()
placement_f = function(blocked, has_water, has_mountain, has_ground, hex) placement_f = function(blocked, has_water, has_mountain, has_ground, hex)
return not blocked and has_mountain return not blocked and has_mountain
end, end,
update_f = default_tower_update_f
update_f = function(tower, tower_index)
if not tower.target_index then
-- try and acquire a target
default_weapon_target_acquisition_f(tower, tower_index)
else
-- check if our current target is invalidated
local mob = game_state.mobs[tower.target_index]
if not mob then
tower.target_index = false
else
-- do what we should do with the target
default_handle_target_f(tower, tower_index, mob)
end
end
end
}, },
{ {
id = "MOAT", id = "MOAT",
@ -404,6 +420,7 @@ function init_tower_specs()
if not t.height then t.height = 1 end if not t.height then t.height = 1 end
if not t.update_f then if not t.update_f then
-- is this good?
t.update_f = default_tower_update_f t.update_f = default_tower_update_f
end end
if not t.placement_f then if not t.placement_f then

Loading…
Cancel
Save