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

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@3961 51575b47-30f0-44d4-a5cc-537603b46e54
parent 2f3041e2
No related branches found
No related tags found
No related merge requests found
......@@ -68,13 +68,13 @@ end
--- Adds an entity to the level
-- Only entities that need to act need to be added. Terrain features do not need this usually
function _M:addEntity(e, after)
function _M:addEntity(e, after, no_error)
if e._fake_level_entity then
e._fake_level_entity(self, "add", after)
return
end
if self.entities[e.uid] then error("Entity "..e.uid.."("..e.name..") already present on the level") end
if self.entities[e.uid] then if no_error then return else error("Entity "..e.uid.."("..e.name..") already present on the level") end end
self.entities[e.uid] = e
if e.addEntityOrder then after = e:addEntityOrder(level) end
if not after or not self:hasEntity(after) then
......
......@@ -480,7 +480,7 @@ function _M:addEntity(level, e, typ, x, y, no_added)
e.x = nil
e.y = nil
if x and y then e:move(x, y, true) end
level:addEntity(e)
level:addEntity(e, nil, true)
if not no_added then e:added() end
-- Levelup ?
if self.actor_adjust_level and e.forceLevelup then
......@@ -492,8 +492,8 @@ function _M:addEntity(level, e, typ, x, y, no_added)
e.x = nil
e.y = nil
if x and y then e:move(x, y, true) end
if e.src then level:addEntity(e, e.src)
else level:addEntity(e) end
if e.src then level:addEntity(e, e.src, true)
else level:addEntity(e, nil, true) end
if not no_added then e:added() end
elseif typ == "object" then
if x and y then level.map:addObject(x, y, e) 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