local FRACUNIT = FRACUNIT local PST_LIVE = PST_LIVE local playersforexit = CV_FindVar("playersforexit") local hurry_players local metalsonicdefeated local playersforexittable = {1, FRACUNIT/4, FRACUNIT/2, FRACUNIT*3/4, FRACUNIT} local hurrytable = {FRACUNIT*3/4, 1, FRACUNIT/2, FRACUNIT/3, FRACUNIT/4, FRACUNIT*2/3} addHook("MapChange", function(mapnum) metalsonicdefeated = false end) addHook("MobjDeath", function(mo) metalsonicdefeated = true end, MT_METALSONIC_BATTLE) addHook("NetVars", function(net) metalsonicdefeated = net($) end) addHook("ThinkFrame", do if not (multiplayer and gamemap == 26 and metalsonicdefeated) then return end hurry_players = $ or CV_FindVar("hurry_players") local finishnumber = hurry_players and hurrytable[hurry_players.value+1] or playersforexittable[playersforexit.value+1] local playercount = 0 local readycount = 0 for p in players.iterate local mo = p.mo if not (mo and mo.valid) then continue end playercount = $+1 local sector = #mo.subsector.sector if sector == 111 or (sector == 113 and mo.z < -1920*FRACUNIT) readycount = $+1 end end if readycount and playercount and readycount*FRACUNIT/playercount >= finishnumber for p in players.iterate local mo = p.mo if not (mo and mo.valid) then continue end if p.playerstate ~= PST_LIVE G_DoReborn(#p) continue end local sector = #mo.subsector.sector if not (sector == 111 or (sector == 113 and mo.z < -1920*FRACUNIT)) P_MoveOrigin(mo, -14080*FRACUNIT, 1728*FRACUNIT, -1920*FRACUNIT) end P_ResetPlayer(p) end end end)