From ed815ddec1fad6b7b2dd8792d96feed6ccfecc11 Mon Sep 17 00:00:00 2001 From: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Date: Mon, 2 Jun 2025 00:30:32 +0200 Subject: [PATCH] Fixes speed potions behaving super inconsistently on magboots, duffelbags and laptops (#91415) ## About The Pull Request The issue was threefold, first speed potions sent the comsig before actually applying which could be abused to make items not have a slowdown without spending it or coloring them by using it on them in a state when they don't have a slowdown (i.e. disabled magboots). Magboots ``initial()``'d their slowdown which could break them if they somehow got it negative, but I believe that didn't happen in actual gameplay. And I've made duffelbags and laptops have their open slowdown set to 0 similarly to magboots when a speed potion is applied to them. Last one may be a balance change, depending on the original intent, but I'm going off their pre-rework behavior here (and it generally feels weird to be the case when they get unslowdowned and then it gets reapplied when you close and open them) - Closes #91381 ## Changelog :cl: fix: Fixed speed potions behaving super inconsistently on magboots, duffelbags and laptops /:cl: --- code/game/objects/items/storage/dufflebags.dm | 11 ++++++++-- code/modules/clothing/shoes/magboots.dm | 4 ++-- .../computers/item/laptop.dm | 21 ++++++++++++------- .../research/xenobiology/xenobiology.dm | 10 +++++++-- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/code/game/objects/items/storage/dufflebags.dm b/code/game/objects/items/storage/dufflebags.dm index 48ec7498c11..c9c65d5bced 100644 --- a/code/game/objects/items/storage/dufflebags.dm +++ b/code/game/objects/items/storage/dufflebags.dm @@ -23,6 +23,7 @@ /obj/item/storage/backpack/duffelbag/Initialize(mapload) . = ..() set_zipper(TRUE) + RegisterSignal(src, COMSIG_SPEED_POTION_APPLIED, PROC_REF(on_speed_potioned)) /obj/item/storage/backpack/duffelbag/update_desc(updates) . = ..() @@ -87,11 +88,11 @@ zipped_up = new_zip SEND_SIGNAL(src, COMSIG_DUFFEL_ZIP_CHANGE, new_zip) if(zipped_up) - slowdown = initial(slowdown) + slowdown -= zip_slowdown atom_storage.set_locked(STORAGE_SOFT_LOCKED) atom_storage.display_contents = FALSE else - slowdown = zip_slowdown + slowdown += zip_slowdown atom_storage.set_locked(STORAGE_NOT_LOCKED) atom_storage.display_contents = TRUE @@ -99,6 +100,12 @@ var/mob/living/wearer = loc wearer.update_equipment_speed_mods() +/// Signal handler for [COMSIG_SPEED_POTION_APPLIED]. Speed potion removes the unzipped slowdown +/obj/item/storage/backpack/duffelbag/proc/on_speed_potioned(datum/source) + SIGNAL_HANDLER + // Don't need to touch the actual slowdown here, since the speed potion does it for us + zip_slowdown = 0 + /obj/item/storage/backpack/duffelbag/cursed name = "living duffel bag" desc = "A cursed clown duffel bag that hungers for food of any kind. A warning label suggests that it eats food inside. \ diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm index 3a6a8c53129..2210eff12a6 100644 --- a/code/modules/clothing/shoes/magboots.dm +++ b/code/modules/clothing/shoes/magboots.dm @@ -69,7 +69,7 @@ else if(magpulse_fishing_modifier != fishing_modifier) qdel(GetComponent(/datum/component/adjust_fishing_difficulty)) detach_clothing_traits(active_traits) - slowdown = max(initial(slowdown), slowdown - slowdown_active) // Just in case, for speed pot shenanigans + slowdown -= slowdown_active update_appearance() balloon_alert(user, "mag-pulse [magpulse ? "enabled" : "disabled"]") @@ -89,7 +89,7 @@ desc = "Advanced magnetic boots that have a lighter magnetic pull, placing less burden on the wearer." icon_state = "advmag0" base_icon_state = "advmag" - slowdown_active = SHOES_SLOWDOWN // ZERO active slowdown + slowdown_active = 0 // ZERO active slowdown resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF magpulse_fishing_modifier = 3 fishing_modifier = 0 diff --git a/code/modules/modular_computers/computers/item/laptop.dm b/code/modules/modular_computers/computers/item/laptop.dm index 343a09a980d..a33ae21f9fd 100644 --- a/code/modules/modular_computers/computers/item/laptop.dm +++ b/code/modules/modular_computers/computers/item/laptop.dm @@ -24,6 +24,12 @@ var/w_class_open = WEIGHT_CLASS_BULKY var/slowdown_open = 1 +/obj/item/modular_computer/laptop/Initialize(mapload) + . = ..() + if(start_open && !screen_on) + toggle_open() + RegisterSignal(src, COMSIG_SPEED_POTION_APPLIED, PROC_REF(on_speed_potioned)) + /obj/item/modular_computer/laptop/examine(mob/user) . = ..() if(screen_on) @@ -39,11 +45,11 @@ return CONTEXTUAL_SCREENTIP_SET -/obj/item/modular_computer/laptop/Initialize(mapload) - . = ..() - - if(start_open && !screen_on) - toggle_open() +/// Signal handler for [COMSIG_SPEED_POTION_APPLIED]. Speed potion removes the open slowdown +/obj/item/modular_computer/laptop/proc/on_speed_potioned(datum/source) + SIGNAL_HANDLER + // Don't need to touch the actual slowdown here, since the speed potion does it for us + slowdown_open = 0 /obj/item/modular_computer/laptop/update_icon_state() if(!screen_on) @@ -108,14 +114,15 @@ /obj/item/modular_computer/laptop/proc/toggle_open(mob/living/user=null) if(screen_on) to_chat(user, span_notice("You close \the [src].")) - slowdown = initial(slowdown) + slowdown -= slowdown_open update_weight_class(initial(w_class)) drag_slowdown = initial(drag_slowdown) else to_chat(user, span_notice("You open \the [src].")) - slowdown = slowdown_open + slowdown += slowdown_open update_weight_class(w_class_open) drag_slowdown = slowdown_open + if(isliving(loc)) var/mob/living/localmob = loc localmob.update_equipment_speed_mods() diff --git a/code/modules/research/xenobiology/xenobiology.dm b/code/modules/research/xenobiology/xenobiology.dm index 40dc0fd9b83..8362b9a4f9f 100644 --- a/code/modules/research/xenobiology/xenobiology.dm +++ b/code/modules/research/xenobiology/xenobiology.dm @@ -910,11 +910,11 @@ if(!isobj(interacting_with)) to_chat(user, span_warning("The potion can only be used on objects!")) return ITEM_INTERACT_BLOCKING + if(HAS_TRAIT(interacting_with, TRAIT_SPEED_POTIONED)) to_chat(user, span_warning("[interacting_with] can't be made any faster!")) return ITEM_INTERACT_BLOCKING - if(SEND_SIGNAL(interacting_with, COMSIG_SPEED_POTION_APPLIED, src, user) & SPEED_POTION_STOP) - return ITEM_INTERACT_SUCCESS + if(isitem(interacting_with)) var/obj/item/apply_to = interacting_with if(apply_to.slowdown <= 0 || (apply_to.item_flags & IMMUTABLE_SLOW) || HAS_TRAIT(apply_to, TRAIT_NO_SPEED_POTION)) @@ -922,6 +922,12 @@ return NONE // lets us put the potion in the bag to_chat(user, span_warning("[apply_to] can't be made any faster!")) return ITEM_INTERACT_BLOCKING + + if(SEND_SIGNAL(interacting_with, COMSIG_SPEED_POTION_APPLIED, src, user) & SPEED_POTION_STOP) + return ITEM_INTERACT_SUCCESS + + if(isitem(interacting_with)) + var/obj/item/apply_to = interacting_with apply_to.slowdown = 0 to_chat(user, span_notice("You slather the red gunk over the [interacting_with], making it faster."))