37 lines
590 B
Lua
37 lines
590 B
Lua
--[[
|
|
-- Generic attack functions.
|
|
--]]
|
|
|
|
--[[
|
|
-- Mainly manages targetting nearest enemy.
|
|
--]]
|
|
function atk_g_think()
|
|
if mem.atk_think ~= nil then
|
|
mem.atk_think()
|
|
else
|
|
atk_g_think()
|
|
end
|
|
|
|
--[[
|
|
-- Generic "brute force" attack. Doesn't really do anything interesting.
|
|
--]]
|
|
function atk_g()
|
|
if mem.atk ~= nil then
|
|
mem.atk()
|
|
else
|
|
atk_g()
|
|
end
|
|
end
|
|
|
|
--[[
|
|
-- Generic function to choose what attack functions match the ship best.
|
|
--]]
|
|
function attack_choose()
|
|
class = ai.shipclass()
|
|
|
|
if class == "Bomber" then
|
|
mem.atk_think = atk_b_think
|
|
mem.atk = atk_b
|
|
end
|
|
|