// Are we loaded already, be it older or otherwise? if NoClippy then return end // Hi, we exist. rawset(_G, "NoClippy", {}) NoClippy.name = "NoClippy" NoClippy.ver = "RevisedClips (1.01)" NoClippy.author = "TheOneGoofAli" local cmdtable = { {"noclippy 0/1", " - disable/enable NoClippy."}, {"noclippy 2/3", " - enable/disable Screenshot Mode while NoClipping."}, {"noclippyspeed [p/nc]", " - set NoClip speed to . Unless [p/nc] is specified, the input is taken as multiple of FU."}, {"noclippyxyz <0-2>", " - controls how detailed the listed XYZ values are."} } // Descriptive. local function NoClipHello(p) CONS_Printf(p, "\x82"..NoClippy.name.." "..NoClippy.ver.."\x80".." by ".."\x87"..NoClippy.author.."\x80") for i = 1, #cmdtable do CONS_Printf(p, "\x82"..cmdtable[i][1].."\x80"..cmdtable[i][2]) end end // Main function for NoClip setting... and writing about ourselves. local function SetClip(p, action) if action == nil then NoClipHello(p) return end action = $ or "" if p and p.valid and p.mo and p.mo.valid then action:lower() if action == "on" or action == "1" and not p.spectator then if not p.noclippy then CONS_Printf(p, "\x82"..NoClippy.name..":".."\x80".." Noclip enabled.") end p.curx = p.mo.x p.cury = p.mo.y p.curz = p.mo.z p.noclippy = true elseif action == "off" or action == "0" and not p.spectator then if p.noclippy then CONS_Printf(p, "\x82"..NoClippy.name..":".."\x80".." Noclip disabled.") end p.noclippy = false p.noclippyss = false P_ResetPlayer(p) elseif (action == "screenshot" or action == "ss" or action == "2") and p.noclippy and not p.noclippyss then p.noclippyss = true p.mo.renderflags = $ | RF_DONTDRAW if p.follower then p.follower.renderflags = $ | RF_DONTDRAW end CONS_Printf(p, "\x82"..NoClippy.name..":".."\x80".." Screenshot Mode enabled.") elseif (action == "screenshotoff" or action == "ssoff" or action == "3") and p.noclippy and p.noclippyss then p.noclippyss = false p.mo.renderflags = $ & ~RF_DONTDRAW if p.follower then p.follower.renderflags = $ & ~RF_DONTDRAW end CONS_Printf(p, "\x82"..NoClippy.name..":".."\x80".." Screenshot Mode disabled.") else CONS_Printf(p, "\x82"..NoClippy.name..":".."\x80".." Error or unknown syntax.") end else if gamestate != GS_LEVEL then CONS_Printf(p, "\x82"..NoClippy.name..":".."\x80".." You must be in a level first!") else CONS_Printf(p, "\x82"..NoClippy.name..":".."\x80".." No player and player object found.") end end end // MACHTURNE's conversion of fixed_t to a floating number. // 16384 as input would return a "0.25" string output. local function fixedToFloat(n) local str = (n < 0 and "-" or "") .. tostring(abs(n)/FRACUNIT) if not (n % FRACUNIT) then return str end n = abs(n) % FRACUNIT str = $ .. "." while n > 0 do n = $ * 10 str = $ .. tostring(n >> FRACBITS) n = $ & (FRACUNIT-1) end return str end // Set our noclip speed. Negative values will invert controls. local function SetClipSpeed(p, samount, stype) stype, samount = $ or "", $ or "" stype:lower() if tonumber(samount) == nil and samount != "" then CONS_Printf(p, "\x82"..NoClippy.name..":".."\x80".." Unable to convert to number, aborting.") return elseif samount == "" then local text = "\x82"..NoClippy.name..":".."\x80".." Current noclippy speed is "..fixedToFloat(p.curclipspeed).." FU(s) / "..p.curclipspeed CONS_Printf(p, text) return else samount = tonumber($) end if stype == "precise" or stype == "noconvert" or stype == "p" or stype == "nc" then p.curclipspeed = samount CONS_Printf(p, "\x82"..NoClippy.name..":".."\x80".." Set noclippy speed to "..samount..".") else p.curclipspeed = samount*FRACUNIT CONS_Printf(p, "\x82"..NoClippy.name..":".."\x80".." Set noclippy speed to "..samount.." FU(s).") end end COM_AddCommand("noclippy", SetClip, COM_ADMIN) COM_AddCommand("noclippyspeed", SetClipSpeed, COM_ADMIN) local noclippyxyzdetail = CV_RegisterVar({ // How detailed our XYZ display is. name = "noclippyxyz", defaultvalue = 0, flags = CV_SHOWMODIF, PossibleValue = {base=0, more=1, full=2} }) local function NoDmg(p, i, s) if p.noclippy then return true end end local function NoBumpy(mo, othermo) if mo and mo.valid and mo.player and mo.player.valid and mo.player.noclippy then return false end if othermo and othermo.valid and othermo.player and othermo.player.valid and othermo.player.noclippy then return false end end addHook("MobjDamage", NoDmg) addHook("MobjCollide", NoBumpy, MT_PLAYER) addHook("MobjMoveCollide", NoBumpy, MT_PLAYER) addHook("ShouldDamage", NoBumpy, MT_PLAYER) addHook("ThinkFrame", function() for p in players.iterate() do if p.noclippy == nil then p.noclippy = false end if p.noclippy and p.spectator then CONS_Printf(p, "\x82"..NoClippy.name..":".."\x80".." Spectator mode detected, turning off...") p.noclippy = false end if p.curx == nil then p.curx = p.mo.x end if p.cury == nil then p.cury = p.mo.y end if p.curz == nil then p.curz = p.mo.z end if p.curclipspeed == nil then p.curclipspeed = 6*FRACUNIT end if p.noclippy == false then continue end if p.mo and p.mo.valid then S_StopSound(p.mo) // Shhh. if p.noclippyss then p.mo.renderflags = $ | RF_DONTDRAW if p.follower then p.follower.renderflags = $ | RF_DONTDRAW end end end local moveforce = p.curclipspeed if (p.cmd.buttons & BT_DRIFT) then moveforce = $*2 end // Double movement if holding Drift. if (p.cmd.buttons & BT_ACCELERATE) then p.curz = $+moveforce end // Accelerate - up. if (p.cmd.buttons & BT_BRAKE) then p.curz = $-moveforce end // Brake - down. if p.cmd.throwdir > 0 then // Forward. p.curx = $+P_ReturnThrustX(p.mo, p.mo.angle, moveforce) p.cury = $+P_ReturnThrustY(p.mo, p.mo.angle, moveforce) p.cmd.throwdir = 0 // Prevent looking up! end if p.cmd.throwdir < 0 then // Backwards. p.curx = $+P_ReturnThrustX(p.mo, p.mo.angle, -moveforce) p.cury = $+P_ReturnThrustY(p.mo, p.mo.angle, -moveforce) p.cmd.throwdir = 0 // Prevent looking down. end if p.cmd.turning != 0 then p.mo.angle = $+p.cmd.turning<<16 end // Turning. if p.sneakertimer != 0 then p.sneakertimer = 0 // No actual boost stuff. end if not (p.pflags & PF_TRUSTWAYPOINTS) then p.pflags = $ | PF_TRUSTWAYPOINTS // Source: trust me bro. end if (p.pflags & PF_AIRFAILSAFE) then p.pflags = $ &~ PF_AIRFAILSAFE // No failsafe, you *are* safe! end p.karthud[khud_boostcam] = 0 // Prevent the camera movement should a speed panel be touched. P_MoveOrigin(p.mo, p.curx, p.cury, p.curz) // Interpolatedly move. P_InstaThrust(p.mo, p.mo.angle, 0) P_SetObjectMomZ(p.mo, 0) end end) local hudtable = {[1] = "position", [2] = "speedometer", [3] = "freeplay", [4] = "gametypeinfo", [5] = "item", [6] = "minirankings"} local function DisplayXYZ(v, p, c) if not (p and p.valid and p.mo and p.mo.valid) then return end if p.noclippy then if hud.enabled(hudtable[1]) or hud.enabled(hudtable[2]) or hud.enabled(hudtable[3]) or hud.enabled(hudtable[4]) or hud.enabled(hudtable[5]) or hud.enabled(hudtable[6]) then for k, v in ipairs(hudtable) do hud.disable(v) end end local strx, stry, strz if noclippyxyzdetail.value == 1 then strx = "X = "..p.mo.x/FRACUNIT.." FU / "..p.mo.x stry = "Y = "..p.mo.y/FRACUNIT.." FU / "..p.mo.y strz = "Z = "..p.mo.z/FRACUNIT.." FU / "..p.mo.z elseif noclippyxyzdetail.value == 2 then strx = "X = "..fixedToFloat(p.mo.x).." FU / "..p.mo.x stry = "Y = "..fixedToFloat(p.mo.y).." FU / "..p.mo.y strz = "Z = "..fixedToFloat(p.mo.z).." FU / "..p.mo.z else strx = "X = "..p.mo.x/FRACUNIT.." FU" stry = "Y = "..p.mo.y/FRACUNIT.." FU" strz = "Z = "..p.mo.z/FRACUNIT.." FU" end v.drawString(4, 176, strx, V_SNAPTOTOP|V_SNAPTOLEFT, "left") v.drawString(4, 184, stry, V_SNAPTOTOP|V_SNAPTOLEFT, "left") v.drawString(4, 192, strz, V_SNAPTOTOP|V_SNAPTOLEFT, "left") else if not (hud.enabled(hudtable[1]) or hud.enabled(hudtable[2]) or hud.enabled(hudtable[3]) or hud.enabled(hudtable[4]) or hud.enabled(hudtable[5]) or hud.enabled(hudtable[6])) then for k, v in ipairs(hudtable) do hud.enable(v) end end end end hud.add(DisplayXYZ, "game") // I've come to make an announcement. print("\x82"..NoClippy.name.." "..NoClippy.ver.."\x80".." by ".."\x87"..NoClippy.author.."\x80")