Commit ec06db1473976390b3ac270bec419d6f4298c25e
1 parent
abc3b004
new debug option to force a full regeneration of current zone/level
Showing
2 changed files
with
45 additions
and
0 deletions
... | ... | @@ -175,6 +175,7 @@ function _M:generateList() |
175 | 175 | list[#list+1] = {name="Weakdamage", action="weakdamage"} |
176 | 176 | list[#list+1] = {name="Spawn Event", dialog="SpawnEvent"} |
177 | 177 | list[#list+1] = {name="Endgamify", class="Endgamify"} |
178 | + list[#list+1] = {name="Reload/regenerate Zone and level", class="ReloadZone"} | |
178 | 179 | list[#list+1] = {name="Automatically Clear Zones", class="AdvanceZones"} |
179 | 180 | self:triggerHook{"DebugMain:generate", menu=list} |
180 | 181 | ... | ... |
1 | +-- ToME - Tales of Maj'Eyal | |
2 | +-- Copyright (C) 2009 - 2018 Nicolas Casalini | |
3 | +-- | |
4 | +-- This program is free software: you can redistribute it and/or modify | |
5 | +-- it under the terms of the GNU General Public License as published by | |
6 | +-- the Free Software Foundation, either version 3 of the License, or | |
7 | +-- (at your option) any later version. | |
8 | +-- | |
9 | +-- This program is distributed in the hope that it will be useful, | |
10 | +-- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | +-- GNU General Public License for more details. | |
13 | +-- | |
14 | +-- You should have received a copy of the GNU General Public License | |
15 | +-- along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | +-- | |
17 | +-- Nicolas Casalini "DarkGod" | |
18 | +-- darkgod@te4.org | |
19 | + | |
20 | +require "engine.class" | |
21 | +require "engine.ui.Dialog" | |
22 | +local Zone = require "engine.Zone" | |
23 | +local Savefile = require "engine.Savefile" | |
24 | + | |
25 | +module(..., package.seeall, class.make) | |
26 | + | |
27 | +function _M:run() | |
28 | + local zname, llevel = game.zone.short_name, game.level.level | |
29 | + local zid = Savefile:nameLoadZone(zname) | |
30 | + local lid = Savefile:nameLoadLevel(zname, llevel) | |
31 | + | |
32 | + -- Delete the files to force a regen by the Zone class | |
33 | + local save = Savefile.new(game.save_name) | |
34 | + fs.delete(save.save_dir..zid) | |
35 | + fs.delete(save.save_dir..lid) | |
36 | + | |
37 | + -- Delete from memory cache | |
38 | + Zone:removeLastPersistZone(zname) | |
39 | + | |
40 | + -- Now fake entering | |
41 | + game.zone = nil | |
42 | + game.level = nil | |
43 | + game:changeLevelReal(llevel, zname, {}) | |
44 | +end | ... | ... |
-
Please register or login to post a comment