mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 22:50:26 +01:00
[MIRROR] Move death(), gib(), and dust() from /mob to /mob/living (#1634)
* Move death(), gib(), and dust() from /mob to /mob/living * a Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com> Co-authored-by: Azarak <azarak10@gmail.com>
This commit is contained in:
co-authored by
Jared-Fogle
Azarak
parent
a144a5e9e2
commit
2ff5f9b259
@@ -53,35 +53,34 @@
|
||||
icon_state = "disintegrate"
|
||||
inhand_icon_state = "disintegrate"
|
||||
|
||||
/obj/item/melee/touch_attack/disintegrate/afterattack(atom/target, mob/living/carbon/user, proximity)
|
||||
if(!proximity || target == user || !ismob(target) || !iscarbon(user) || !(user.mobility_flags & MOBILITY_USE)) //exploding after touching yourself would be bad
|
||||
/obj/item/melee/touch_attack/disintegrate/afterattack(mob/living/target, mob/living/carbon/user, proximity)
|
||||
if(!proximity || target == user || !istype(target) || !iscarbon(user) || !(user.mobility_flags & MOBILITY_USE)) //exploding after touching yourself would be bad
|
||||
return
|
||||
if(!user.can_speak_vocal())
|
||||
to_chat(user, "<span class='warning'>You can't get the words out!</span>")
|
||||
return
|
||||
var/mob/M = target
|
||||
do_sparks(4, FALSE, M.loc)
|
||||
do_sparks(4, FALSE, target.loc)
|
||||
for(var/mob/living/L in view(src, 7))
|
||||
if(L != user)
|
||||
L.flash_act(affect_silicon = FALSE)
|
||||
var/atom/A = M.anti_magic_check()
|
||||
var/atom/A = target.anti_magic_check()
|
||||
if(A)
|
||||
if(isitem(A))
|
||||
target.visible_message("<span class='warning'>[target]'s [A] glows brightly as it wards off the spell!</span>")
|
||||
user.visible_message("<span class='warning'>The feedback blows [user]'s arm off!</span>","<span class='userdanger'>The spell bounces from [M]'s skin back into your arm!</span>")
|
||||
user.visible_message("<span class='warning'>The feedback blows [user]'s arm off!</span>","<span class='userdanger'>The spell bounces from [target]'s skin back into your arm!</span>")
|
||||
user.flash_act()
|
||||
var/obj/item/bodypart/part = user.get_holding_bodypart_of_item(src)
|
||||
if(part)
|
||||
part.dismember()
|
||||
return ..()
|
||||
var/obj/item/clothing/suit/hooded/bloated_human/suit = M.get_item_by_slot(ITEM_SLOT_OCLOTHING)
|
||||
var/obj/item/clothing/suit/hooded/bloated_human/suit = target.get_item_by_slot(ITEM_SLOT_OCLOTHING)
|
||||
if(istype(suit))
|
||||
M.visible_message("<span class='danger'>[M]'s [suit] explodes off of them into a puddle of gore!</span>")
|
||||
M.dropItemToGround(suit)
|
||||
target.visible_message("<span class='danger'>[target]'s [suit] explodes off of them into a puddle of gore!</span>")
|
||||
target.dropItemToGround(suit)
|
||||
qdel(suit)
|
||||
new /obj/effect/gibspawner(M.loc)
|
||||
new /obj/effect/gibspawner(target.loc)
|
||||
return ..()
|
||||
M.gib()
|
||||
target.gib()
|
||||
return ..()
|
||||
|
||||
/obj/item/melee/touch_attack/fleshtostone
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
if(!item_turf)
|
||||
return "[src] is not at a turf? NULLSPACE!?"
|
||||
|
||||
var/mob/old_body = mind.current
|
||||
var/mob/living/old_body = mind.current
|
||||
var/mob/living/carbon/human/lich = new(item_turf)
|
||||
|
||||
lich.equip_to_slot_or_del(new /obj/item/clothing/shoes/sandal/magic(lich), ITEM_SLOT_FEET)
|
||||
|
||||
@@ -149,11 +149,12 @@
|
||||
shape.apply_damage(damapply, source.convert_damage_type, forced = TRUE, wound_bonus=CANT_WOUND);
|
||||
shape.blood_volume = stored.blood_volume;
|
||||
|
||||
stored.RegisterSignal(src, COMSIG_PARENT_QDELETING, .proc/shape_death)
|
||||
stored.RegisterSignal(shape, list(COMSIG_PARENT_QDELETING, COMSIG_MOB_DEATH), .proc/shape_death)
|
||||
shape.RegisterSignal(stored, list(COMSIG_PARENT_QDELETING, COMSIG_MOB_DEATH), .proc/shape_death)
|
||||
RegisterSignal(shape, list(COMSIG_PARENT_QDELETING, COMSIG_LIVING_DEATH), .proc/shape_death)
|
||||
RegisterSignal(stored, list(COMSIG_PARENT_QDELETING, COMSIG_LIVING_DEATH), .proc/caster_death)
|
||||
|
||||
/obj/shapeshift_holder/Destroy()
|
||||
// Restore manages signal unregistering. If restoring is TRUE, we've already unregistered the signals and we're here
|
||||
// because restore() qdel'd src.
|
||||
if(!restoring)
|
||||
restore()
|
||||
stored = null
|
||||
@@ -191,6 +192,10 @@
|
||||
restore()
|
||||
|
||||
/obj/shapeshift_holder/proc/restore(death=FALSE)
|
||||
// Destroy() calls this proc if it hasn't been called. Unregistering here prevents multiple qdel loops
|
||||
// when caster and shape both die at the same time.
|
||||
UnregisterSignal(shape, list(COMSIG_PARENT_QDELETING, COMSIG_LIVING_DEATH))
|
||||
UnregisterSignal(stored, list(COMSIG_PARENT_QDELETING, COMSIG_LIVING_DEATH))
|
||||
restoring = TRUE
|
||||
stored.forceMove(shape.loc)
|
||||
stored.notransform = FALSE
|
||||
@@ -207,5 +212,10 @@
|
||||
stored.apply_damage(damapply, source.convert_damage_type, forced = TRUE, wound_bonus=CANT_WOUND)
|
||||
if(source.convert_damage)
|
||||
stored.blood_volume = shape.blood_volume;
|
||||
QDEL_NULL(shape)
|
||||
|
||||
// This guard is important because restore() can also be called on COMSIG_PARENT_QDELETING for shape, as well as on death.
|
||||
// This can happen in, for example, [/proc/wabbajack] where the mob hit is qdel'd.
|
||||
if(!QDELETED(shape))
|
||||
QDEL_NULL(shape)
|
||||
|
||||
qdel(src)
|
||||
|
||||
Reference in New Issue
Block a user