--Air Acceleration --"AA" in the code stands for air acceleration local aaamount = FRACUNIT addHook("PostThinkFrame", function() for player in players.iterate local mo = player.mo local grounded = P_IsObjectOnGround(mo) or (mo.eflags & MFE_JUSTHITFLOOR) if player.aagrounded == nil player.aagrounded = grounded end if player.aaf == nil --air acceleration thrust factor player.aaf = player.thrustfactor end local disable = (player.charability == CA_FLY and mo.state == S_PLAY_FLY) or (mo.flags2 & MF2_TWOD) or (maptol & TOL_2D) or not player.aaon or (mo.skin == "mario" or mo.skin == "luigi" or mo.skin == "s3sonic" or (mo.skin == "cdsonic" and player.physics) or mo.skin == "elfilin") --big exceptions list.. great local otf = player.aaf == player.thrustfactor --is used to check if the character is constantly changing its thrustfactor (e.g. marine) local amount = aaamount == -1 and player.aaamount or min(player.aaamount,aaamount) if player.thrustfactor < 255 --(might never happen) if not (grounded or disable) and (player.aagrounded or not otf) player.thrustfactor = $ + (FixedMul(skins[player.mo.skin].thrustfactor*FU, amount)/FU) elseif (grounded or disable) and not player.aagrounded and otf player.thrustfactor = $ - (FixedMul(skins[player.mo.skin].thrustfactor*FU, amount)/FU) end end if otf or grounded player.aaf = player.thrustfactor else player.aaf = -FRACUNIT end player.aagrounded = disable or grounded end end) addHook("PlayerSpawn", function(player) if player == consoleplayer --just to make sure player.aaon = true player.aaamount = FRACUNIT local fi = io.openlocal("client/airacceleration.dat","r") if fi local data = fi:read("*a") --read whole file if data == "off" player.aaon = false end fi:close() else local fi = io.openlocal("client/airacceleration.dat","w+") if fi fi:write(player.aaon and "on" or "off") fi:close() end end --amount local fi = io.openlocal("client/airacceleration_amount.dat","r") if fi local data = fi:read("*a") --read whole file player.aaamount = tonumber(data) or FRACUNIT fi:close() else local fi = io.openlocal("client/airacceleration_amount.dat","w+") if fi fi:write(tostring(FRACUNIT)) fi:close() end end end end) COM_AddCommand( "airacceleration_toggle", function(player) if player == consoleplayer if player.mo player.aaon = not $ local fi = io.openlocal("client/airacceleration.dat","w+") if fi fi:write(player.aaon and "on" or "off") fi:close() end CONS_Printf(player,"Acceleration in the air has now been turned "+(player.aaon and "on" or "off")+" for you") else CONS_Printf(player,"You cannot toggle this right now..") end end end ) COM_AddCommand( "airacceleration_amount", function(player,arg) if player == consoleplayer and player.mo.valid if tonumber(arg) if P_IsObjectOnGround(player.mo) player.aaamount = tonumber(arg) CONS_Printf(player,"Your Air Acceleration value has been set to "+player.aaamount) if player.aaamount > aaamount CONS_Printf(player,"Warning: Value is outside set range, it will be set to "+aaamount) end local fi = io.openlocal("client/airacceleration_amount.dat","w+") if fi fi:write(player.aaamount) fi:close() end else CONS_Printf(player,"Please try again on the ground.") end else CONS_Printf(player,"airacceleration_amount - Set the amount of air acceleration players have, if they have it enabled") CONS_Printf(player,"Amount should range from 1 (none) to 65536 (full, default)") CONS_Printf(player,"Current value is "+player.aaamount) end end end ) COM_AddCommand( "airacceleration_max_amount", function(player,arg) if player == consoleplayer if tonumber(arg) if multiplayer for player2 in players.iterate player2.thrustfactor = skins[player2.mo.skin].thrustfactor player2.aaf = ($ != -FRACUNIT) and player2.thrustfactor or $ player2.aagrounded = true end aaamount = tonumber(arg) CONS_Printf(player,"Maximum Air Acceleration value has been set to "+aaamount) if aaamount < -1 or aaamount > FRACUNIT CONS_Printf(player,"Warning: Value is outside intended range, issues may happen") end else CONS_Printf(player,"This is disabled in singleplayer") end else CONS_Printf(player,"airacceleration_amount - Set the maximum amount of air acceleration any player can set, if they have it enabled") CONS_Printf(player,"Amount should range from 1 (none) to 65536 (full, default), or to disable the limit, -1") CONS_Printf(player,"Current value is "+aaamount) end end end ,COM_ADMIN)