mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-29 18:40:42 +00:00
* Refactor on_mob_death and death implants There is a proc on `/obj/item` called `on_mob_death` called on all items in the contents of a mob on that mob's death. It is currently used for explosive implant detonation, and the deactivation of the Peaceborg's projectile dampener. Instead of using this old proc, both of them now instad use the COMSIG_LIVING_DEATH signal, already emitted when their owner dies. The activation of an explosive implant will now occur after the rest of the death code has run, since it activates with an async applied function, since some other implants may still want the mob's body intact, and you shouldn't use `sleep()` (which it does in the "slow explosion mode") in signal handlers. In addition, the "can_be_implanted" proc for /mob/living (and overriden for silicons, slimes and simple animals) has been folded into the `/obj/item/implant/proc/can_be_implanted_to` proc. Some future implants may want to be more permissive than the current permissions, but that isn't possible when checking both procs.
100 lines
2.6 KiB
Plaintext
100 lines
2.6 KiB
Plaintext
/**
|
|
* Blow up the mob into giblets
|
|
*
|
|
* Arguments:
|
|
* * no_brain - Should the mob NOT drop a brain?
|
|
* * no_organs - Should the mob NOT drop organs?
|
|
* * no_bodyparts - Should the mob NOT drop bodyparts?
|
|
*/
|
|
/mob/living/proc/gib(no_brain, no_organs, no_bodyparts)
|
|
var/prev_lying = lying_angle
|
|
if(stat != DEAD)
|
|
death(TRUE)
|
|
|
|
if(!prev_lying)
|
|
gib_animation()
|
|
|
|
spill_organs(no_brain, no_organs, no_bodyparts)
|
|
|
|
if(!no_bodyparts)
|
|
spread_bodyparts(no_brain, no_organs)
|
|
|
|
spawn_gibs(no_bodyparts)
|
|
qdel(src)
|
|
|
|
/mob/living/proc/gib_animation()
|
|
return
|
|
|
|
/mob/living/proc/spawn_gibs()
|
|
new /obj/effect/gibspawner/generic(drop_location(), src, get_static_viruses())
|
|
|
|
/mob/living/proc/spill_organs()
|
|
return
|
|
|
|
/mob/living/proc/spread_bodyparts()
|
|
return
|
|
|
|
/**
|
|
* This is the proc for turning a mob into ash.
|
|
* Dusting robots does not eject the MMI, so it's a bit more powerful than gib()
|
|
*
|
|
* Arguments:
|
|
* * just_ash - If TRUE, ash will spawn where the mob was, as opposed to remains
|
|
* * drop_items - Should the mob drop their items before dusting?
|
|
* * force - Should this mob be FORCABLY dusted?
|
|
*/
|
|
/mob/living/proc/dust(just_ash, drop_items, force)
|
|
death(TRUE)
|
|
|
|
if(drop_items)
|
|
unequip_everything()
|
|
|
|
if(buckled)
|
|
buckled.unbuckle_mob(src, force = TRUE)
|
|
|
|
dust_animation()
|
|
spawn_dust(just_ash)
|
|
QDEL_IN(src,5) // since this is sometimes called in the middle of movement, allow half a second for movement to finish, ghosting to happen and animation to play. Looks much nicer and doesn't cause multiple runtimes.
|
|
|
|
/mob/living/proc/dust_animation()
|
|
return
|
|
|
|
/mob/living/proc/spawn_dust(just_ash = FALSE)
|
|
new /obj/effect/decal/cleanable/ash(loc)
|
|
|
|
/*
|
|
* Called when the mob dies. Can also be called manually to kill a mob.
|
|
*
|
|
* Arguments:
|
|
* * gibbed - Was the mob gibbed?
|
|
*/
|
|
/mob/living/proc/death(gibbed)
|
|
set_stat(DEAD)
|
|
unset_machine()
|
|
timeofdeath = world.time
|
|
tod = station_time_timestamp()
|
|
var/turf/T = get_turf(src)
|
|
if(mind && mind.name && mind.active && !istype(T.loc, /area/ctf))
|
|
deadchat_broadcast(" has died at <b>[get_area_name(T)]</b>.", "<b>[mind.name]</b>", follow_target = src, turf_target = T, message_type=DEADCHAT_DEATHRATTLE)
|
|
if(mind)
|
|
mind.store_memory("Time of death: [tod]", 0)
|
|
set_drugginess(0)
|
|
set_disgust(0)
|
|
SetSleeping(0, 0)
|
|
reset_perspective(null)
|
|
reload_fullscreen()
|
|
update_action_buttons_icon()
|
|
update_damage_hud()
|
|
update_health_hud()
|
|
med_hud_set_health()
|
|
med_hud_set_status()
|
|
stop_pulling()
|
|
|
|
SEND_SIGNAL(src, COMSIG_LIVING_DEATH, gibbed)
|
|
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_MOB_DEATH, src, gibbed)
|
|
|
|
if (client)
|
|
client.move_delay = initial(client.move_delay)
|
|
|
|
return TRUE
|