//Custom action does not currently work as intended. If you can figure out how to get gas to spawn at the user's desired Z height, you are welcome to attempt to get this working. If you do, please add your name to the credits below if you wish to be credited.

//Function P_DustRing Lua clone
local Gasring = function(mobjtype, div, x, y, z, speed, initscale, scale)
    local ang = FixedAngle(FixedDiv(360*FRACUNIT, div*FRACUNIT))  //(ANGLE_180/div)*2

    -- it turned out the radius was effectively nullified thanks to errors in the original script
    -- BUT people preferred how it looked before I "fixed" it, so I got rid of the radius calculations altogether
    -- this was a bit of a mess to sort out, but at least it's probably somewhat fine now?
    -- Monster Iestyn (21/05/19)
   -- (void)radius // commented out since this is probably unused in the actual c code.

    for i = 0, div do
        local dust = P_SpawnMobj(x, y, z, mobjtype)

        dust.angle = ang*i + ANGLE_90
        P_SetScale(dust, FixedMul(initscale, scale))
        dust.destscale = FixedMul(4*FRACUNIT + P_RandomFixed(), scale)
        dust.scalespeed = scale/24
        P_Thrust(dust, ang*i, speed + FixedMul(P_RandomFixed(), scale))
        dust.momz = P_SignedRandom()*scale/64
    end
end

// Function: A_ToxomiserGas
// Made by Glaber with Help from Amperbee, Jaden
// Description: Releases gas clouds. Used by the Canarivore.
//
// var1 = Mobj type.
// var2 = Unused
//
function A_ToxomiserGas(actor, var1)
    Gasring(var1, 4, actor.x, actor.y, actor.z + actor.height / 5, 0, FRACUNIT/10, actor.scale)
    Gasring(var1, 6, actor.x, actor.y, actor.z + actor.height / 5, FRACUNIT, FRACUNIT/10, actor.scale)
end