freeslot("MT_SUPERMISSILE", "S_SUPERMISSILE", "S_SUPERMISSILE2", "S_SUPERMISSILE3", "S_SUPERMISSILE_EXPLODE", "S_SUPERMISSILE_EXPLODE2", "S_SUPERMISSILE_EXPLODE3")
// Finds a player other than the object's target that's nearby, and sets it to the object's tracer
// Var1 = distance limit
// Var2 = if set, get the nearest player - if not, just take the first one in range
function A_FindOtherPlayer(mo, distlimit, nearest)
local distcheck = distlimit
for p in players.iterate do
if not (p.mo and p.mo.valid and p.mo.health) then continue end
if p.mo == mo.target then continue end
local newdist = P_AproxDistance(P_AproxDistance(p.mo.x-mo.x, p.mo.y-mo.y), p.mo.z-mo.z)
if newdist <= distcheck then
mo.tracer = p.mo
distcheck = newdist
if not nearest then return end
end
end
end
addHook("ThinkFrame", function()
for player in players.iterate do
if not player.supermissile then
player.supermissile = 1
end
player.supermissile = $1 + 1
if (player.cmd.buttons & BT_CUSTOM1)
and player.supermissile > 32 then
P_SpawnPlayerMissile(player.mo, MT_SUPERMISSILE, MF2_RAILRING)
A_BunnyHop(player.mo, 7, -7)
player.supermissile = 1
end
end
end)