Commit 007d575d34234ef8b8c05e7f2920c57cefe86046

Authored by DarkGod
2 parents 69c48d66 2b5a137b

Merge branch 'combat_table_updates' into 'master'

Makes combat tables for items refer back to their source item.

Adds a `self` property to `o.combat` and `o.special_combat` that refers back to item's full table. Combat tables tend to get passed around through various functions and callbacks and it can be difficult to connect a combat table to a full object. This makes the link two-way (`o.combat.self == o`).

This doesn't break saves, but any functionality dependent on the link *will* require a new save, as it only applies to newly generated items.

See merge request !693
... ... @@ -732,6 +732,14 @@ function _M:finishEntity(level, type, e, ego_filter)
732 732 for i = 1, #s do e:stack(s[i], true) end
733 733 end
734 734
  735 + -- Add self-referential property to combat tables
  736 + if e.combat then
  737 + e.combat.self = e
  738 + end
  739 + if e.special_combat then
  740 + e.special_combat.self = e
  741 + end
  742 +
735 743 e:resolve(nil, true)
736 744 e:check("finish", e, self, level)
737 745 self:triggerHook{"Zone:finishEntity", type=type, e=e}
... ...