local float_timelimit = 10 --These are the functions for the command local function floattime(v, player) if not player.mo and player.mo.valid return end if (player.powers[pw_carry] == CR_NIGHTSMODE) return end if not player.powers[pw_shield] == SH_WHIRLWIND return end if player.float == false return end if player.mo and player.mo.valid and player.powers[pw_shield] == SH_WHIRLWIND and player.float == true v.drawString(-10, 160, ("Float Time:"),V_SNAPTOBOTTOM|V_ALLOWLOWERCASE|V_YELLOWMAP, "left") end end hud.add(floattime, "game") local function floattime2(v, player) if not player.mo and player.mo.valid return end if (player.powers[pw_carry] == CR_NIGHTSMODE) return end if not player.powers[pw_shield] == SH_WHIRLWIND return end if player.float == false return end if player.mo and player.mo.valid and player.powers[pw_shield] == SH_WHIRLWIND and player.float == true v.drawString(85, 160, (player.float_time/30),V_SNAPTOBOTTOM|V_ALLOWLOWERCASE, "left") end end hud.add(floattime2, "game") -- EXCLUSION SYSTEM (the actual command) local EXCLUSIONS_FILENAME = "client/sttwind/exclusions.dat" local function ReadExclusionsFromFile() local result = {} local file = io.openlocal(EXCLUSIONS_FILENAME, "r") if file local fileContent = file:read("*all") for skinName in string.gmatch(fileContent, "[^\n]+") result[skinName] = true end file:close() end return result end local exclusions = ReadExclusionsFromFile() local function WriteExclusionsToFile() local file = io.openlocal(EXCLUSIONS_FILENAME, "w") local isFirst = true for key, _ in pairs(exclusions) if isFirst isFirst = false else file:write("\n") end file:write(key) end file:close() end local function ExcludeCharacters(player, ...) local args = {...} local noArgs = true CONS_Printf(player, "Excluded characters: ") for i, skinName in ipairs(args) exclusions[skinName] = true CONS_Printf(player, "- " .. skinName) noArgs = false end if noArgs CONS_Printf(player, "(no arguments given)") else WriteExclusionsToFile() end end local function IncludeCharacters(player, ...) local args = {...} local noArgs = true CONS_Printf(player, "Included characters: ") for _, skinName in ipairs(args) exclusions[skinName] = nil CONS_Printf(player, "- " .. skinName) noArgs = false end if noArgs CONS_Printf(player, "(no arguments given)") else WriteExclusionsToFile() end end local function ViewExclusions(player, ...) CONS_Printf(player, "Characters excluded from Float Ability: ") for key, _ in pairs(exclusions) CONS_Printf(player, "- " .. key) end end COM_AddCommand("faexclude", ExcludeCharacters) COM_AddCommand("fainclude", IncludeCharacters) COM_AddCommand("faviewexclusions", ViewExclusions) --The actual script addHook("PlayerThink", function(player) if exclusions[player.mo.skin] return end if player.mo and player.mo.valid if player.powers[pw_shield] == SH_WHIRLWIND and player.pflags & PF_SHIELDABILITY player.float = true end end if player.float player.mo.flags = $|MF_NOGRAVITY player.float_time = $-1 if player.cmd.buttons & BT_JUMP player.mo.state = S_PLAY_ROLL player.mo.momz = 10*player.mo.scale*P_MobjFlip(player.mo) player.pflags = $|PF_JUMPED elseif player.cmd.buttons & BT_USE player.mo.state = S_PLAY_ROLL player.mo.momz = -(10*player.mo.scale*P_MobjFlip(player.mo)) player.pflags = $|PF_JUMPED else player.mo.state = S_PLAY_ROLL player.mo.momz = $*5/6 player.pflags = $|PF_JUMPED end if P_PlayerInPain(player) or player.playerstate != PST_LIVE or not (player.pflags & PF_SHIELDABILITY) or player.powers[pw_shield] != SH_WHIRLWIND or P_IsObjectOnGround(player.mo) or player.exiting or (player.cmd.buttons & BT_JUMP and player.cmd.buttons & BT_USE) or not player.float_time player.mo.state = S_PLAY_FALL player.mo.flags = $ & ~MF_NOGRAVITY player.pflags = $|PF_THOKKED & ~PF_SHIELDABILITY & ~PF_JUMPED player.float = false end if player.mo.skin == "xsonic" and player.cmd.buttons & BT_CUSTOM3 player.float = true end if player.mo.state == S_PLAY_SPRING and player.canfloat player.springfrontflip = false end else player.float_time = float_timelimit*30 end end)