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

Returning from the Eidolon plane now tries evry hard to place you on the map

git-svn-id: http://svn.net-core.org/repos/t-engine4@3044 51575b47-30f0-44d4-a5cc-537603b46e54
parent 07af0420
No related branches found
No related tags found
No related merge requests found
......@@ -96,7 +96,17 @@ return {
for _, act in ipairs(acts) do
local x, y = util.findFreeGrid(oldlevel.data.eidolon_exit_x or 1, oldlevel.data.eidolon_exit_y or 1, 20, true, {[engine.Map.ACTOR]=true})
if not x then
x, y = rng.range(0, game.level.map.w - 1), rng.range(0, game.level.map.h - 1)
local tries = 0
while not act:canMove(x, y) and tries < 100 do
x, y = rng.range(0, game.level.map.w - 1), rng.range(0, game.level.map.h - 1)
tries = tries + 1
end
if tries >= 100 then x = nil end
end
if x then
act.x, act.y = nil, nil
level:addEntity(act)
act:move(x, y, true)
act.changed = true
......
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