Commit 44ecaf784d12c89a937212bc9b8d76653c5b6115

Authored by DarkGod
2 parents dac2504b 1874d9a9

Merge branch 'fix_on_added_to_level' into 'master'

fix on_added_to_level not triggerred in special cases

sometimes we see random alchemists without golems, now we found why

See merge request !777
... ... @@ -986,6 +986,11 @@ function resolvers.calc.talented_ai_tactic(t, e)
986 986 for k, v in pairs(e.ai_tactic) do
987 987 if type(v) == "number" and v > 0 then
988 988 print("running talented_ai_tactic resolver but aborting due to existing tactics")
  989 + local t = e.__ai_tactic_resolver
  990 + if t and t.old_on_added_to_level then
  991 + t.old_on_added_to_level(e, level, x, y)
  992 + t.old_on_added_to_level = nil
  993 + end
989 994 return
990 995 end
991 996 end
... ... @@ -995,7 +1000,10 @@ function resolvers.calc.talented_ai_tactic(t, e)
995 1000 local t = e.__ai_tactic_resolver
996 1001 if not t then print("talented_ai_tactic: No resolver table. Aborting") return end
997 1002 e.__ai_tactic_resolver = nil
998   - if t.old_on_added_to_level then t.old_on_added_to_level(e, level, x, y) end
  1003 + if t.old_on_added_to_level then
  1004 + t.old_on_added_to_level(e, level, x, y)
  1005 + t.old_on_added_to_level = nil
  1006 + end
999 1007
1000 1008 if type(t[1]) == "function" then
1001 1009 print("running talented_ai_tactic resolver custom function from on_added_to_level")
... ...