Skip to content
Snippets Groups Projects
Commit f6920fd6 authored by dg's avatar dg
Browse files

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@3657 51575b47-30f0-44d4-a5cc-537603b46e54
parent 760a77e8
No related branches found
No related tags found
No related merge requests found
......@@ -295,12 +295,14 @@ end
-- *DO NOT TOUCH!!!*
function _M:getMapObjects(tiles, mos, z)
local i = -1
local nextz = 0
local mo, dz
repeat
i = i + 1
mo, dz = self:makeMapObject(tiles, 1+i)
if mo then
mos[dz or z+i] = mo
if dz then mos[dz] = mo
else mos[z + nextz] = mo nextz = nextz + 1 end
end
until not mo
end
......
......@@ -939,11 +939,11 @@ function _M:setupCommands()
[{"_a","ctrl"}] = function() if config.settings.cheat then game:registerDialog(require("mod.dialogs.debug.DebugMain").new()) end end,
[{"_d","ctrl"}] = function() if config.settings.cheat then
local g = game.level.map(game.player.x, game.player.y, Map.TERRAIN)
print(g.define_as, g.image)
print(g.define_as, g.image, g.z)
for i, a in ipairs(g.add_mos or {}) do print(" => ", a.image) end
local add = g.add_displays
if add then for i, e in ipairs(add) do
print(" -", e.image)
print(" -", e.image, e.z)
for i, a in ipairs(e.add_mos or {}) do print(" => ", a.image) end
end end
end end,
......
......@@ -56,7 +56,10 @@ function _M:replace(i, j, g)
end
function _M:edit(i, j, e)
self.edits[#self.edits+1] = {i, j, add_display=e.add_display, add_mos=e.add_mos, min=e.min, max=e.max}
self.edits[i] = self.edits[i] or {}
self.edits[i][j] = self.edits[i][j] or {}
local ee = self.edits[i][j]
ee[#ee+1] = {add_display=e.add_display, add_mos=e.add_mos, min=e.min, max=e.max}
end
function _M:handle(level, i, j)
......@@ -73,31 +76,35 @@ function _M:replaceAll(level)
level.map(r[1], r[2], Map.TERRAIN, r[3])
end
self.repl = {}
for i = 1, #self.edits do
local e = self.edits[i]
local g = level.map(e[1], e[2], Map.TERRAIN)
for i, jj in pairs(self.edits) do for j, ee in pairs(jj) do
local g = level.map(i, j, Map.TERRAIN)
local cloned = false
if not g.force_clone then g = g:clone() g.force_clone = true cloned = true end
if e.add_mos then
-- Edit the first add_display entity, or add a dummy if none
if not g.__edit_d then
g.add_displays = g.add_displays or {}
g.add_displays[#g.add_displays+1] = require(g.__CLASSNAME).new{image="invis.png", force_clone=true}
g.__edit_d = #g.add_displays
end
-- Add all the mos
g.add_displays[g.__edit_d].add_mos = g.add_displays[g.__edit_d].add_mos or {}
local mos = g.add_displays[g.__edit_d].add_mos
for i = 1, #e.add_mos do
mos[#mos+1] = e.add_mos[i]
mos[#mos].image = mos[#mos].image:format(rng.range(e.min, e.max))
-- Edit the first add_display entity, or add a dummy if none
if not g.__edit_d then
g.add_displays = g.add_displays or {}
g.add_displays[#g.add_displays+1] = require(g.__CLASSNAME).new{image="invis.png", force_clone=true}
g.__edit_d = #g.add_displays
end
local gd = g.add_displays[g.__edit_d]
for __, e in ipairs(ee) do
if e.add_mos then
-- Add all the mos
gd.add_mos = gd.add_mos or {}
local mos = gd.add_mos
for i = 1, #e.add_mos do
mos[#mos+1] = e.add_mos[i]
mos[#mos].image = mos[#mos].image:format(rng.range(e.min, e.max))
end
gd._mo = nil
end
g.add_displays[g.__edit_d]._mo = nil
end
g._mo = nil
level.map(e[1], e[2], Map.TERRAIN, g)
end
level.map(i, j, Map.TERRAIN, g)
end end
self.edits = {}
end
......
This diff is collapsed.
......@@ -40,7 +40,6 @@ newEntity{
name = "grass", image = "terrain/grass.png",
display = '.', color=colors.LIGHT_GREEN, back_color={r=44,g=95,b=43},
grow = "TREE",
add_displays = {class.new{image="invis.png"}},
nice_tiler = { method="replace", base={"GRASS_PATCH", 70, 1, 15}},
nice_editer = grass_editer,
}
......
......@@ -25,7 +25,7 @@ stopx = 1
stopy = 29
-- defineTile section
defineTile("#", "HARD_BIGWALL")
defineTile("#", "HARDWALL")
defineTile("F", "CFARPORTAL")
defineTile("h", "OLD_FLOOR", nil, "WEIRDLING_BEAST")
defineTile("G", "GREEN_DRAPPING")
......
......@@ -38,13 +38,6 @@ newEntity{
does_block_move = true,
}
newEntity{ base = "HARDWALL",
define_as = "HARD_BIGWALL",
block_sense = true,
block_esp = true,
dig = false,
}
newEntity{
define_as = "TELEPORT_OUT",
name = "teleportation circle to the surface", image = "terrain/maze_floor.png", add_displays = {class.new{image="terrain/maze_teleport.png"}},
......@@ -68,11 +61,11 @@ newEntity{
end,
}
newEntity{ base = "HARD_BIGWALL",
newEntity{ base = "HARDWALL",
define_as = "GREEN_DRAPPING",
add_displays = {class.new{image="terrain/green_drapping.png"}},
}
newEntity{ base = "HARD_BIGWALL",
newEntity{ base = "HARDWALL",
define_as = "PURPLE_DRAPPING",
add_displays = {class.new{image="terrain/purple_drapping.png"}},
}
......
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