local configplayer

local function valid(mo)
return mo and mo.valid
end

local OBB = "client/mint/mintphys.dat"

addHook("ThinkFrame", do
if valid(consoleplayer)
and not valid(configplayer)
configplayer = consoleplayer
local file = io.openlocal(OBB)
if file
local num = file:read("*n")
COM_BufInsertText(consoleplayer, "mintphys "..num)
file:close()
elseif not file
COM_BufInsertText(consoleplayer, "mintphys 2")
end
end
end)

local function mintphys(p, arg)
local mint = p.minttable
local s = p.realmo

if s and s.valid
if arg
if arg=="off" or arg=="1"
p.mintphys = 1
CONS_Printf(p, "\n"+"Set Mint's air physics to Off.")
if io and p==consoleplayer
local file = io.openlocal(OBB, "w+")
file:write(p.mintphys)
file:close()
end
elseif arg=="on" or arg=="2"
p.mintphys = 2
CONS_Printf(p, "\n"+"Set Mint's air physics to On.")
if io and p==consoleplayer
local file = io.openlocal(OBB, "w+")
file:write(p.mintphys)
file:close()
end
end
else
CONS_Printf(p, "mintphys <on/off> | Toggles Mint's air physics. Default is on.")
S_StartSound(nil, sfx_ncspec, p)
end
else
CONS_Printf(p, "You can't do this right now.")
S_StartSound(nil, sfx_adderr, p)
end
end
COM_AddCommand("mintphys", function(p, arg)
mintphys(p, arg)
end)