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

Fixed duplicate artifacts (hopefully, please keep an eye open for them)

git-svn-id: http://svn.net-core.org/repos/t-engine4@2171 51575b47-30f0-44d4-a5cc-537603b46e54
parent ab73b6af
No related branches found
No related tags found
No related merge requests found
......@@ -317,8 +317,8 @@ end
-- This helps ensuring uniqueness of uniques
function _M:added()
if self.unique then
game.uniques[self.__CLASSNAME.."/"..self.unique] = true
print("Added unique", self.__CLASSNAME.."/"..self.unique)
game.uniques[self.__CLASSNAME.."/"..self.unique] = (game.uniques[self.__CLASSNAME.."/"..self.unique] or 0) + 1
print("Added unique", self.__CLASSNAME.."/"..self.unique, "::", game.uniques[self.__CLASSNAME.."/"..self.unique])
end
end
......@@ -335,8 +335,9 @@ function _M:removed()
end
if self.unique then
game.uniques[self.__CLASSNAME.."/"..self.unique] = nil
print("Removed unique", self.__CLASSNAME.."/"..self.unique)
game.uniques[self.__CLASSNAME.."/"..self.unique] = (game.uniques[self.__CLASSNAME.."/"..self.unique] or 0) - 1
if game.uniques[self.__CLASSNAME.."/"..self.unique] <= 0 then game.uniques[self.__CLASSNAME.."/"..self.unique] = nil end
print("Removed unique", self.__CLASSNAME.."/"..self.unique, "::", game.uniques[self.__CLASSNAME.."/"..self.unique])
end
end
......
......@@ -67,4 +67,5 @@ function _M:roomMapAddEntity(i, j, type, e)
self.map.room_map[i][j].add_entities = self.map.room_map[i][j].add_entities or {}
local rm = self.map.room_map[i][j].add_entities
rm[#rm+1] = {type, e}
e:added() -- we do it here to make sure uniques are uniques
end
......@@ -386,14 +386,14 @@ end
-- @param typ the type of entity, one of "actor", "object", "trap" or "terrain"
-- @param x the coordinates where to add it. This CAN be null in which case it wont be added to the map
-- @param y the coordinates where to add it. This CAN be null in which case it wont be added to the map
function _M:addEntity(level, e, typ, x, y)
function _M:addEntity(level, e, typ, x, y, no_added)
if typ == "actor" then
-- We are additing it, this means there is no old position
e.x = nil
e.y = nil
if x and y then e:move(x, y, true) end
level:addEntity(e)
e:added()
if not no_added then e:added() end
-- Levelup ?
if self.actor_adjust_level and e.forceLevelup then
local newlevel = self:actor_adjust_level(level, e)
......@@ -406,13 +406,13 @@ function _M:addEntity(level, e, typ, x, y)
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
e:added()
if not no_added then e:added() end
elseif typ == "object" then
if x and y then level.map:addObject(x, y, e) end
e:added()
if not no_added then e:added() end
elseif typ == "trap" then
if x and y then level.map(x, y, Map.TRAP, e) end
e:added()
if not no_added then e:added() end
elseif typ == "terrain" or typ == "grid" then
if x and y then level.map(x, y, Map.TERRAIN, e) end
end
......@@ -591,7 +591,7 @@ function _M:newLevel(level_data, lev, old_lev, game)
if map.room_map[i] and map.room_map[i][j] and map.room_map[i][j].add_entities then
for z = 1, #map.room_map[i][j].add_entities do
local ae = map.room_map[i][j].add_entities[z]
self:addEntity(level, ae[2], ae[1], i, j)
self:addEntity(level, ae[2], ae[1], i, j, true)
end
end
end end
......
......@@ -179,7 +179,7 @@ newEntity{ base = "BASE_RING",
material_level = 3,
wielder = {
inc_stats = { [Stats.STAT_CUN] = 3, },
inc_stats = { [Stats.STAT_CUN] = 3,[Stats.STAT_CUN] = 3, },
inc_damage = {
[DamageType.ARCANE] = 10,
[DamageType.FIRE] = 10,
......
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