mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 04:57:57 +01:00
Better looking ghost notifications (#79139)
## About The Pull Request The alerts have been given some style  Also the screen tip should be quite obvious  Cleaned up some code around the proc itself - really needed some TLC. That, and added an arg to minor announcements to override colors. ## Why It's Good For The Game Better styling for alerts ## Changelog 🆑 add: Just in time for Halloween- ghost notifications have been upgraded to their own announcements. Boo! /🆑 --------- Co-authored-by: san7890 <the@san7890.com>
This commit is contained in:
@@ -107,8 +107,9 @@
|
||||
* players - optional, a list mobs to send the announcement to. If unset, sends to all palyers.
|
||||
* sound_override - optional, use the passed sound file instead of the default notice sounds.
|
||||
* should_play_sound - Whether the notice sound should be played or not.
|
||||
* color_override - optional, use the passed color instead of the default notice color.
|
||||
*/
|
||||
/proc/minor_announce(message, title = "Attention:", alert = FALSE, html_encode = TRUE, list/players = null, sound_override = null, should_play_sound = TRUE)
|
||||
/proc/minor_announce(message, title = "Attention:", alert = FALSE, html_encode = TRUE, list/players, sound_override, should_play_sound = TRUE, color_override)
|
||||
if(!message)
|
||||
return
|
||||
|
||||
@@ -120,7 +121,11 @@
|
||||
minor_announcement_strings += MINOR_ANNOUNCEMENT_TITLE(title)
|
||||
minor_announcement_strings += MINOR_ANNOUNCEMENT_TEXT(message)
|
||||
|
||||
var/finalized_announcement = CHAT_ALERT_DEFAULT_SPAN(jointext(minor_announcement_strings, "<br>"))
|
||||
var/finalized_announcement
|
||||
if(color_override)
|
||||
finalized_announcement = CHAT_ALERT_COLORED_SPAN(color_override, jointext(minor_announcement_strings, "<br>"))
|
||||
else
|
||||
finalized_announcement = CHAT_ALERT_DEFAULT_SPAN(jointext(minor_announcement_strings, "<br>"))
|
||||
|
||||
var/custom_sound = sound_override || (alert ? 'sound/misc/notice1.ogg' : 'sound/misc/notice2.ogg')
|
||||
dispatch_announcement_to_players(finalized_announcement, players, custom_sound, should_play_sound)
|
||||
|
||||
@@ -776,22 +776,24 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
|
||||
dead_owner.reenter_corpse()
|
||||
|
||||
/atom/movable/screen/alert/notify_action
|
||||
name = "Body created"
|
||||
desc = "A body was created. You can enter it."
|
||||
name = "Something interesting is happening!"
|
||||
desc = "This can be clicked on to perform an action."
|
||||
icon_state = "template"
|
||||
timeout = 300
|
||||
var/atom/target = null
|
||||
timeout = 30 SECONDS
|
||||
/// The target to use the action on
|
||||
var/atom/target
|
||||
/// Which on click action to use
|
||||
var/action = NOTIFY_JUMP
|
||||
|
||||
/atom/movable/screen/alert/notify_action/Click()
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
if(!target)
|
||||
if(isnull(target))
|
||||
return
|
||||
|
||||
var/mob/dead/observer/ghost_owner = owner
|
||||
if(!istype(ghost_owner))
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if(NOTIFY_ATTACK)
|
||||
target.attack_ghost(ghost_owner)
|
||||
|
||||
@@ -258,62 +258,58 @@
|
||||
* * notify_suiciders If it should notify suiciders (who do not qualify for many ghost roles)
|
||||
* * notify_volume How loud the sound should be to spook the user
|
||||
*/
|
||||
/proc/notify_ghosts(message, ghost_sound, enter_link, atom/source, mutable_appearance/alert_overlay, action = NOTIFY_JUMP, flashwindow = TRUE, ignore_mapload = TRUE, ignore_key, header, notify_suiciders = TRUE, notify_volume = 100) //Easy notification of ghosts.
|
||||
/proc/notify_ghosts(
|
||||
message,
|
||||
ghost_sound,
|
||||
enter_link,
|
||||
atom/source,
|
||||
mutable_appearance/alert_overlay,
|
||||
action = NOTIFY_JUMP,
|
||||
flashwindow = TRUE,
|
||||
ignore_mapload = TRUE,
|
||||
ignore_key,
|
||||
header,
|
||||
notify_suiciders = TRUE,
|
||||
notify_volume = 100
|
||||
)
|
||||
|
||||
if(ignore_mapload && SSatoms.initialized != INITIALIZATION_INNEW_REGULAR) //don't notify for objects created during a map load
|
||||
return
|
||||
|
||||
var/list/viewers = list()
|
||||
for(var/mob/dead/observer/ghost in GLOB.player_list)
|
||||
if(!notify_suiciders && HAS_TRAIT(ghost, TRAIT_SUICIDED))
|
||||
continue
|
||||
if(ignore_key && (ghost.ckey in GLOB.poll_ignore[ignore_key]))
|
||||
continue
|
||||
var/orbit_link
|
||||
if(source && action == NOTIFY_ORBIT)
|
||||
orbit_link = " <a href='?src=[REF(ghost)];follow=[REF(source)]'>(Orbit)</a>"
|
||||
to_chat(ghost, span_ghostalert("[message][(enter_link) ? " [enter_link]" : ""][orbit_link]"))
|
||||
if(ghost_sound)
|
||||
SEND_SOUND(ghost, sound(ghost_sound, volume = notify_volume))
|
||||
|
||||
viewers += ghost // This mob will see the alert
|
||||
|
||||
if(flashwindow)
|
||||
window_flash(ghost.client)
|
||||
if(!source)
|
||||
continue
|
||||
var/atom/movable/screen/alert/notify_action/alert = ghost.throw_alert("[REF(source)]_notify_action", /atom/movable/screen/alert/notify_action)
|
||||
if(!alert)
|
||||
continue
|
||||
var/ui_style = ghost.client?.prefs?.read_preference(/datum/preference/choiced/ui_style)
|
||||
if(ui_style)
|
||||
alert.icon = ui_style2icon(ui_style)
|
||||
if (header)
|
||||
alert.name = header
|
||||
alert.desc = message
|
||||
alert.action = action
|
||||
alert.target = source
|
||||
if(!alert_overlay)
|
||||
alert_overlay = new(source)
|
||||
alert_overlay.pixel_x = 0
|
||||
alert_overlay.pixel_y = 0
|
||||
var/icon/size_check = icon(source.icon, source.icon_state)
|
||||
var/scale = 1
|
||||
var/width = size_check.Width()
|
||||
var/height = size_check.Height()
|
||||
if(width > world.icon_size)
|
||||
alert_overlay.pixel_x = -(world.icon_size / 2) * ((width - world.icon_size) / world.icon_size)
|
||||
if(height > world.icon_size)
|
||||
alert_overlay.pixel_y = -(world.icon_size / 2) * ((height - world.icon_size) / world.icon_size)
|
||||
if(width > world.icon_size || height > world.icon_size)
|
||||
if(width >= height)
|
||||
scale = world.icon_size / width
|
||||
else
|
||||
scale = world.icon_size / height
|
||||
alert_overlay.transform = alert_overlay.transform.Scale(scale)
|
||||
alert_overlay.appearance_flags |= TILE_BOUND
|
||||
alert_overlay.layer = FLOAT_LAYER
|
||||
alert_overlay.plane = FLOAT_PLANE
|
||||
alert.add_overlay(alert_overlay)
|
||||
|
||||
/**
|
||||
* Heal a robotic body part on a mob
|
||||
*/
|
||||
if(isnull(source))
|
||||
continue
|
||||
|
||||
var/atom/movable/screen/alert/notify_action/toast = ghost.throw_alert(
|
||||
category = "[REF(source)]_notify_action",
|
||||
type = /atom/movable/screen/alert/notify_action,
|
||||
new_master = source,
|
||||
)
|
||||
toast.action = action
|
||||
toast.desc = "Click to [action]."
|
||||
toast.name = header
|
||||
toast.target = source
|
||||
|
||||
var/orbit_link
|
||||
if(source && action == NOTIFY_ORBIT)
|
||||
orbit_link = " <a href='?src=[REF(usr)];follow=[REF(source)]'>(Orbit)</a>"
|
||||
|
||||
var/text = "[message][(enter_link) ? " [enter_link]" : ""][orbit_link]"
|
||||
|
||||
minor_announce(text, title = header, players = viewers, html_encode = FALSE, sound_override = ghost_sound, color_override = "purple")
|
||||
|
||||
/// Heals a robotic limb on a mob
|
||||
/proc/item_heal_robotic(mob/living/carbon/human/human, mob/user, brute_heal, burn_heal)
|
||||
var/obj/item/bodypart/affecting = human.get_bodypart(check_zone(user.zone_selected))
|
||||
if(!affecting || IS_ORGANIC_LIMB(affecting))
|
||||
|
||||
Reference in New Issue
Block a user