From b5a47ec92044eb2bb2475906b3c156709d9eccc5 Mon Sep 17 00:00:00 2001
From: DarkGod <darkgod@net-core.org>
Date: Mon, 13 Mar 2017 10:00:40 +0100
Subject: [PATCH] Terrain's "damage_project" callback now receives source
 talent, if any Pulverizing Auger (and all damage spells) now works for
 stabilizing wormholes in the Abashed Expanse

---
 game/modules/tome/data/damage_types.lua                | 5 +++--
 game/modules/tome/data/zones/abashed-expanse/grids.lua | 6 ++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/game/modules/tome/data/damage_types.lua b/game/modules/tome/data/damage_types.lua
index 7d6106b25a..622693ed7d 100644
--- a/game/modules/tome/data/damage_types.lua
+++ b/game/modules/tome/data/damage_types.lua
@@ -89,8 +89,10 @@ setDefaultProjector(function(src, x, y, type, dam, state)
 		return dam
 	end
 
+	local source_talent = src.__projecting_for and src.__projecting_for.project_type and (src.__projecting_for.project_type.talent_id or src.__projecting_for.project_type.talent) and src.getTalentFromId and src:getTalentFromId(src.__projecting_for.project_type.talent or src.__projecting_for.project_type.talent_id)
+
 	local terrain = game.level.map(x, y, Map.TERRAIN)
-	if terrain then terrain:check("damage_project", src, x, y, type, dam) end
+	if terrain then terrain:check("damage_project", src, x, y, type, dam, source_talent) end
 
 	local target = game.level.map(x, y, Map.ACTOR)
 	if target then
@@ -485,7 +487,6 @@ setDefaultProjector(function(src, x, y, type, dam, state)
 
 		print("[PROJECTOR] final dam after hooks and callbacks", dam)
 
-		local source_talent = src.__projecting_for and src.__projecting_for.project_type and (src.__projecting_for.project_type.talent_id or src.__projecting_for.project_type.talent) and src.getTalentFromId and src:getTalentFromId(src.__projecting_for.project_type.talent or src.__projecting_for.project_type.talent_id)
 		local dead
 		dead, dam = target:takeHit(dam, src, {damtype=type, source_talent=source_talent, initial_dam=initial_dam})
 
diff --git a/game/modules/tome/data/zones/abashed-expanse/grids.lua b/game/modules/tome/data/zones/abashed-expanse/grids.lua
index 3eb90ad2fc..57611d1183 100644
--- a/game/modules/tome/data/zones/abashed-expanse/grids.lua
+++ b/game/modules/tome/data/zones/abashed-expanse/grids.lua
@@ -26,8 +26,10 @@ newEntity{ base="FLOATING_ROCKS", define_as = "WORMHOLE", nice_tiler = false,
 	name = "unstable wormhole",
 	display = '*', color = colors.GREY,
 	force_clone = true,
-	damage_project = function(self, src, x, y, type, dam)
-		if type ~= engine.DamageType.PHYSICAL and game.party:hasMember(src) and not self.change_level then
+	damage_project = function(self, src, x, y, type, dam, source_talent)
+		local st = nil
+		if source_talent then st = game.player:getTalentFromId(source_talent) end
+		if st and st.is_spell and game.party:hasMember(src) and not self.change_level then
 			self.change_level = 1
 			self.name = "stable wormhole"
 			game.logSeen(src, "#VIOLET#The wormhole absorbs energies and stabilizes. You can now use it to travel.")
-- 
GitLab