From 49c3bbe58f6d95a7bb0e2376c0fa435805a18458 Mon Sep 17 00:00:00 2001 From: ChronoVortex Date: Thu, 29 Jun 2023 16:37:36 -0700 Subject: [PATCH] fixed shield collision for piercing --- data/vertex_module/tags/particleEmitters.lua | 8 ++++++-- mod-appendix/metadata.xml | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/data/vertex_module/tags/particleEmitters.lua b/data/vertex_module/tags/particleEmitters.lua index 3b73e2d..ced539d 100644 --- a/data/vertex_module/tags/particleEmitters.lua +++ b/data/vertex_module/tags/particleEmitters.lua @@ -79,8 +79,12 @@ local function logic() script.on_internal_event(Defines.InternalEvents.PROJECTILE_COLLISION, function(thisProjectile, otherProjectile, damage, response) emitter_explosion(thisProjectile) end) - script.on_internal_event(Defines.InternalEvents.SHIELD_COLLISION, function(ship, projectile, damage, response) - emitter_explosion(projectile) + script.on_internal_event(Defines.InternalEvents.SHIELD_COLLISION_PRE, function(ship, projectile, damage, response) + local shieldPower = nil + pcall(function() shieldPower = ship.shieldSystem.shields.power end) + if not shieldPower or shieldPower.super.first > 0 or shieldPower.first > damage.iShieldPiercing then + emitter_explosion(projectile) + end end) script.on_internal_event(Defines.InternalEvents.DAMAGE_AREA_HIT, function(ship, projectile, damage, response) emitter_explosion(projectile) diff --git a/mod-appendix/metadata.xml b/mod-appendix/metadata.xml index 843ab4c..e07b4dc 100644 --- a/mod-appendix/metadata.xml +++ b/mod-appendix/metadata.xml @@ -2,7 +2,7 @@ <![CDATA[ Vertex Tags and Utility Functions ]]> - +