Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[s] Stealth box fix #27351

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions code/_onclick/hud/fullscreen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
39 changes: 2 additions & 37 deletions code/game/objects/items/weapons/bio_chips/bio_chip_stealth.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
. = ..()
Expand All @@ -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)
Expand Down
11 changes: 7 additions & 4 deletions code/modules/surgery/organs/augments_internal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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, "<span class='warning'>Your implant is unable to get a lock on anything in the pipes!</span>")
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("<span class='warning'>[user] makes an unusual buzzing sound as the air between them and [target] crackles.</span>", \
"<span class='warning'>The air between you and [target] begins to crackle audibly as the Binyat gets to work and heats up in your head!</span>")
Expand Down Expand Up @@ -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, "<span class='userdanger'>You feel yourself teleporting, but are suddenly flung back to where you just were!</span>")

Expand All @@ -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, "<span class='userdanger'>As you attempt to jaunt, you slam directly into the barrier between realities and are sent crashing back into corporeality!</span>")

Expand Down