Commit f75f4b0ee361a8e6353118e99de7d5a78100a30e

Authored by Ryan Yappert
1 parent 3a06daa0

Makes objects know what inventory they're in.

@@ -313,6 +313,8 @@ function _M:onAddObject(o, inven_id, item) @@ -313,6 +313,8 @@ function _M:onAddObject(o, inven_id, item)
313 end 313 end
314 end 314 end
315 end 315 end
  316 +
  317 + o.in_inven = {actor = self, id = inven_id}
316 end 318 end
317 319
318 --- Called upon removing an object 320 --- Called upon removing an object
@@ -323,6 +325,7 @@ function _M:onRemoveObject(o, inven_id, item) @@ -323,6 +325,7 @@ function _M:onRemoveObject(o, inven_id, item)
323 end 325 end
324 end 326 end
325 o.carried = nil 327 o.carried = nil
  328 + o.in_inven = nil
326 end 329 end
327 330
328 --- Called upon dropping an object 331 --- Called upon dropping an object
@@ -68,8 +68,9 @@ It is said the Conclave created this weapon for their warmaster during the dark @@ -68,8 +68,9 @@ It is said the Conclave created this weapon for their warmaster during the dark
68 local Map = require "engine.Map" 68 local Map = require "engine.Map"
69 69
70 -- special_on_hit doesn't know what item triggered it, so find it 70 -- special_on_hit doesn't know what item triggered it, so find it
71 - local self, item, inven_id = who:findInAllInventoriesBy("define_as", "LONGSWORD_WINTERTIDE")  
72 - if not self or not who:getInven(inven_id).worn then return end 71 + local self = combat.self
  72 + local inven_id = self and self.in_inven and self.in_inven.id
  73 + if not self or not inven_id or not who:getInven(inven_id).worn then return end
73 74
74 if who.turn_procs.wintertide_sword then return end 75 if who.turn_procs.wintertide_sword then return end
75 76