Skip to content
Snippets Groups Projects
Commit 89394e70 authored by DarkGod's avatar DarkGod
Browse files

Fixed challenges sometimes auto-failing or auto-succeeding in the Infinite Dungeon

parent 7a7b2f9b
No related branches found
No related tags found
No related merge requests found
......@@ -1076,6 +1076,18 @@ function _M:newLevel(level_data, lev, old_lev, game)
end
end
if not self.__frelltest then
forceprint("-------------------------------------------------")
forceprint("-------------------------------------------------")
forceprint("-------------------------------------------------")
forceprint("REGEN")
forceprint("-------------------------------------------------")
forceprint("-------------------------------------------------")
forceprint("-------------------------------------------------")
self.__frelltest = true
return self:newLevel(level_data, lev, old_lev, game)
end
-- Check for connectivity from entrance to exit
local a = Astar.new(map, game:getPlayer())
if not level_data.no_level_connectivity then
......@@ -1107,6 +1119,9 @@ function _M:newLevel(level_data, lev, old_lev, game)
-- Delete the room_map if it's no longer needed
if not self._retain_level_room_map then map.room_map = nil end
-- Call a "post" finisher
if level_data.post_process_end then level_data.post_process_end(level, self) end
return level
end
......
......@@ -358,8 +358,6 @@ return {
level.data.effects = {effid}
end
game.state:infiniteDungeonChallengeFinish(zone, level)
if config.settings.cheat then -- gather statistics
local block_count = 0
for i = 0, level.map.w - 1 do for j = 0, level.map.h - 1 do
......@@ -369,5 +367,10 @@ return {
print(("[Infinite Dungeon] Open space calculation: (%s, %s, %dw x %dh) space -- (open:%2.1f%%, closed:%2.1f%%)"):format(level.data.id_layout_name, level.data.id_grids_name, level.map.w, level.map.h, open, closed))
end
end,
post_process_end = function(level, zone)
-- We delay it because at "post_process" the map can STILL decide to regenerate
-- and if it does, it's a new level and challenge is considered auto failed (or auto success heh)
game.state:infiniteDungeonChallengeFinish(zone, level)
end,
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment