Commit 007d575d34234ef8b8c05e7f2920c57cefe86046
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
Showing
1 changed file
with
8 additions
and
0 deletions
... | ... | @@ -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} | ... | ... |
-
Please register or login to post a comment