mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 20:20:33 +01:00
[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:
co-authored by
Comxy
Gandalf
parent
e07ce00128
commit
88f8ef7adc
@@ -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)
|
||||
Reference in New Issue
Block a user