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

147 lines
5.6 KiB
Plaintext

/obj/item/tourniquet
name = "tourniquet"
desc = "A medical device used to stop severe bleeding from a limb."
icon = 'icons/obj/medical/firstaid.dmi'
icon_state = "tourniquet"
w_class = WEIGHT_CLASS_SMALL
resistance_flags = FLAMMABLE
max_integrity = 50
item_flags = NOBLUDGEON
custom_premium_price = PAYCHECK_CREW * 2
/obj/item/tourniquet/Initialize(mapload)
. = ..()
AddComponent( \
/datum/component/limb_applicable, \
valid_zones = GLOB.limb_zones.Copy() + BODY_ZONE_HEAD, \
apply_category = LIMB_ITEM_TOURNIQUET, \
do_apply = CALLBACK(src, PROC_REF(do_apply_tourniquet)), \
)
RegisterSignal(src, COMSIG_ITEM_APPLIED_TO_LIMB, PROC_REF(on_applied_to_limb))
RegisterSignal(src, COMSIG_ITEM_UNAPPLIED_FROM_LIMB, PROC_REF(on_removed_from_limb))
/obj/item/tourniquet/Destroy()
STOP_PROCESSING(SSobj, src)
return ..()
/obj/item/tourniquet/suicide_act(mob/living/user)
user.visible_message(span_suicide("[user] begins to wrap [src] around [p_their()] neck too tight! It looks like [user.p_theyre()] trying to commit suicide!"))
if(!do_after(user, 5 SECONDS, user))
return SHAME
var/obj/item/bodypart/head = user.get_bodypart(BODY_ZONE_HEAD)
if(!head || !head.dismember())
return SHAME
return OXYLOSS
/obj/item/tourniquet/proc/on_applied_to_limb(datum/source, obj/item/bodypart/limb)
SIGNAL_HANDLER
limb.refresh_bleed_rate()
switch(limb.body_zone)
if(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)
var/obj/item/bodypart/arm/arm = limb
arm.set_speed_modifiers(arm.interaction_modifier + 0.5, arm.click_cd_modifier + 0.5)
if(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
var/obj/item/bodypart/leg/leg = limb
leg.set_speed_modifier(leg.speed_modifier + 0.5)
if(BODY_ZONE_HEAD)
START_PROCESSING(SSobj, src)
/obj/item/tourniquet/proc/on_removed_from_limb(datum/source, obj/item/bodypart/limb)
SIGNAL_HANDLER
limb.refresh_bleed_rate()
switch(limb.body_zone)
if(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM)
var/obj/item/bodypart/arm/arm = limb
arm.set_speed_modifiers(arm.interaction_modifier - 0.5, arm.click_cd_modifier - 0.5)
if(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
var/obj/item/bodypart/leg/leg = limb
leg.set_speed_modifier(leg.speed_modifier - 0.5)
if(BODY_ZONE_HEAD)
START_PROCESSING(SSobj, src)
/obj/item/tourniquet/process(seconds_per_tick)
var/obj/item/bodypart/limb = loc
if(!istype(limb) || isnull(limb.owner))
return PROCESS_KILL
if(HAS_TRAIT(limb.owner, TRAIT_NOBREATH))
return // you win this time
limb.owner.losebreath += 1 * seconds_per_tick // incapable of breathing
limb.owner.apply_damage(1 * seconds_per_tick, OXY, BODY_ZONE_HEAD, forced = TRUE) // no blood getting to brain
if(SPT_PROB(6, seconds_per_tick))
limb.owner.apply_damage(10, STAMINA, BODY_ZONE_HEAD, forced = TRUE)
if(SPT_PROB(5, seconds_per_tick))
limb.owner.adjust_eye_blur(4 SECONDS)
if(SPT_PROB(4, seconds_per_tick))
limb.owner.adjust_dizzy(4 SECONDS)
limb.owner.adjust_confusion(2 SECONDS)
/obj/item/tourniquet/proc/do_apply_tourniquet(mob/user, mob/living/patient, obj/item/bodypart/limb)
var/speed_multiplier = 2
var/speed_boosted = FALSE
for(var/datum/wound/woundies as anything in limb.wounds)
if(!woundies.blood_flow)
continue
if(HAS_TRAIT(woundies, TRAIT_WOUND_SCANNED) && limb.body_zone != BODY_ZONE_HEAD)
speed_multiplier = 0.5
speed_boosted = TRUE
break
speed_multiplier = 1
if(limb.body_zone == BODY_ZONE_HEAD)
speed_multiplier *= 2 // are you sure about that?
else if(user != patient)
speed_multiplier *= 0.5
if(limb.body_zone == BODY_ZONE_HEAD)
user.visible_message(
span_warning("[user] begins applying [src] to [user == patient ? p_their() : "[patient]'s"] neck..."),
span_userdanger("You begin applying [src] to [user == patient ? "your" : "[patient]'s"] neck, though you begin wonder if this is a good idea...?"),
visible_message_flags = ALWAYS_SHOW_SELF_MESSAGE,
ignored_mobs = patient,
)
if(user != patient)
patient.show_message(
span_userdanger("[user] begins applying [src] to your neck! That can't be a good idea...!"),
MSG_VISUAL,
span_userdanger("You feel [user] start wrapping something tight around your neck! That can't be a good idea...!"),
)
else if(speed_boosted)
user.visible_message(
span_notice("[user] begins expertly applying [src] to [user == patient ? p_their() : "[patient]'s"] own [limb.plaintext_zone]..."),
span_notice("You begin expertly applying [src] to [user == patient ? "your" : "[patient]'s"] own [limb.plaintext_zone], keeping the holo-image indications in mind..."),
visible_message_flags = ALWAYS_SHOW_SELF_MESSAGE,
ignored_mobs = patient,
)
if(user != patient)
patient.show_message(
span_notice("[user] begins expertly applying [src] to your [limb.plaintext_zone]..."),
MSG_VISUAL,
span_notice("You feel [user] start wrapping something around your [limb.plaintext_zone] with expert precision..."),
)
else
user.visible_message(
span_warning("[user] begins applying [src] to [user == patient ? p_their() : "[patient]'s"] [limb.plaintext_zone]..."),
span_warning("You begin applying [src] to [user == patient ? "your" : "[patient]'s"] [limb.plaintext_zone]..."),
visible_message_flags = ALWAYS_SHOW_SELF_MESSAGE,
ignored_mobs = patient,
)
if(user != patient)
patient.show_message(
span_warning("[user] begins applying [src] to your [limb.plaintext_zone]..."),
MSG_VISUAL,
span_warning("You feel [user] start wrapping something around your [limb.plaintext_zone]..."),
)
if(!do_after(user, 5 SECONDS * speed_multiplier, patient))
return FALSE
// pain from tight wrapping
patient.apply_damage(5, BRUTE, limb, attacking_item = src)
patient.apply_damage(20, STAMINA, limb, attacking_item = src)
return TRUE