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

Maybe fix quake ..

git-svn-id: http://svn.net-core.org/repos/t-engine4@1241 51575b47-30f0-44d4-a5cc-537603b46e54
parent 9d4f670b
No related branches found
No related tags found
No related merge requests found
...@@ -331,25 +331,23 @@ end ...@@ -331,25 +331,23 @@ end
--- Quake a zone --- Quake a zone
-- Moves randomly each grid to an other grid -- Moves randomly each grid to an other grid
function _M:doQuake(tg, x, y) function _M:doQuake(tg, x, y)
local w = game.level.map.w
local locs = {} local locs = {}
local ms = {} local ms = {}
self:project(tg, x, y, function(tx, ty) self:project(tg, x, y, function(tx, ty)
locs[#locs+1] = {x=tx,y=ty} locs[#locs+1] = {x=tx,y=ty}
ms[#ms+1] = game.level.map.map[tx + ty * game.level.map.w] ms[#ms+1] = {map=game.level.map.map[tx + ty * w], attrs=game.level.map.attrs[tx + ty * w]}
end) end)
while #locs > 0 do while #locs > 0 do
local l = rng.tableRemove(locs) local l = rng.tableRemove(locs)
local m = rng.tableRemove(ms) local m = rng.tableRemove(ms)
for k, e in pairs(m) do
-- Update it manually game.level.map.map[l.x + l.y * w] = m.map
if not e.x and not e.y then game.level.map.attrs[l.x + l.y * w] = m.attrs
game.level.map(l.x, l.y, k, e) for z, e in pairs(m.map) do
if e.x and e.y then e.x, e.ly = l.x, l.y end if e.move then
-- If it can move, move it e.x = nil e.y = nil e:move(l.x, l.y, true)
elseif e.x and e.y and e.move then
e.x = nil e.y = nil
e:move(l.x, l.y, true)
end end
end end
end 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