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

Detect and remove player clones automatically

git-svn-id: http://svn.net-core.org/repos/t-engine4@5240 51575b47-30f0-44d4-a5cc-537603b46e54
parent 3a2a82ca
No related branches found
No related tags found
No related merge requests found
......@@ -879,6 +879,16 @@ function _M:changeLevel(lev, zone, params)
end
if popup then popup:done() end
self:dieClonesDie()
end
function _M:dieClonesDie()
if not self.level then return end
local p = self:getPlayer(true)
for uid, e in pairs(self.level.entities) do
if p.puuid == e.puuid and e ~= p then self.level:removeEntity(e) end
end
end
function _M:getPlayer(main)
......@@ -1045,6 +1055,9 @@ function _M:onTurn()
self.log(self.calendar:getTimeDate(self.turn))
self.day_of_year = self.calendar:getDayOfYear(self.turn)
end
if self.turn % 500 ~= 0 then return end
self:dieClonesDie()
end
function _M:updateFOV()
......
......@@ -90,6 +90,7 @@ function _M:init(t, no_default)
self.descriptor = self.descriptor or {}
self.died_times = self.died_times or {}
self.last_learnt_talents = self.last_learnt_talents or { class={}, generic={} }
self.puuid = self.puuid or util.uuid()
end
function _M:onBirth(birther)
......
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