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

130 lines
3.4 KiB
Plaintext

/obj/item/modular_computer/laptop
name = "laptop"
desc = "A portable laptop computer."
icon = 'icons/obj/devices/modular_laptop.dmi'
icon_state = "laptop-closed"
icon_state_powered = "laptop"
icon_state_unpowered = "laptop-off"
icon_state_menu = "menu"
hardware_flag = PROGRAM_LAPTOP
max_idle_programs = 3
w_class = WEIGHT_CLASS_NORMAL
interaction_flags_mouse_drop = NEED_HANDS
// No running around with open laptops in hands.
item_flags = SLOWS_WHILE_IN_HAND
drag_slowdown = 0
screen_on = FALSE // Starts closed
var/start_open = TRUE // unless this var is set to 1
var/icon_state_closed = "laptop-closed"
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))
AddElement(/datum/element/drag_pickup)
/obj/item/modular_computer/laptop/examine(mob/user)
. = ..()
if(screen_on)
. += span_notice("Alt-click to close it.")
/obj/item/modular_computer/laptop/add_context(atom/source, list/context, obj/item/held_item, mob/living/user)
. = ..()
if(screen_on)
context[SCREENTIP_CONTEXT_ALT_LMB] = "Close"
context[SCREENTIP_CONTEXT_RMB] = "Interact"
else
context[SCREENTIP_CONTEXT_RMB] = "Open"
return CONTEXTUAL_SCREENTIP_SET
/// 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)
icon_state = icon_state_closed
return
return ..()
/obj/item/modular_computer/laptop/update_overlays()
if(!screen_on)
cut_overlays()
return
return ..()
/obj/item/modular_computer/laptop/attack_self(mob/user)
if(!screen_on)
try_toggle_open(user)
else
return ..()
/obj/item/modular_computer/laptop/verb/open_computer()
set name = "Toggle Open"
set src in view(1)
try_toggle_open(usr)
/obj/item/modular_computer/laptop/proc/try_toggle_open(mob/living/user)
if(issilicon(user))
return
if(!isturf(loc) && !ismob(loc)) // No opening it in backpack.
return
if(!user.can_perform_action(src))
return
toggle_open(user)
/obj/item/modular_computer/laptop/click_alt(mob/user)
if(!screen_on)
return CLICK_ACTION_BLOCKING
try_toggle_open(user) // Close it.
return CLICK_ACTION_SUCCESS
/obj/item/modular_computer/laptop/attack_hand_secondary(mob/user, list/modifiers)
. = ..()
if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN)
return
attack_self(user)
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
/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 -= 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
update_weight_class(w_class_open)
drag_slowdown = slowdown_open
if(isliving(loc))
var/mob/living/localmob = loc
localmob.update_equipment_speed_mods()
localmob.update_pull_movespeed()
screen_on = !screen_on
update_appearance()
/obj/item/modular_computer/laptop/get_messenger_ending()
return "Sent from my UNIX Laptop"
// Laptop frame, starts empty and closed.
/obj/item/modular_computer/laptop/buildable
start_open = FALSE