[MIRROR] Netherworld Mobs Refractor [MDB IGNORE] (#19181)

* Netherworld Mobs Refractor

* Update statues.dm

* Update tgstation.dme

* w

---------

Co-authored-by: Comxy <tijntensen@gmail.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-03-10 02:44:53 +00:00
committed by GitHub
co-authored by Comxy Gandalf
parent e07ce00128
commit 88f8ef7adc
26 changed files with 618 additions and 390 deletions
+25
View File
@@ -0,0 +1,25 @@
/**
* Attached to a mob so it can change or do actions based on the fact it got attacked.
*/
/datum/component/damage_buffs
/// Callback to a mob for health changes
var/datum/callback/health_callback
/datum/component/damage_buffs/Initialize(datum/callback/health_callback)
if(!ismob(parent))
return ELEMENT_INCOMPATIBLE
src.health_callback = health_callback
parent.AddElement(/datum/element/relay_attackers)
/datum/component/damage_buffs/RegisterWithParent()
RegisterSignal(parent, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_attacked))
/datum/component/damage_buffs/UnregisterFromParent()
UnregisterSignal(parent, COMSIG_ATOM_WAS_ATTACKED)
/// Add an attacking atom to a blackboard list of things which attacked us
/datum/component/damage_buffs/proc/on_attacked(mob/victim, atom/attacker)
SIGNAL_HANDLER
health_callback?.InvokeAsync(attacker)