Skip to content

Commit

Permalink
Ports two of my recent /tg/ PRs (#3896)
Browse files Browse the repository at this point in the history
* PDA ringtones now show a balloon alert (#87278)

This makes it so receiving a PDA message will give the holder a balloon
alert with their ringtone.

PDA messages are often ignored due to not being noticed, as many players
are more often focused on the main game screen (which runechat has
somewhat normalized) than the chat window. This makes things more
obvious that there's a PDA message.

:cl:
add: PDA ringtones now show a balloon alert to the PDA holder.
/:cl:

* Master-overlayed screen alerts (i.e aura healing) now use appearance cloning instead of directly overlaying the master (#87281)

## About The Pull Request

This reworks the `/mob/proc/throw_alert(new_master = ...)` to use
appearance cloning instead of just directly adding the master atom as an
overlay.

There's several advantages to this:
- We don't have to change anything about the original target at all
- Setting the plane/layer, adding the overlay, then resetting it to
before (as it does without this PR), feels like an awful hack ngl.
- We can ensure the target is always facing south, and has no pixel
x/y/z shift.

<details>
<summary><h3>Proof of testing / screenshots</h3></summary>

I had the healing rod holder standing on a table when the alert was
added, to ensure that the pixel_x/y/z reset worked.

![2024-10-17 (1729221218) ~
dreamseeker](https://github.com/user-attachments/assets/664abbef-d543-4d13-99ec-3264e05edfd8)
![2024-10-17 (1729221245) ~
dreamseeker](https://github.com/user-attachments/assets/6073dcd4-75e0-404a-bea1-6bea5fbd7591)

</details>

## Why It's Good For The Game

Ensures the aura healing alerts and such always look consistent - no
pixel offsets, always facing south, with more reliable code.

## Changelog
:cl:
refactor: Refactored how some screen alerts, such as aura healing, show
atom overlays.
/:cl:
  • Loading branch information
Absolucy authored Oct 21, 2024
1 parent 5671645 commit b5cbe6f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
16 changes: 9 additions & 7 deletions code/_onclick/hud/alert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@
thealert.owner = src

if(new_master)
var/old_layer = new_master.layer
var/old_plane = new_master.plane
new_master.layer = FLOAT_LAYER
new_master.plane = FLOAT_PLANE
thealert.add_overlay(new_master)
new_master.layer = old_layer
new_master.plane = old_plane
var/mutable_appearance/master_appearance = new(new_master)
master_appearance.appearance_flags = KEEP_TOGETHER
master_appearance.layer = FLOAT_LAYER
master_appearance.plane = FLOAT_PLANE
master_appearance.dir = SOUTH
master_appearance.pixel_x = new_master.base_pixel_x
master_appearance.pixel_y = new_master.base_pixel_y
master_appearance.pixel_z = 0 /* new_master.base_pixel_z */
thealert.add_overlay(master_appearance)
thealert.icon_state = "template" // We'll set the icon to the client's ui pref in reorganize_alerts()
thealert.master = new_master
else
Expand Down
7 changes: 5 additions & 2 deletions code/modules/modular_computers/computers/item/computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -503,12 +503,15 @@
playsound(src, sound, 50, TRUE)
loc.visible_message(span_notice("[icon2html(src)] [span_notice("The [src] displays a [origin.filedesc] notification: [alerttext]")]"))

/obj/item/modular_computer/proc/ring(ringtone) // bring bring
/obj/item/modular_computer/proc/ring(ringtone, list/balloon_alertees) // bring bring
if(HAS_TRAIT(SSstation, STATION_TRAIT_PDA_GLITCHED))
playsound(src, pick('sound/machines/twobeep_voice1.ogg', 'sound/machines/twobeep_voice2.ogg'), 50, TRUE)
else
playsound(src, 'sound/machines/twobeep_high.ogg', 50, TRUE)
audible_message("*[ringtone]*")
ringtone = "*[ringtone]*"
audible_message(ringtone)
for(var/mob/living/alertee in balloon_alertees)
alertee.balloon_alert(alertee, ringtone)

/obj/item/modular_computer/proc/send_sound()
playsound(src, 'sound/machines/terminal_success.ogg', 15, TRUE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@
to_chat(receiver_mob, span_infoplain("[icon2html(computer, receiver_mob)] <b>PDA message from [sender_title], </b>\"[inbound_message]\"[photo_message] [reply]"))

if (alert_able && should_ring)
computer.ring(ringtone)
computer.ring(ringtone, list(receiver_mob))

SStgui.update_uis(computer)
update_pictures_for_all()
Expand Down

0 comments on commit b5cbe6f

Please sign in to comment.