//hotfix for current softlocks game has (2.3) //written by LIghto, v1 /* list of fixes 1-bug when player respawn while trapped inside bubble 2-bug when player dies during position (specifically the 3 sec coundown) 3-stuck between 2 or more springs 4-bunge jump when player is stopped during the action 5-hold eggmark forever avoiding the explosion 6-lose placement when dying after finishing the race 7-stuck in ramps landing forever on fastfall not moving out of place 8-deeath egg gravity respawn softlock , gravity pulls up but ground is underneath and cant land on ceiling 9-softlock if player or server player spectates after finishing the race 10-lock airsafe boost and fastfall when wall transfering avoiding accidental inputs */ local RESPAWNST_DROP,PF_FAULT,IF_USERINGS, PF_AUTOROULETTE, KITEM_FLAMESHIELD, PF_VOID = 2, 1<<9, 1, 1<<2, 16, 1<<30 local turbinethink local function pfuncs(p) //fix bubble trap respawn softlock if p.LTB_bubbletrapped and not p.LTB_bubbletrap then if p.mo and p.LTB_bubbletrapped and (p.mo.flags & MF_NOGRAVITY) then p.mo.flags = $ & ~MF_NOGRAVITY end p.LTB_bubbletrapped = nil p.LTB_bubbletrap = nil end //zombie player bug caused by diying in the last 3 seconds if leveltime > starttime then if p.mo and p.mo.hitlag <= 0 and p.nocontrol <= 0 and (p.pflags & PF_FAULT) and p.respawn.state == RESPAWNST_DROP then p.pflags = $ & ~PF_FAULT p.pflags = $ & ~PF_VOID //HUH p.mo.renderflags = $ & ~RF_DONTDRAW p.mo.flags = $ & ~MF_NOCLIPTHING p.pflags = $ & ~PF_STASIS end end //any spring softlock //reset if (p.mo and not(p.mo.eflags & MFE_SPRUNG)) or not (p.mo) or (p.respawn and p.respawn.state ~= 0) then p.LTB_springlock = max(0,($ or 0) -1) end //forces respawn if p.LTB_springlock and p.LTB_springlock > 6*2 then p.bumpunstuck = 30*5 + 1 //makes player respawn p.LTB_springlock = nil end if p.mo and (p.mo.eflags & MFE_SPRUNG) then p.LTB_springlock = ($ or 0) + 2 end //bungee jump soft lock //reset if (p.mo and P_IsObjectOnGround(p.mo)) or (p.respawn and p.respawn.state ~= 0) then p.LTB_wasonbungee = nil p.LTB_oldbungeez = nil p.LTB_oldbungeeang = nil end //keep track of info if object is lost somehow if p.bungee ~= 0 then p.LTB_wasonbungee = p.bungee p.LTB_oldbungeez = p.mo.tracer.z p.LTB_oldbungeeang = p.mo.tracer.angle end //try to mimic what it would happen normally if p.LTB_wasonbungee and p.LTB_wasonbungee > 1 and p.mo and (((p.mo.eflags & MFE_VERTICALFLIP) and p.mo.z < p.LTB_oldbungeez) or (not(p.mo.eflags & MFE_VERTICALFLIP) and p.mo.z > p.LTB_oldbungeez)) then P_InstaThrust(p.mo, p.LTB_oldbungeeang, (54*mapobjectscale)/8) p.springstars = TICRATE // these are used as a buffer not to latch to vines again. p.springcolor = SKINCOLOR_EMERALD p.pflags = $ & ~PF_NOFASTFALL p.bungee = 0 p.mo.flags = $ & ~MF_NOGRAVITY p.mo.flags = $ & ~MF_NOCLIPTHING p.LTB_wasonbungee = nil end //fix for avoiding eggbomb keeping item held forever //also do not allow insta whip while in the roulete neither ready to explode if p.LTB_eggroulette or p.eggmanexplode > 0 then if p.LTB_eggroulette then p.LTB_eggroulette = max(1,$ - 1) end if (p.LTB_eggroulette and p.LTB_eggroulette <= 2) or p.eggmanexplode > 0 then p.itemflags = $ & ~IF_USERINGS //p.instawhipcharge = 2 end end //reset if p.eggmanexplode <= 0 and (p.LTB_eggroulette and p.LTB_eggroulette == 1) or not p.mo or (p.respawn and p.respawn.state ~= 0) then p.LTB_eggroulette = nil end //attempt to prevent losing places on death after race is finished //reset if leveltime <= starttime then p.LTB_validrealtime = nil end //fix it if something is wrong if p.exiting and p.LTB_validrealtime and p.realtime ~= p.LTB_validrealtime and p.mo and not p.spectator then p.realtime = p.LTB_validrealtime end if not p.exiting and p.mo and not p.spectator and p.realtime ~= INT32_MAX and p.realtime ~= 0 then p.LTB_validrealtime = p.realtime end //avoid this by not letting a real death occur //this should make sure it never happens if (p.exiting or p.spectator ) and p.markedfordeath == true then p.bumpunstuck = 30*5 + 1 //makes player respawn p.markedfordeath = false end //saves players when theyre stuck on ramps landing on it forever if p.LTB_landsftlock and p.LTB_landsftlock > 5*3 then p.bumpunstuck = 30*5 + 1 p.LTB_landsftlock = nil end //solves the softlock of landing forever in one place if p.mo and (p.mo.eflags & MFE_JUSTHITFLOOR) then p.LTB_landsftlock = ($ or 0) + 3 end if not (p.mo.eflags & MFE_JUSTHITFLOOR) or not p.mo then p.LTB_landsftlock = max(0,($ or 0) - 1) end //solves the softlock of playes stuck in sector where gravity is reversed //but not their physics so they keep going up and down in place, common on respaw if p.mo and (FixedHypot(p.mo.momx, p.mo.momy) < 10*FRACUNIT or (p.respawn and p.respawn.state == RESPAWNST_DROP)) and ((not(p.mo.eflags & MFE_VERTICALFLIP) and p.mo.subsector.sector.gravity < 0 ) or ((p.mo.eflags & MFE_VERTICALFLIP) and p.mo.subsector.sector.gravity > 0 )) then if p.mo.subsector.sector.gravity < 0 and not(p.mo.eflags & MFE_VERTICALFLIP) then p.mo.eflags = $ | MFE_VERTICALFLIP end if p.mo.subsector.sector.gravity > 0 and (p.mo.eflags & MFE_VERTICALFLIP) then p.mo.eflags = $ & ~MFE_VERTICALFLIP end end //avoid softlock if player spectates after finihsing a race if p.spectator and p.exiting and p ~= server and p.valid then P_DoPlayerExit(p,PF_NOCONTEST) end if p.LTB_walltransfersafety then //p.pflags = $ | PF_AIRFAILSAFE p.pflags = $ | PF_NOFASTFALL p.preventfailsafe = 2 p.LTB_walltransfersafety = max(0,($ or 0) - 1) end //do not allow failsafe boost neither fast falling when wall transfering, at least not THAT SOON if p and p.mo and abs(p.mo.momz) >= 2*FRACUNIT and abs(p.mo.momz) > FixedHypot(p.mo.momx,p.mo.momy) and p.LTB_lastslope and not(p.mo.eflags & MFE_SLOPELAUNCHED) and not P_IsObjectOnGround(p.mo) and p.LTB_linemoveblocked then p.LTB_walltransfersafety = 2*TICRATE end p.LTB_lastslope = p.mo and p.mo.standingslope end local function K_isPlayerInSpecialState(p) return p.rideroid or p.rdnodepull or p.bungee or p.dlzrocket or p.seasaw or p.turbine end //fix turbines not carrying grown players local TURBINE_RADIUS, TURBINE_SPIN, PR_BUBBLE = 128, 1536, 3 function turbinethink(mo) local mt = mo.spawnpoint local opt1 = mt.args[0] ~= 0 local baseheight if mt.args[2] then baseheight = mt.args[2]*FRACUNIT else baseheight = mo.z+mapobjectscale*1024 end local sneakerheight if mt.args[3] then sneakerheight = mt.args[3]*FRACUNIT else sneakerheight = mo.z+mapobjectscale*1768 end local range if mt.args[7] then range = mt.args[7]*FRACUNIT else range = FixedMul(mapobjectscale, TURBINE_RANGE) end local rotspeed if mt.args[5] then rotspeed = mt.args[5]*ANG1/10 else rotspeed = ANG1*3 end local turbinetime if mt.args[4] then turbinetime = mt.args[4] else turbinetime = TICRATE*3 end local mult if opt1 then mult = -1 else mult = 1 end mo.extravalue1 = $ + rotspeed*mult // find players in range and take their phones. for p in players.iterate do if not p or not p.mo or p.spectator or K_isPlayerInSpecialState(p) then continue end local pmo = p.mo //the issue is here, it doesnt account player radius if FixedHypot(pmo.x - mo.x,pmo.y - mo.y) < range+pmo.radius+2 and not p.turbine and p.respawn and p.respawn.state == 0 then pmo.tracer = mo p.turbine = turbinetime // to be fully honest i dont rememebr what i was on while writing this // but it originally went by mo instead of pmo for angle??? how did it ever *work* ? p.turbineangle = ANGLE_180 + R_PointToAngle2(0, 0, mo.momx, mo.momy) if not p.speed then p.turbineangle = ANGLE_180 + mo.angle end p.turbineangle = $ + ANG1*45*mult p.turbineheight = baseheight p.turbinespd = 0 if FixedDiv(p.speed, K_GetKartSpeed(p, false, false)) > FRACUNIT*2 // 200% speed and baseheight ~= sneakerheight then p.turbineheight = sneakerheight p.turbinespd = 1 end pmo.flags = $ | MF_NOCLIP end end end //fixes scholl house eggman lua error rawset(_G,"A_SlideyChase",function(actor, var1, var2) if not actor or (actor and not actor.target) then return end P_Thrust(actor, R_PointToAngle2(actor.x, actor.y, actor.target.x, actor.target.y), FixedMul(actor.info.speed*FRACUNIT/12, actor.scale)) A_FaceTarget(actor, 0, 0) end) addHook("ThinkFrame",do for p in players.iterate do pfuncs(p) end //avoid softlock when host spectates after finshing a race if netgame and server and not isdedicated and server.spectator and server.exiting then G_ExitLevel() end end) local obstacles = {MT_EGGMANITEM , MT_EGGMANITEM_SHIELD, MT_BUBBLESHIELDTRAP} for i = 1, 3 do addHook("MobjCollide",function(m1,m2) if (not m1 or not m2 or (m2 and (not m2.player or m2.player.spectator))) or (m1.z > m2.z+m2.height or m1.z+m1.height < m2.z) or ((m2.player.flamedash and m2.player.itemtype == KITEM_FLAMESHIELD) and i <= 2 ) then return end if i <= 2 then m2.player.LTB_eggroulette = 4*TICRATE + 1 if m2.player.pflags & PF_AUTOROULETTE then m2.player.LTB_eggroulette = 2*TICRATE + 1 end //in hardcode it seems that eggroulette should start sonner in auto roulette? end if i == 3 then m2.player.LTB_bubbletrapped = true m2.player.LTB_bubbletrap = m1 //if the bubble is gone the var above should too end end,obstacles[i]) end addHook("MobjThinker",function(mo) if mo and mo.valid and mo.spawnpoint and mo.spawnpoint.valid then turbinethink(mo) end end,MT_WATERPALACETURBINE) addHook("MobjMoveBlocked",function(mo, thing, line) if not (mo and mo.valid and mo.player and line and line.valid) then return end mo.player.LTB_linemoveblocked = true end,MT_PLAYER)