mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 23:58:07 +01:00
[MIRROR] Refactors Suiciding Variable Into Trait [MDB IGNORE] (#20017)
* Refactors Suiciding Variable Into Trait * suicide * https://github.com/tgstation/tgstation/pull/72919 MISSED IRROR * better suicide handling --------- Co-authored-by: san7890 <the@san7890.com> Co-authored-by: lessthnthree <three@lessthanthree.dk> Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
co-authored by
san7890
lessthnthree
Gandalf
parent
b4714a1a31
commit
96be018eb1
@@ -101,7 +101,8 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
|
||||
|
||||
mind = body.mind //we don't transfer the mind but we keep a reference to it.
|
||||
|
||||
set_suicide(body.suiciding) // Transfer whether they committed suicide.
|
||||
if(HAS_TRAIT_FROM_ONLY(body, TRAIT_SUICIDED, REF(body))) // transfer if the body was killed due to suicide
|
||||
ADD_TRAIT(src, TRAIT_SUICIDED, REF(body))
|
||||
|
||||
if(ishuman(body))
|
||||
var/mob/living/carbon/human/body_human = body
|
||||
|
||||
@@ -255,7 +255,7 @@
|
||||
else if(last_mind)
|
||||
blood_data["ckey"] = ckey(last_mind.key)
|
||||
|
||||
if(!suiciding)
|
||||
if(!HAS_TRAIT_FROM(src, TRAIT_SUICIDED, REF(src)))
|
||||
blood_data["cloneable"] = 1
|
||||
blood_data["blood_type"] = dna.blood_type
|
||||
blood_data["gender"] = gender
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
newbrain.brainmob = null
|
||||
brainmob.forceMove(src)
|
||||
brainmob.container = src
|
||||
var/fubar_brain = newbrain.suicided || brainmob.suiciding //brain is from a suicider
|
||||
var/fubar_brain = newbrain.suicided || HAS_TRAIT(brainmob, TRAIT_SUICIDED) //brain is from a suicider
|
||||
if(!fubar_brain && !(newbrain.organ_flags & ORGAN_FAILING)) // the brain organ hasn't been beaten to death, nor was from a suicider.
|
||||
brainmob.set_stat(CONSCIOUS) //we manually revive the brain mob
|
||||
else if(!fubar_brain && newbrain.organ_flags & ORGAN_FAILING) // the brain is damaged, but not from a suicider
|
||||
@@ -275,7 +275,7 @@
|
||||
if(user)
|
||||
to_chat(user, span_warning("\The [src] indicates that their mind is currently inactive."))
|
||||
return FALSE
|
||||
if(B.suiciding || brain?.suicided)
|
||||
if(HAS_TRAIT(B, TRAIT_SUICIDED) || brain?.suicided)
|
||||
if(user)
|
||||
to_chat(user, span_warning("\The [src] indicates that their mind has no will to live!"))
|
||||
return FALSE
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
else
|
||||
C.key = brainmob.key
|
||||
|
||||
C.set_suicide(brainmob.suiciding)
|
||||
C.set_suicide(HAS_TRAIT(brainmob, TRAIT_SUICIDED))
|
||||
|
||||
QDEL_NULL(brainmob)
|
||||
|
||||
@@ -117,7 +117,10 @@
|
||||
brainmob.name = L.real_name
|
||||
brainmob.real_name = L.real_name
|
||||
brainmob.timeofhostdeath = L.timeofdeath
|
||||
brainmob.suiciding = suicided
|
||||
|
||||
if(suicided)
|
||||
ADD_TRAIT(brainmob, TRAIT_SUICIDED, REF(src))
|
||||
|
||||
if(L.has_dna())
|
||||
var/mob/living/carbon/C = L
|
||||
if(!brainmob.stored_dna)
|
||||
|
||||
@@ -117,13 +117,13 @@ GLOBAL_VAR(posibrain_notify_cooldown)
|
||||
return
|
||||
if(is_occupied() || is_banned_from(user.ckey, ROLE_POSIBRAIN) || QDELETED(brainmob) || QDELETED(src) || QDELETED(user))
|
||||
return
|
||||
if(user.suiciding) //if they suicided, they're out forever.
|
||||
if(HAS_TRAIT(src, TRAIT_SUICIDED)) //if they suicided, they're out forever.
|
||||
to_chat(user, span_warning("[src] fizzles slightly. Sadly it doesn't take those who suicided!"))
|
||||
return
|
||||
var/posi_ask = tgui_alert(user, "Become a [name]? (Warning, You can no longer be revived, and all past lives will be forgotten!)", "Confirm", list("Yes","No"))
|
||||
if(posi_ask != "Yes" || QDELETED(src))
|
||||
return
|
||||
if(brainmob.suiciding) //clear suicide status if the old occupant suicided.
|
||||
if(HAS_TRAIT(brainmob, TRAIT_SUICIDED)) //clear suicide status if the old occupant suicided.
|
||||
brainmob.set_suicide(FALSE)
|
||||
transfer_personality(user)
|
||||
|
||||
|
||||
@@ -937,8 +937,7 @@
|
||||
if(HAS_TRAIT(src, TRAIT_DNR)) //This is also added when a ghost DNR's!
|
||||
return DEFIB_FAIL_DNR
|
||||
//SKYRAT EDIT ADDITION END - DNR TRAIT
|
||||
|
||||
if (suiciding)
|
||||
if (HAS_TRAIT(src, TRAIT_SUICIDED))
|
||||
return DEFIB_FAIL_SUICIDE
|
||||
|
||||
if (HAS_TRAIT(src, TRAIT_HUSK))
|
||||
@@ -968,7 +967,7 @@
|
||||
if (current_brain.organ_flags & ORGAN_FAILING)
|
||||
return DEFIB_FAIL_FAILING_BRAIN
|
||||
|
||||
if (current_brain.suicided || current_brain.brainmob?.suiciding)
|
||||
if (current_brain.suicided || (current_brain.brainmob && HAS_TRAIT(current_brain.brainmob, TRAIT_SUICIDED)))
|
||||
return DEFIB_FAIL_NO_INTELLIGENCE
|
||||
|
||||
if(key && key[1] == "@") // Adminghosts
|
||||
|
||||
@@ -27,7 +27,7 @@ GLOBAL_LIST_EMPTY(dead_players_during_shift)
|
||||
|
||||
. = ..()
|
||||
|
||||
if(client && !suiciding && !(client in GLOB.dead_players_during_shift))
|
||||
if(client && !HAS_TRAIT(src, TRAIT_SUICIDED) && !(client in GLOB.dead_players_during_shift))
|
||||
GLOB.dead_players_during_shift += client
|
||||
|
||||
if(!QDELETED(dna)) //The gibbed param is bit redundant here since dna won't exist at this point if they got deleted.
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
just_sleeping = TRUE
|
||||
|
||||
if(!just_sleeping)
|
||||
if(suiciding)
|
||||
if(HAS_TRAIT(src, TRAIT_SUICIDED))
|
||||
. += span_warning("[t_He] appear[p_s()] to have committed suicide... there is no hope of recovery.")
|
||||
|
||||
. += generate_death_examine_text()
|
||||
|
||||
@@ -910,7 +910,7 @@
|
||||
/obj/structure/cloth_pile/proc/revive()
|
||||
if(QDELETED(src) || QDELETED(cloth_golem)) //QDELETED also checks for null, so if no cloth golem is set this won't runtime
|
||||
return
|
||||
if(cloth_golem.suiciding)
|
||||
if(HAS_TRAIT_FROM_ONLY(cloth_golem, TRAIT_SUICIDED, REF(cloth_golem)))
|
||||
QDEL_NULL(cloth_golem)
|
||||
return
|
||||
|
||||
|
||||
@@ -908,7 +908,7 @@
|
||||
reagents.clear_reagents()
|
||||
|
||||
if(heal_flags & HEAL_ADMIN)
|
||||
suiciding = FALSE
|
||||
REMOVE_TRAIT(src, TRAIT_SUICIDED, REF(src))
|
||||
|
||||
updatehealth()
|
||||
stop_sound_channel(CHANNEL_HEARTBEAT)
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
///A sound sent when the mob dies, with the *deathgasp emote
|
||||
var/death_sound
|
||||
|
||||
|
||||
/// Helper vars for quick access to firestacks, these should be updated every time firestacks are adjusted
|
||||
var/on_fire = FALSE
|
||||
var/fire_stacks = 0
|
||||
|
||||
@@ -414,15 +414,17 @@
|
||||
the_mmi.brainmob.name = src.real_name
|
||||
the_mmi.brainmob.real_name = src.real_name
|
||||
the_mmi.brainmob.container = the_mmi
|
||||
the_mmi.brainmob.set_suicide(suiciding)
|
||||
the_mmi.brain.suicided = suiciding
|
||||
|
||||
var/has_suicided_trait = HAS_TRAIT(src, TRAIT_SUICIDED)
|
||||
the_mmi.brainmob.set_suicide(has_suicided_trait)
|
||||
the_mmi.brain.suicided = has_suicided_trait
|
||||
if(the_core)
|
||||
var/obj/structure/ai_core/core = the_core
|
||||
core.core_mmi = the_mmi
|
||||
the_mmi.forceMove(the_core)
|
||||
else
|
||||
the_mmi.forceMove(get_turf(src))
|
||||
if(the_mmi.brainmob.stat == DEAD && !suiciding)
|
||||
if(the_mmi.brainmob.stat == DEAD && !has_suicided_trait)
|
||||
the_mmi.brainmob.set_stat(CONSCIOUS)
|
||||
if(mind)
|
||||
mind.transfer_to(the_mmi.brainmob)
|
||||
|
||||
@@ -101,6 +101,13 @@
|
||||
modularInterface.saved_job = "Cyborg"
|
||||
return ..()
|
||||
|
||||
/mob/living/silicon/robot/set_suicide(suicide_state)
|
||||
. = ..()
|
||||
if(mmi)
|
||||
if(mmi.brain)
|
||||
mmi.brain.suicided = suicide_state
|
||||
if(suicide_state && mmi.brainmob)
|
||||
ADD_TRAIT(mmi.brainmob, TRAIT_SUICIDED, REF(src))
|
||||
|
||||
/**
|
||||
* Sets the tablet theme and icon
|
||||
|
||||
@@ -443,7 +443,7 @@
|
||||
if(!(loc == C.loc) && !(isturf(C.loc) && isturf(loc)))
|
||||
return FALSE
|
||||
|
||||
if(C.suiciding)
|
||||
if(HAS_TRAIT_FROM_ONLY(C, TRAIT_SUICIDED, REF(C)))
|
||||
return FALSE //Kevorkian school of robotic medical assistants.
|
||||
|
||||
if(bot_cover_flags & BOT_COVER_EMAGGED) //Everyone needs our medicine. (Our medicine is toxins)
|
||||
|
||||
@@ -353,7 +353,7 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians
|
||||
forceMove(summoner.loc)
|
||||
new /obj/effect/temp_visual/guardian/phase(loc)
|
||||
|
||||
/mob/living/simple_animal/hostile/guardian/canSuicide()
|
||||
/mob/living/simple_animal/hostile/guardian/can_suicide()
|
||||
return FALSE
|
||||
|
||||
/mob/living/simple_animal/hostile/guardian/proc/is_deployed()
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
death_message = "lets out a contented sigh as [p_their()] form unwinds."
|
||||
..()
|
||||
|
||||
/mob/living/simple_animal/shade/canSuicide()
|
||||
/mob/living/simple_animal/shade/can_suicide()
|
||||
if(istype(loc, /obj/item/soulstone)) //do not suicide inside the soulstone
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
@@ -65,9 +65,6 @@
|
||||
///Cursor icon used when holding shift over things
|
||||
var/examine_cursor_icon = 'icons/effects/mouse_pointers/examine_pointer.dmi'
|
||||
|
||||
///Whether this mob has or is in the middle of committing suicide.
|
||||
var/suiciding = FALSE
|
||||
|
||||
/// Whether a mob is alive or dead. TODO: Move this to living - Nodrak (2019, still here)
|
||||
var/stat = CONSCIOUS
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@
|
||||
if(ignore_mapload && SSatoms.initialized != INITIALIZATION_INNEW_REGULAR) //don't notify for objects created during a map load
|
||||
return
|
||||
for(var/mob/dead/observer/ghost in GLOB.player_list)
|
||||
if(!notify_suiciders && (ghost in GLOB.suicided_mob_list))
|
||||
if(!notify_suiciders && HAS_TRAIT(ghost, TRAIT_SUICIDED))
|
||||
continue
|
||||
if(ignore_key && (ghost.ckey in GLOB.poll_ignore[ignore_key]))
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user