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

Fixed long load times when loading a populated level

git-svn-id: http://svn.net-core.org/repos/t-engine4@3200 51575b47-30f0-44d4-a5cc-537603b46e54
parent 03deafb2
No related branches found
No related tags found
No related merge requests found
......@@ -565,11 +565,9 @@ function _M:changeLevel(lev, zone, keep_old_lev, force_down)
-- Re add entities
self.level:addEntity(self.player)
self.player.last_act_turn = math.floor(self.turn / (self.zone.wilderness and 1000 or 10))
if self.to_re_add_actors and not self.zone.wilderness then
for act, _ in pairs(self.to_re_add_actors) do
self.level:addEntity(act)
act.last_act_turn = math.floor(self.turn / (self.zone.wilderness and 1000 or 10))
act:setTarget(nil)
if act.ai_state and act.ai_state.tactic_leash_anchor then
act.ai_state.tactic_leash_anchor = game.player
......@@ -584,6 +582,11 @@ function _M:changeLevel(lev, zone, keep_old_lev, force_down)
self.player:onEnterLevel(self.zone, self.level)
-- All entities on the level remember acting not long ago, this prevents long "update" time upon re-entry
for uid, act in pairs(self.level.entities) do
act.last_act_turn = math.floor(self.turn / (self.zone.wilderness and 1000 or 10))
end
if self.level.data.ambient_music then
if self.level.data.ambient_music ~= "last" then
self:playMusic(self.level.data.ambient_music)
......
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