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

Fixed duplicate uniques

git-svn-id: http://svn.net-core.org/repos/t-engine4@2315 51575b47-30f0-44d4-a5cc-537603b46e54
parent 8aca9043
No related branches found
No related tags found
No related merge requests found
......@@ -252,8 +252,13 @@ function _M:makeEntity(level, type, filter, force_level, prob_filter)
-- No filter
else
local list = level:getEntitiesList(type)
e = self:pickEntity(list)
if not e then return nil end
local tries = filter and filter.nb_tries or 50 -- A little crude here too but we only check 50 times, this is simply to prevent duplicate uniques
while tries > 0 do
e = self:pickEntity(list)
if e and self:checkFilter(e, nil) then break end
tries = tries - 1
end
if tries == 0 then return nil end
end
if filter then e.force_ego = filter.force_ego 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