Files
Alexis 21b4095dfd [MDB IGNORE] [IDB IGNORE] Upstream Sync - 04/17/2026 (#5453)
Upstream 04/17/2026

fixes https://github.com/Bubberstation/Bubberstation/issues/5549

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com>
Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com>
Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com>
Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com>
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com>
Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com>
Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com>
Co-authored-by: loganuk <fakeemail123@aol.com>
Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com>
Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com>
Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com>
Co-authored-by: Lucy <lucy@absolucy.moe>
Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com>
Co-authored-by: Isratosh <Isratosh@hotmail.com>
Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com>
Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com>
Co-authored-by: Alexander V. <volas@ya.ru>
Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com>
Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
Co-authored-by: Tim <timothymtorres@gmail.com>
Co-authored-by: Iamgoofball <iamgoofball@gmail.com>
Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com>
Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com>
Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com>
Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com>
Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com>
Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com>
Co-authored-by: Josh <josh.adam.powell@gmail.com>
Co-authored-by: Josh Powell <josh.powell@softwire.com>
Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com>
Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com>
Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com>
Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
2026-05-16 00:56:00 +02:00

104 lines
4.0 KiB
Plaintext

/datum/element/spooky
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
///will it spawn a new instrument
var/too_spooky = TRUE
///If, once someone is skeletonized, the element is detached
var/single_use = FALSE
///The base multiplier of stamina damage applied by the item
var/stam_damage_mult
/datum/element/spooky/Attach(datum/target, too_spooky = TRUE, single_use = FALSE, stam_damage_mult = 1)
. = ..()
if(!isitem(target))
return ELEMENT_INCOMPATIBLE
src.too_spooky = too_spooky
src.single_use = single_use
src.stam_damage_mult = stam_damage_mult
RegisterSignal(target, COMSIG_ITEM_ATTACK, PROC_REF(spectral_attack))
/datum/element/spooky/Detach(datum/source)
UnregisterSignal(source, COMSIG_ITEM_ATTACK)
return ..()
/datum/element/spooky/proc/spectral_attack(datum/source, mob/living/carbon/target, mob/user)
SIGNAL_HANDLER
if(ishuman(user) && !isskeleton(user)) //this weapon wasn't meant for mortals.
var/mob/living/carbon/human/human_user = user
if(rattle_bones(human_user, stam_dam_mult = stam_damage_mult * 2))
to_chat(human_user, span_userdanger("Your ears weren't meant for this spectral sound."))
INVOKE_ASYNC(src, PROC_REF(spectral_change), human_user, user, source)
return
to_chat(target, span_userdanger("<b>DOOT</b"))
if(isskeleton(target)) // skeletons are totally immune, no redundant skeletonization or bad mood event.
return
target.add_mood_event("spooked", /datum/mood_event/spooked)
if(!ishuman(target))//the sound will spook basic mobs.
target.set_jitter_if_lower(30 SECONDS)
target.set_stutter(40 SECONDS)
return
var/mob/living/carbon/human/human = target
if(rattle_bones(human))
INVOKE_ASYNC(src, PROC_REF(spectral_change), human, user, source)
///Cause jitteriness and stamina to the target relative to the amount of their bodyparts made of flesh and bone.
/datum/element/spooky/proc/rattle_bones(mob/living/carbon/human/human, stam_dam_mult = stam_damage_mult)
if(isskeleton(human))
return FALSE //undeads are unaffected by the spook-pocalypse.
var/bone_amount = 0
for(var/obj/item/bodypart/part as anything in human.get_bodyparts())
if((part.biological_state & BIO_FLESH_BONE) == BIO_FLESH_BONE)
bone_amount++
if(bone_amount)
human.set_jitter_if_lower(12 SECONDS * bone_amount)
human.set_stutter(6.5 SECONDS * bone_amount)
human.adjust_stamina_loss(3 * bone_amount * stam_dam_mult)
if(iszombie(human))
human.adjust_stamina_loss(25)
human.Paralyze(15) //zombies can't resist the doot
return bone_amount
/datum/element/spooky/proc/spectral_change(mob/living/carbon/human/human, mob/living/user, obj/item/source)
if(human.get_stamina_loss() <= 95)
return
if(single_use)
to_chat(user, span_warning("You feel like [source] has lost its spookiness..."))
Detach(source)
human.Paralyze(2 SECONDS)
human.set_species(/datum/species/skeleton)
human.visible_message(span_warning("[human] has given up on life as a mortal."))
to_chat(human, span_boldnotice("You are a spooky skeleton!"))
to_chat(human,
span_boldnotice("A new life and identity has begun.\
[too_spooky ? "Help your fellow skeletons into bringing out the spooky-pocalypse." : ""] \
You haven't forgotten your past life, and are still beholden to past loyalties.")
)
INVOKE_ASYNC(src, PROC_REF(change_name), human) //time for a new name!
if(!too_spooky)
return
var/turf/turf = get_turf(human)
if(!prob(90))
to_chat(human, span_boldwarning("The spooky gods forgot to ship your instrument. Better luck next unlife."))
return
var/obj/item/instrument = pick(
/obj/item/instrument/saxophone/spectral,
/obj/item/instrument/trumpet/spectral,
/obj/item/instrument/trombone/spectral,
)
new instrument(turf)
/datum/element/spooky/proc/change_name(mob/living/carbon/human/spooked)
var/skeleton_name = spooked.client ? sanitize_name(tgui_input_text(spooked, "Enter your new skeleton name", "Spookifier", spooked.real_name, MAX_NAME_LEN)) : null
if(!skeleton_name)
skeleton_name = "\improper spooky skeleton"
spooked.fully_replace_character_name(null, skeleton_name)