From c297dde150e3e97e28a392366b4314a0b0aaedba Mon Sep 17 00:00:00 2001
From: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com>
Date: Tue, 12 Nov 2024 21:28:11 -0500
Subject: [PATCH] [s] Stealth box fix (#27351)
* stealth box fix
* isturf moment
---
code/_onclick/hud/fullscreen.dm | 5 +++
.../weapons/bio_chips/bio_chip_stealth.dm | 39 +------------------
.../surgery/organs/augments_internal.dm | 11 ++++--
3 files changed, 14 insertions(+), 41 deletions(-)
diff --git a/code/_onclick/hud/fullscreen.dm b/code/_onclick/hud/fullscreen.dm
index b085669097b..d004fe49e2a 100644
--- a/code/_onclick/hud/fullscreen.dm
+++ b/code/_onclick/hud/fullscreen.dm
@@ -246,6 +246,11 @@
icon_state = "disky"
layer = BLIND_LAYER
+/atom/movable/screen/fullscreen/center/agent_box
+ icon = 'icons/obj/cardboard_boxes.dmi'
+ icon_state = "agentbox"
+ alpha = 128
+
#undef FULLSCREEN_LAYER
#undef BLIND_LAYER
#undef CRIT_LAYER
diff --git a/code/game/objects/items/weapons/bio_chips/bio_chip_stealth.dm b/code/game/objects/items/weapons/bio_chips/bio_chip_stealth.dm
index 611e0844213..9669932558a 100644
--- a/code/game/objects/items/weapons/bio_chips/bio_chip_stealth.dm
+++ b/code/game/objects/items/weapons/bio_chips/bio_chip_stealth.dm
@@ -52,17 +52,17 @@
// Spawn the actual box
var/obj/structure/closet/cardboard/agent/box = new(get_turf(owner), owner)
- box.implant_user_UID = owner.UID()
// Slightly shorter time since we needed 0.3s to to do the spawn animation.
INVOKE_ASYNC(box, TYPE_PROC_REF(/obj/structure/closet/cardboard/agent, go_invisible), 1.7 SECONDS)
- box.create_fake_box()
owner.forceMove(box)
+ owner.overlay_fullscreen("agent_box", /atom/movable/screen/fullscreen/center/agent_box)
RegisterSignal(box, COMSIG_PARENT_QDELETING, PROC_REF(start_cooldown))
/datum/action/item_action/agent_box/proc/start_cooldown(datum/source)
SIGNAL_HANDLER
on_cooldown = TRUE
addtimer(CALLBACK(src, PROC_REF(end_cooldown)), 10 SECONDS)
+ owner.clear_fullscreen("agent_box")
UpdateButtons()
/datum/action/item_action/agent_box/proc/end_cooldown()
@@ -109,20 +109,6 @@
max_integrity = 1
move_speed_multiplier = 0.5 // You can move at run speed while in this box.
material_drop = null
- /// UID of the person who summoned this box with an implant.
- var/implant_user_UID
- // This has to be a separate object and not just an image because the image will inherit the box's 0 alpha while it is stealthed.
- /// A holder effect which follows the src box so we can display an image to the person inside the box.
- var/obj/effect/fake_box
- /// The box image attached to the `fake_box` object.
- var/image/box_img
-
-/obj/structure/closet/cardboard/agent/Destroy()
- var/mob/living/implant_user = locateUID(implant_user_UID)
- implant_user?.client?.images -= box_img
- QDEL_NULL(fake_box)
- QDEL_NULL(box_img)
- return ..()
/obj/structure/closet/cardboard/agent/open()
. = ..()
@@ -134,27 +120,6 @@
/obj/structure/closet/cardboard/agent/update_icon_state()
return
-/obj/structure/closet/cardboard/agent/proc/create_fake_box()
- if(fake_box)
- return
- fake_box = new(get_turf(src))
- fake_box.mouse_opacity = MOUSE_OPACITY_TRANSPARENT // This object should be completely invisible.
- box_img = image(icon, fake_box, icon_state, ABOVE_MOB_LAYER)
- box_img.alpha = 128
- RegisterSignal(src, COMSIG_MOVABLE_MOVED, PROC_REF(move_fake_box))
- var/mob/living/implant_user = locateUID(implant_user_UID)
- implant_user.client?.images += box_img
-
-/obj/structure/closet/cardboard/agent/proc/move_fake_box(datum/source, oldloc, move_dir)
- SIGNAL_HANDLER
-
- // For non-standard movement such as teleports.
- if(!move_dir)
- fake_box.loc = get_turf(src)
- return
- // For basic 8-directional movement.
- fake_box.loc = get_step(fake_box, move_dir)
-
/obj/structure/closet/cardboard/agent/proc/go_invisible(invis_time = 2 SECONDS)
animate(src, alpha = 0, time = invis_time)
sleep(invis_time)
diff --git a/code/modules/surgery/organs/augments_internal.dm b/code/modules/surgery/organs/augments_internal.dm
index 05d7d216960..914824891c1 100644
--- a/code/modules/surgery/organs/augments_internal.dm
+++ b/code/modules/surgery/organs/augments_internal.dm
@@ -537,8 +537,11 @@
if(istype(user.loc, /obj/machinery/atmospherics)) //Come now, no emaging all the doors on station from a pipe
to_chat(user, "Your implant is unable to get a lock on anything in the pipes!")
return
-
- var/beam = user.Beam(target, icon_state = "sm_arc_supercharged", time = 3 SECONDS)
+ var/beam
+ if(!isturf(user.loc)) //Using it inside a locker or stealth box is fine! Let us make sure the beam can be seen though.
+ beam = user.loc.Beam(target, icon_state = "sm_arc_supercharged", time = 3 SECONDS)
+ else
+ beam = user.Beam(target, icon_state = "sm_arc_supercharged", time = 3 SECONDS)
user.visible_message("[user] makes an unusual buzzing sound as the air between them and [target] crackles.", \
"The air between you and [target] begins to crackle audibly as the Binyat gets to work and heats up in your head!")
@@ -757,7 +760,7 @@
/// Blocks teleports and stuns the would-be-teleportee.
/obj/item/organ/internal/cyberimp/chest/bluespace_anchor/proc/on_teleport(mob/living/teleportee, atom/destination, channel)
- SIGNAL_HANDLER // COMSIG_MOVABLE_TELEPORTED
+ SIGNAL_HANDLER // COMSIG_MOVABLE_TELEPORTED
to_chat(teleportee, "You feel yourself teleporting, but are suddenly flung back to where you just were!")
@@ -769,7 +772,7 @@
/// Prevents a user from entering a jaunt.
/obj/item/organ/internal/cyberimp/chest/bluespace_anchor/proc/on_jaunt(mob/living/jaunter)
- SIGNAL_HANDLER // COMSIG_MOB_PRE_JAUNT
+ SIGNAL_HANDLER // COMSIG_MOB_PRE_JAUNT
to_chat(jaunter, "As you attempt to jaunt, you slam directly into the barrier between realities and are sent crashing back into corporeality!")