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

Fixed a duplicate actor bug on talent change

git-svn-id: http://svn.net-core.org/repos/t-engine4@5231 51575b47-30f0-44d4-a5cc-537603b46e54
parent 8d6acd4a
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,10 @@ function _M:init(level, map) ...@@ -36,6 +36,10 @@ function _M:init(level, map)
self.data = {} self.data = {}
end end
function _M:onSaving()
self.last_iteration = nil
end
--- Adds a sublevel --- Adds a sublevel
function _M:addSublevel(name, level) function _M:addSublevel(name, level)
if self.sublevels[name] then error("Sublevel already exists: "..name) end if self.sublevels[name] then error("Sublevel already exists: "..name) end
......
...@@ -103,6 +103,7 @@ function _M:saveObject(obj, zip) ...@@ -103,6 +103,7 @@ function _M:saveObject(obj, zip)
while #self.process > 0 do while #self.process > 0 do
local tbl = table.remove(self.process) local tbl = table.remove(self.process)
self.tables[tbl] = self:getFileName(tbl) self.tables[tbl] = self:getFileName(tbl)
if tbl.onSaving then tbl:onSaving() end
tbl:save() tbl:save()
savefile_pipe.current_nb = savefile_pipe.current_nb + 1 savefile_pipe.current_nb = savefile_pipe.current_nb + 1
processed = processed + 1 processed = processed + 1
......
...@@ -2716,7 +2716,7 @@ end ...@@ -2716,7 +2716,7 @@ end
--- Actor forgets a talent --- Actor forgets a talent
-- @param t_id the id of the talent to learn -- @param t_id the id of the talent to learn
-- @return true if the talent was unlearnt, nil and an error message otherwise -- @return true if the talent was unlearnt, nil and an error message otherwise
function _M:unlearnTalent(t_id, nb) function _M:unlearnTalent(t_id, nb, no_unsustain)
if not engine.interface.ActorTalents.unlearnTalent(self, t_id, nb) then return false end if not engine.interface.ActorTalents.unlearnTalent(self, t_id, nb) then return false end
local t = _M.talents_def[t_id] local t = _M.talents_def[t_id]
...@@ -2736,7 +2736,7 @@ function _M:unlearnTalent(t_id, nb) ...@@ -2736,7 +2736,7 @@ function _M:unlearnTalent(t_id, nb)
end end
-- Unsustain ? -- Unsustain ?
if not self:knowTalent(t_id) and t.mode == "sustained" and self:isTalentActive(t_id) then self:forceUseTalent(t_id, {ignore_energy=true}) end if not no_unsustain and not self:knowTalent(t_id) and t.mode == "sustained" and self:isTalentActive(t_id) then self:forceUseTalent(t_id, {ignore_energy=true}) end
return true return true
end end
......
...@@ -279,6 +279,14 @@ function _M:act() ...@@ -279,6 +279,14 @@ function _M:act()
end end
end end
function _M:tooltip(x, y, seen_by)
local str = mod.class.Actor.tooltip(self, x, y, seen_by)
if not str then return end
if config.settings.cheat then str:add(true, "UID: "..self.uid, true, self.image) end
return str
end
--- Funky shader stuff --- Funky shader stuff
function _M:updateMainShader() function _M:updateMainShader()
if game.fbo_shader then if game.fbo_shader then
......
...@@ -240,6 +240,7 @@ newTalent{ ...@@ -240,6 +240,7 @@ newTalent{
m.on_acquire_target = nil m.on_acquire_target = nil
m.seen_by = nil m.seen_by = nil
m.can_talk = nil m.can_talk = nil
m.exp_worth = 0
m.clone_on_hit = nil m.clone_on_hit = nil
if m.talents.T_SUMMON then m.talents.T_SUMMON = nil end if m.talents.T_SUMMON then m.talents.T_SUMMON = nil end
if m.talents.T_MULTIPLY then m.talents.T_MULTIPLY = nil end if m.talents.T_MULTIPLY then m.talents.T_MULTIPLY = nil end
......
...@@ -148,6 +148,7 @@ newTalent{ ...@@ -148,6 +148,7 @@ newTalent{
m.on_takehit = nil m.on_takehit = nil
m.can_talk = nil m.can_talk = nil
m.clone_on_hit = nil m.clone_on_hit = nil
m.exp_worth = 0
m.no_inventory_access = true m.no_inventory_access = true
m.stealth = t.getStealthPower(self, t) m.stealth = t.getStealthPower(self, t)
for i = 1, 10 do for i = 1, 10 do
......
...@@ -205,6 +205,7 @@ newTalent{ ...@@ -205,6 +205,7 @@ newTalent{
m.seen_by = nil m.seen_by = nil
m.can_talk = nil m.can_talk = nil
m.on_takehit = nil m.on_takehit = nil
m.exp_worth = 0
m.no_inventory_access = true m.no_inventory_access = true
m.clone_on_hit = nil m.clone_on_hit = nil
m.talents.T_CREATE_MINIONS = nil m.talents.T_CREATE_MINIONS = nil
......
...@@ -63,6 +63,7 @@ function _M:init(actor, on_finish, on_birth) ...@@ -63,6 +63,7 @@ function _M:init(actor, on_finish, on_birth)
self.actor.__increased_talent_types = self.actor.__increased_talent_types or {} self.actor.__increased_talent_types = self.actor.__increased_talent_types or {}
self.actor_dup = actor:clone() self.actor_dup = actor:clone()
self.actor_dup.uid = actor.uid -- Yes ...
for _, v in pairs(game.engine.Birther.birth_descriptor_def) do for _, v in pairs(game.engine.Birther.birth_descriptor_def) do
if v.type == "subclass" and v.name == actor.descriptor.subclass then self.desc_def = v break end if v.type == "subclass" and v.name == actor.descriptor.subclass then self.desc_def = v break end
...@@ -369,7 +370,9 @@ function _M:cancel() ...@@ -369,7 +370,9 @@ function _M:cancel()
self.actor.last_learnt_talents = self.actor_dup.last_learnt_talents self.actor.last_learnt_talents = self.actor_dup.last_learnt_talents
]] ]]
local ax, ay = self.actor.x, self.actor.y local ax, ay = self.actor.x, self.actor.y
self.actor_dup.replacedWith = false
self.actor:replaceWith(self.actor_dup) self.actor:replaceWith(self.actor_dup)
self.actor.replacedWith = nil
self.actor.x, self.actor.y = ax, ay self.actor.x, self.actor.y = ax, ay
self.actor.changed = true self.actor.changed = true
self.actor:removeAllMOs() self.actor:removeAllMOs()
...@@ -470,7 +473,7 @@ function _M:finish() ...@@ -470,7 +473,7 @@ function _M:finish()
for tid, act in pairs(self.actor.sustain_talents) do for tid, act in pairs(self.actor.sustain_talents) do
if act then if act then
local t = self.actor:getTalentFromId(tid) local t = self.actor:getTalentFromId(tid)
if t.no_sustain_autoreset then if t.no_sustain_autoreset and self.actor:knowTalent(tid) then
talents = talents.."#GOLD# - "..t.name.."#LAST#\n" talents = talents.."#GOLD# - "..t.name.."#LAST#\n"
else else
reset[#reset+1] = tid reset[#reset+1] = tid
...@@ -715,7 +718,7 @@ function _M:learnTalent(t_id, v) ...@@ -715,7 +718,7 @@ function _M:learnTalent(t_id, v)
self:simplePopup("Impossible", "You cannot unlearn talents!") self:simplePopup("Impossible", "You cannot unlearn talents!")
return return
end end
self.actor:unlearnTalent(t_id) self.actor:unlearnTalent(t_id, nil, true)
self.talents_changed[t_id] = true self.talents_changed[t_id] = true
local _, reason = self.actor:canLearnTalent(t, 0) local _, reason = self.actor:canLearnTalent(t, 0)
local ok, dep_miss, stats_ok = self:checkDeps() local ok, dep_miss, stats_ok = self:checkDeps()
...@@ -757,7 +760,7 @@ function _M:learnTalent(t_id, v) ...@@ -757,7 +760,7 @@ function _M:learnTalent(t_id, v)
self:simplePopup("Impossible", "You cannot unlearn talents!") self:simplePopup("Impossible", "You cannot unlearn talents!")
return return
end end
self.actor:unlearnTalent(t_id) self.actor:unlearnTalent(t_id, nil, true)
self.talents_changed[t_id] = true self.talents_changed[t_id] = true
local _, reason = self.actor:canLearnTalent(t, 0) local _, reason = self.actor:canLearnTalent(t, 0)
local ok, dep_miss, stats_ok = self:checkDeps() local ok, dep_miss, stats_ok = self:checkDeps()
......
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