Most compoennts/elements that register COMSIG_PROJECTILE_ON_HIT can now be applied to turrets and projectile spells (#68238)

expands elements that register COMSIG_PROJECTILE_ON_HIT
This commit is contained in:
Y0SH1M4S73R
2022-07-15 23:59:36 -07:00
committed by GitHub
parent 8ec444f191
commit 111b1ffe01
12 changed files with 47 additions and 22 deletions
+3 -3
View File
@@ -4,7 +4,7 @@
var/override_projectile_range
/datum/component/mirv/Initialize(projectile_type, radius=1, override_projectile_range)
if(!isgun(parent) && !ismachinery(parent) && !isstructure(parent) && !isgrenade(parent))
if(!isgun(parent) && !ismachinery(parent) && !isstructure(parent) && !isgrenade(parent) && !isprojectilespell(parent))
return COMPONENT_INCOMPATIBLE
src.projectile_type = projectile_type
@@ -15,13 +15,13 @@
parent.AddComponent(/datum/component/pellet_cloud, projectile_type=projectile_type)
/datum/component/mirv/RegisterWithParent()
if(ismachinery(parent) || isstructure(parent) || isgun(parent)) // turrets, etc
if(ismachinery(parent) || isstructure(parent) || isgun(parent) || isprojectilespell(parent)) // turrets, etc
RegisterSignal(parent, COMSIG_PROJECTILE_ON_HIT, .proc/projectile_hit)
/datum/component/mirv/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_PROJECTILE_ON_HIT))
/datum/component/mirv/proc/projectile_hit(atom/fired_from, atom/movable/firer, atom/target, Angle)
/datum/component/mirv/proc/projectile_hit(datum/fired_from, atom/movable/firer, atom/target, Angle)
SIGNAL_HANDLER
INVOKE_ASYNC(src, .proc/do_shrapnel, firer, target)