Files
siliconsGitHubVM_USER <VM_USER>silicons
fd5e67ff71 runtime maploading: fifth time is the charm (#5524)
Co-authored-by: VM_USER <VM_USER>
Co-authored-by: silicons <no@you.cat>
2023-06-15 19:21:14 +02:00

147 lines
6.1 KiB
Plaintext

/**
* old shitcode
* you are not allowed to use this for new
*/
// Most of this file has been changed to use the Eris-style PA announcements.
// You'll need to compare externally, or use your best judgement when merging.
/var/datum/legacy_announcement/priority/priority_announcement = new(do_log = 0)
/var/datum/legacy_announcement/priority/command/command_announcement = new(do_log = 0, do_newscast = 1)
/datum/legacy_announcement
var/title = "Attention"
var/announcer = ""
var/log = 0
var/sound
var/newscast = 0
var/channel_name = "Station Announcements"
var/announcement_type = "Announcement"
/datum/legacy_announcement/New(do_log = 0, new_sound = null, do_newscast = 0)
sound = new_sound
log = do_log
newscast = do_newscast
/datum/legacy_announcement/priority/New(do_log = 1, new_sound = 'sound/misc/notice2.ogg', do_newscast = 0)
..(do_log, new_sound, do_newscast)
title = "Priority Announcement"
announcement_type = "Priority Announcement"
/datum/legacy_announcement/priority/command/New(do_log = 1, new_sound = 'sound/misc/notice2.ogg', do_newscast = 0)
..(do_log, new_sound, do_newscast)
title = "[command_name()] Update"
announcement_type = "[command_name()] Update"
/datum/legacy_announcement/priority/security/New(do_log = 1, new_sound = 'sound/misc/notice2.ogg', do_newscast = 0)
..(do_log, new_sound, do_newscast)
title = "Security Announcement"
announcement_type = "Security Announcement"
/datum/legacy_announcement/proc/Announce(message as text, new_title = "", new_sound = null, do_newscast = newscast, msg_sanitized = 0, zlevel)
if(!message)
return
var/message_title = new_title ? new_title : title
var/message_sound = new_sound ? new_sound : sound
if(!msg_sanitized)
message = sanitize(message, extra = 0)
message_title = sanitizeSafe(message_title)
var/list/zlevels
if(zlevel && zlevel >= 1)
zlevels = (LEGACY_MAP_DATUM).get_map_levels(zlevel, TRUE)
else if(zlevel && zlevel == -1)//If we get a -1 just announce it to every z, safes us some loops else where
zlevels = list()
for(var/z in 1 to world.maxz)
zlevels += z
Message(message, message_title, zlevels)
if(do_newscast)
NewsCast(message, message_title)
Sound(message_sound, zlevels)
Log(message, message_title)
/datum/legacy_announcement/proc/Message(message as text, message_title as text, list/zlevels)
for(var/mob/M in GLOB.player_list)
if(!istype(M,/mob/new_player) && !isdeaf(M))
to_chat(M, "<h2 class='alert'>[title]</h2>")
to_chat(M, "<span class='alert'>[message]</span>")
if (announcer)
to_chat(M, "<span class='alert'> -[html_encode(announcer)]</span>")
/datum/legacy_announcement/minor/Message(message as text, message_title as text, list/zlevels)
GLOB.global_announcer.autosay(message, announcer ? announcer : ANNOUNCER_NAME, channel = "Common", zlevels = zlevels)
/datum/legacy_announcement/priority/Message(message as text, message_title as text, list/zlevels)
GLOB.global_announcer.autosay("<span class='alert'>[message_title]:</span> [message]", announcer ? announcer : ANNOUNCER_NAME, channel = "Common", zlevels = zlevels)
/datum/legacy_announcement/priority/command/Message(message as text, message_title as text, list/zlevels)
GLOB.global_announcer.autosay("<span class='alert'>[command_name()] - [message_title]:</span> [message]", ANNOUNCER_NAME, channel = "Common", zlevels = zlevels)
/datum/legacy_announcement/priority/security/Message(message as text, message_title as text, list/zlevels)
GLOB.global_announcer.autosay("<span class='alert'>[message_title]:</span> [message]", ANNOUNCER_NAME, channel = "Common", zlevels = zlevels)
/datum/legacy_announcement/proc/NewsCast(message as text, message_title as text)
if(!newscast)
return
var/datum/news_announcement/news = new
news.channel_name = channel_name
news.author = announcer
news.message = message
news.message_type = announcement_type
news.can_be_redacted = 0
INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(announce_newscaster_news), news)
/datum/legacy_announcement/proc/PlaySound(message_sound, list/zlevels)
for(var/mob/M in GLOB.player_list)
if(zlevels && !(M.z in zlevels))
continue
if(!istype(M,/mob/new_player) && !isdeaf(M))
SEND_SOUND(M, 'sound/soundbytes/announcer/preamble.ogg')
if(!message_sound)
return
spawn(22) // based on length of preamble.ogg + arbitrary delay
for(var/mob/M in GLOB.player_list)
if(zlevels && !(M.z in zlevels))
continue
if(!istype(M,/mob/new_player) && !isdeaf(M))
SEND_SOUND(M, message_sound)
/datum/legacy_announcement/proc/Sound(message_sound, list/zlevels)
PlaySound(message_sound, zlevels)
/datum/legacy_announcement/priority/Sound(message_sound)
if(message_sound)
SEND_SOUND(world, message_sound)
/datum/legacy_announcement/priority/command/Sound(message_sound)
PlaySound(message_sound)
/datum/legacy_announcement/proc/Log(message as text, message_title as text)
if(log)
log_game("[key_name(usr)] has made \a [announcement_type]: [message_title] - [message] - [announcer]")
message_admins("[key_name_admin(usr)] has made \a [announcement_type].", 1)
/proc/GetNameAndAssignmentFromId(obj/item/card/id/I)
// Format currently matches that of newscaster feeds: Registered Name (Assigned Rank)
return I.assignment ? "[I.registered_name] ([I.assignment])" : I.registered_name
/proc/level_seven_announcement()
command_announcement.Announce("Confirmed outbreak of level 7 biohazard aboard \the [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/outbreak7.ogg')
/proc/ion_storm_announcement()
command_announcement.Announce("It has come to our attention that \the [station_name()] passed through an ion storm. Please monitor all electronic equipment for malfunctions.", "Anomaly Alert")
/proc/AnnounceArrival(mob/living/carbon/human/character, rank, join_message)
if (SSticker.current_state == GAME_STATE_PLAYING)
if(character.mind.role_alt_title)
rank = character.mind.role_alt_title
AnnounceArrivalSimple(character.real_name, rank, join_message)
/proc/AnnounceArrivalSimple(name, rank = "visitor", join_message = "will arrive at the station shortly")
GLOB.global_announcer.autosay(join_message, "Arrivals Announcement Computer")