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
🆑
fix: Fixed speed potions behaving super inconsistently on magboots,
duffelbags and laptops
/🆑
This commit is contained in:
SmArtKar
2025-06-02 00:30:32 +02:00
committed by GitHub
parent 836c394747
commit 16d80d9be0
4 changed files with 33 additions and 13 deletions

View File

@@ -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()