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

refactor: span в define [part 1] #6640

Open
wants to merge 3 commits into
base: master220
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion code/__DEFINES/span.dm
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
#define span_combatuserdanger(str) ("<span class='combat userdanger'>" + str + "</span>")
#define span_darkmblue(str) ("<span class='darkmblue'>" + str + "</span>")
#define span_boldmessage(str) ("<span class='boldmessage'>" + str + "</span>")
#define span_message(str) ("<span class='message'>" + str + "</span>")
#define span_adminchannel(str) ("<span class='admin_channel'>" + str + "</span>")
#define span_adminticket(str) ("<span class='adminticket'>" + str + "</span>")
#define span_error(str) ("<span class='error'>" + str + "</span>")
Expand All @@ -160,7 +161,8 @@
#define span_specialnoticebold(str) ("<span class='specialnoticebold'>" + str + "</span>")
#define span_moderate(str) ("<span class='moderate'>" + str + "</span>")
#define span_shadowling(str) ("<span class='shadowling'>" + str + "</span>")

#define span_motd(str) ("<span class='motd'>" + str + "</span>")
#define span_emojienabled(str) ("<span class='emoji_enabled'>" + str + "</span>")

// Spans that use embedded tgui components:
// Sorted alphabetically
Expand Down
4 changes: 2 additions & 2 deletions code/__HELPERS/_logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,14 @@ GLOBAL_PROTECT(log_end)
* Standardized method for tracking startup times.
*/
/proc/log_startup_progress_global(prefix, message)
to_chat(world, "<span class='danger'><small>\[[prefix]]</small> [message]</span>")
to_chat(world, span_danger("<small>\[[prefix]]</small> [message]"))
log_world("\[[prefix]] [message]")

// A logging proc that only outputs after setup is done, to
// help devs test initialization stuff that happens a lot
/proc/log_after_setup(var/message)
if(SSticker && SSticker.current_state > GAME_STATE_SETTING_UP)
to_chat(world, "<span class='danger'>[message]</span>")
to_chat(world, span_danger("[message]"))
log_world(message)

/* For logging round startup. */
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
R.client.screen += module_store_icon //"store" icon

if(!R.module.modules)
to_chat(usr, "<span class='danger'>Selected module has no modules to select.</span>")
to_chat(usr, span_danger("Selected module has no modules to select."))
return

if(!R.robot_modules_background)
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
*/
/datum/controller/proc/log_startup_progress(message)
Master.last_init_info = "([name]): [message]"
to_chat(world, "<span class='danger'><small>\[[name]]</small> [message]</span>")
to_chat(world, span_danger("<small>\[[name]]</small> [message]"))
log_world("\[[name]] [message]")
4 changes: 2 additions & 2 deletions code/controllers/master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
msg = "The [BadBoy.name] subsystem was the last to fire for 2 controller restarts. It will be recovered now and disabled if it happens again."
FireHim = TRUE
if(3)
msg = "The [BadBoy.name] subsystem seems to be destabilizing the MC and will be offlined. <span class='info'>The following implications are now in effect: [BadBoy.offline_implications]</span>"
msg = "The [BadBoy.name] subsystem seems to be destabilizing the MC and will be offlined. [span_info("The following implications are now in effect: [BadBoy.offline_implications]")]"
BadBoy.flags |= SS_NO_FIRE
if(msg)
to_chat(GLOB.admins, span_boldannounceooc("[msg]"))
Expand Down Expand Up @@ -375,7 +375,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
last_init_info = "([subsystem.name]): [message]"

if(result != SS_INIT_NO_MESSAGE)
to_chat(world, "<span class='danger'><small>\[[subsystem.name]]</small> [chat_message]</span>")
to_chat(world, span_danger("<small>\[[subsystem.name]]</small> [chat_message]"))

log_world("\[[subsystem.name]] [message]")

Expand Down
10 changes: 5 additions & 5 deletions code/controllers/subsystem/afk.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,31 @@ SUBSYSTEM_DEF(afk)

if(!afk_players[H.ckey])
afk_players[H.ckey] = AFK_WARNED
warn(H, "<span class='danger'>You are AFK for [mins_afk] minutes. You will be cryod after [CONFIG_GET(number/auto_cryo_afk)] total minutes and fully despawned after [CONFIG_GET(number/auto_despawn_afk)] total minutes. Please move or click in game if you want to avoid being despawned.</span>")
warn(H, span_danger("You are AFK for [mins_afk] minutes. You will be cryod after [CONFIG_GET(number/auto_cryo_afk)] total minutes and fully despawned after [CONFIG_GET(number/auto_despawn_afk)] total minutes. Please move or click in game if you want to avoid being despawned."))
else
var/area/A = T.loc // Turfs loc is the area
if(afk_players[H.ckey] == AFK_WARNED)
if(mins_afk >= CONFIG_GET(number/auto_cryo_afk) && A.can_get_auto_cryod)
if(A.fast_despawn)
toRemove += H.ckey
warn(H, "<span class='danger'>You have been despawned after being AFK for [mins_afk] minutes. You have been despawned instantly due to you being in a secure area.</span>")
warn(H, span_danger("You have been despawned after being AFK for [mins_afk] minutes. You have been despawned instantly due to you being in a secure area."))
log_afk_action(H, mins_afk, T, "despawned", "AFK in a fast despawn area")
force_cryo_human(H)
else
if(!(H.mind.special_role in non_cryo_antags))
if(cryo_ssd(H))
afk_players[H.ckey] = AFK_CRYOD
log_afk_action(H, mins_afk, T, "put into cryostorage")
warn(H, "<span class='danger'>You are AFK for [mins_afk] minutes and have been moved to cryostorage. \
warn(H, span_danger("You are AFK for [mins_afk] minutes and have been moved to cryostorage. \
After being AFK for another [CONFIG_GET(number/auto_despawn_afk)] minutes you will be fully despawned. \
Please eject yourself (right click, eject) out of the cryostorage if you want to avoid being despawned.</span>")
Please eject yourself (right click, eject) out of the cryostorage if you want to avoid being despawned."))
else
message_admins("[key_name_admin(H)] at [ADMIN_VERBOSEJMP(T)] is AFK for [mins_afk] and can't be automatically cryod due to it's antag status: ([H.mind.special_role]).")
afk_players[H.ckey] = AFK_ADMINS_WARNED

else if(afk_players[H.ckey] != AFK_ADMINS_WARNED && mins_afk >= CONFIG_GET(number/auto_despawn_afk))
log_afk_action(H, mins_afk, T, "despawned")
warn(H, "<span class='danger'>You have been despawned after being AFK for [mins_afk] minutes.</span>")
warn(H, span_danger("You have been despawned after being AFK for [mins_afk] minutes."))
toRemove += H.ckey
force_cryo_human(H)

Expand Down
6 changes: 3 additions & 3 deletions code/controllers/subsystem/dbcore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ SUBSYSTEM_DEF(dbcore)
if(!.)
SSdbcore.total_errors++
if(usr)
to_chat(usr, "<span class='danger'>A SQL error occurred during this operation, please inform an admin or a coder.</span>")
to_chat(usr, span_danger("A SQL error occurred during this operation, please inform an admin or a coder."))
message_admins("An SQL error has occured. Please check the server logs, with the following timestamp ID: \[[time_stamp()]]")

/**
Expand Down Expand Up @@ -563,12 +563,12 @@ SUBSYSTEM_DEF(dbcore)
set category = "Debug"
set name = "Reestablish DB Connection"
if(!CONFIG_GET(flag/sql_enabled))
to_chat(usr, "<span class='warning'>The Database is not enabled in the server configuration!</span>")
to_chat(usr, span_warning("The Database is not enabled in the server configuration!"))
return

if(SSdbcore.IsConnected())
if(!check_rights(R_ADMIN, FALSE) || !check_rights(R_DEBUG, FALSE)) //we dont want coders to deal with db
to_chat(usr, "<span class='warning'>The database is already connected! (Only those with +DEBUG can force a reconnection)</span>")
to_chat(usr, span_warning("The database is already connected! (Only those with +DEBUG can force a reconnection)"))
return

var/reconnect = alert("The database is already connected! If you *KNOW* that this is incorrect, you can force a reconnection", "The database is already connected!", "Force Reconnect", "Cancel")
Expand Down
14 changes: 7 additions & 7 deletions code/controllers/subsystem/ghost_spawns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ SUBSYSTEM_DEF(ghost_spawns)
if(isatom(source))
act_jump = "<a href='byond://?src=[M.UID()];jump=\ref[source]'>\[Teleport]</a>"
var/act_signup = "<a href='byond://?src=[A.UID()];signup=1'>\[Sign Up]</a>"
to_chat(M, "<big><span class='boldnotice'>Now looking for candidates [role ? "to play as \an [role_cleanname || role]" : "\"[question]\""]. [act_jump] [act_signup] [reason?"<i>\nReason: [reason]</i>":""]</span></big>")
to_chat(M, span_boldnotice("<big>Now looking for candidates [role ? "to play as \an [role_cleanname || role]" : "\"[question]\""]. [act_jump] [act_signup] [reason?"<i>\nReason: [reason]</i>":""]</big>"))

// Start processing it so it updates visually the timer
START_PROCESSING(SSprocessing, A)
Expand Down Expand Up @@ -249,18 +249,18 @@ SUBSYSTEM_DEF(ghost_spawns)
return
if(M in signed_up)
if(!silent)
to_chat(M, "<span class='warning'>You have already signed up for this!</span>")
to_chat(M, span_warning("You have already signed up for this!"))
return

if(time_left() <= 0)
if(!silent)
to_chat(M, "<span class='danger'>Sorry, you were too late for the consideration!</span>")
to_chat(M, span_danger("Sorry, you were too late for the consideration!"))
SEND_SOUND(M, sound('sound/machines/buzz-sigh.ogg'))
return

signed_up += M
if(!silent)
to_chat(M, "<span class='notice'>You have signed up for this role! A candidate will be picked randomly soon.</span>")
to_chat(M, span_notice("You have signed up for this role! A candidate will be picked randomly soon."))
// Sign them up for any other polls with the same mob type
for(var/existing_poll in SSghost_spawns.currently_polling)
var/datum/candidate_poll/P = existing_poll
Expand All @@ -283,17 +283,17 @@ SUBSYSTEM_DEF(ghost_spawns)
return
if(!(M in signed_up))
if(!silent)
to_chat(M, "<span class='warning'>You aren't signed up for this!</span>")
to_chat(M, span_warning("You aren't signed up for this!"))
return

if(time_left() <= 0)
if(!silent)
to_chat(M, "<span class='danger'>It's too late to unregister yourself, selection has already begun!</span>")
to_chat(M, span_danger("It's too late to unregister yourself, selection has already begun!"))
return

signed_up -= M
if(!silent)
to_chat(M, "<span class='notice'>You have been unregistered as a candidate for this role. You can freely sign up again before the poll ends.</span>")
to_chat(M, span_notice("You have been unregistered as a candidate for this role. You can freely sign up again before the poll ends."))

for(var/existing_poll in SSghost_spawns.currently_polling)
var/datum/candidate_poll/P = existing_poll
Expand Down
18 changes: 9 additions & 9 deletions code/controllers/subsystem/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ SUBSYSTEM_DEF(jobs)
occupations = list()
var/list/all_jobs = subtypesof(/datum/job)
if(!all_jobs.len)
to_chat(world, "<span class='warning'>Ошибка выдачи профессий, датумы профессий не найдены.</span>")
to_chat(world, span_warning("Ошибка выдачи профессий, датумы профессий не найдены."))
return

for(var/J in all_jobs)
Expand Down Expand Up @@ -429,7 +429,7 @@ SUBSYSTEM_DEF(jobs)
Debug("AC2 Assistant located, Player: [player]")
AssignRole(player, JOB_TITLE_CIVILIAN)
else if(player.client.prefs.alternate_option == RETURN_TO_LOBBY)
to_chat(player, "<span class='danger'>Unfortunately, none of the round start roles you selected had a free slot. Please join the game by using \"Join Game!\" button and selecting a role with a free slot.</span>")
to_chat(player, span_danger("Unfortunately, none of the round start roles you selected had a free slot. Please join the game by using \"Join Game!\" button and selecting a role with a free slot."))
player.ready = 0
unassigned -= player

Expand All @@ -451,8 +451,8 @@ SUBSYSTEM_DEF(jobs)

CreateMoneyAccount(H, rank, job)
var/list/L = list()
L.Add("<B>Вы <span class='red'>[alt_title ? alt_title : rank]</span>.</B>")
L.Add("<b>На этой должности вы отвечаете непосредственно перед <span class='red'>[replacetext(job.supervisors,"the ","")]</span>. Особые обстоятельства могут это изменить.</b>")
L.Add("<B>Вы [span_red(alt_title ? alt_title : rank)].</B>")
L.Add("<b>На этой должности вы отвечаете непосредственно перед [span_red(replacetext(job.supervisors,"the ",""))]. Особые обстоятельства могут это изменить.</b>")
L.Add("<b>Для получения дополнительной информации о работе на станции, см. <a href=\"[CONFIG_GET(string/wikiurl)]/index.php/Standard_Operating_Procedure\">Стандартные Рабочие Процедуры (СРП)</a></b>")
if(job.is_service)
L.Add("<b>Будучи работником отдела Обслуживания, убедитесь что прочли <a href=\"[CONFIG_GET(string/wikiurl)]/index.php/Standard_Operating_Procedure_&#40;Service&#41\">СРП своего отдела</a></b>")
Expand Down Expand Up @@ -682,7 +682,7 @@ SUBSYSTEM_DEF(jobs)
H.mind.initial_account.insurance = INSURANCE_NT_SPECIAL

spawn(0)
to_chat(H, "<span class='boldnotice'>Номер вашего аккаунта: [M.account_number], ПИН вашего аккаунта: [M.remote_access_pin]</span>")
to_chat(H, span_boldnotice("Номер вашего аккаунта: [M.account_number], ПИН вашего аккаунта: [M.remote_access_pin]"))

/datum/controller/subsystem/jobs/proc/format_jobs_for_id_computer(obj/item/card/id/tgtcard)
var/list/jobs_to_formats = list()
Expand Down Expand Up @@ -878,25 +878,25 @@ SUBSYSTEM_DEF(jobs)
added_living += minutes

if(announce)
to_chat(C.mob, "<span class='notice'>You got: [minutes] Living EXP!</span>")
to_chat(C.mob, span_notice("You got: [minutes] Living EXP!"))

for(var/category in GLOB.exp_jobsmap)
if(GLOB.exp_jobsmap[category]["titles"])
if(myrole in GLOB.exp_jobsmap[category]["titles"])
play_records[C.ckey][category] += minutes
if(announce)
to_chat(C.mob, "<span class='notice'>You got: [minutes] [category] EXP!</span>")
to_chat(C.mob, span_notice("You got: [minutes] [category] EXP!"))

if(C.mob.mind.special_role)
play_records[C.ckey][EXP_TYPE_SPECIAL] += minutes
if(announce)
to_chat(C.mob, "<span class='notice'>You got: [minutes] Special EXP!</span>")
to_chat(C.mob, span_notice("You got: [minutes] Special EXP!"))

else if(isobserver(C.mob))
play_records[C.ckey][EXP_TYPE_GHOST] += minutes
added_ghost += minutes
if(announce)
to_chat(C.mob, "<span class='notice'>You got: [minutes] Ghost EXP!</span>")
to_chat(C.mob, span_notice("You got: [minutes] Ghost EXP!"))
else
continue

Expand Down
4 changes: 2 additions & 2 deletions code/controllers/subsystem/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,12 @@ SUBSYSTEM_DEF(mapping)
if(map_datum_path)
map_datum = new map_datum_path
else
to_chat(world, "<span class='danger'>ERROR: The map datum specified to load is invalid. Falling back to... delta probably?</span>")
to_chat(world, span_danger("ERROR: The map datum specified to load is invalid. Falling back to... delta probably?"))

ASSERT(map_datum.map_path)
if(!fexists(map_datum.map_path))
// Make a VERY OBVIOUS error
to_chat(world, "<span class='userdanger'>ERROR: The path specified for the map to load is invalid. No station has been loaded!</span>")
to_chat(world, span_userdanger("ERROR: The path specified for the map to load is invalid. No station has been loaded!"))
return

var/watch = start_watch()
Expand Down
12 changes: 6 additions & 6 deletions code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ SUBSYSTEM_DEF(ticker)
if(GAME_STATE_STARTUP)
// This is ran as soon as the MC starts firing, and should only run ONCE, unless startup fails
round_start_time = world.time + (CONFIG_GET(number/pregame_timestart) SECONDS)
to_chat(world, "<B><span class='darkmblue'>Welcome to the pre-game lobby!</span></B>")
to_chat(world, span_darkmblue("<B>Welcome to the pre-game lobby!</B>"))
to_chat(world, "Please, setup your character and select ready. Game will start in [CONFIG_GET(number/pregame_timestart)] seconds")
current_state = GAME_STATE_PREGAME
fire() // TG says this is a good idea
Expand Down Expand Up @@ -237,7 +237,7 @@ SUBSYSTEM_DEF(ticker)

var/has_antags = (length(P.client.prefs.be_special) > 0)
if(!P.client.prefs.check_any_job())
to_chat(P, "<span class='danger'>You have no jobs enabled, along with return to lobby if job is unavailable. This makes you ineligible for any round start role, please update your job preferences.</span>")
to_chat(P, span_danger("You have no jobs enabled, along with return to lobby if job is unavailable. This makes you ineligible for any round start role, please update your job preferences."))
if(has_antags)
// We add these to a list so we can deal with them as a batch later
flagged_antag_rollers |= P.ckey
Expand Down Expand Up @@ -345,11 +345,11 @@ SUBSYSTEM_DEF(ticker)
qdel(S)

SSdbcore.SetRoundStart()
to_chat(world, "<span class='darkmblue'><B>Enjoy the game!</B></span>")
to_chat(world, span_darkmblue("<B>Enjoy the game!</B>"))
SEND_SOUND(world, sound('sound/AI/welcome.ogg'))

if(SSholiday.holidays)
to_chat(world, "<span class='darkmblue'>and...</span>")
to_chat(world, span_darkmblue("and..."))
for(var/holidayname in SSholiday.holidays)
var/datum/holiday/holiday = SSholiday.holidays[holidayname]
to_chat(world, "<h4>[holiday.greet()]</h4>")
Expand Down Expand Up @@ -533,7 +533,7 @@ SUBSYSTEM_DEF(ticker)
m = pick(memetips)

if(m)
to_chat(world, "<span class='purple'><b>Совет раунда: </b>[html_encode(m)]</span>")
to_chat(world, span_purple("<b>Совет раунда: </b>[html_encode(m)]"))


/datum/controller/subsystem/ticker/proc/declare_completion()
Expand Down Expand Up @@ -601,7 +601,7 @@ SUBSYSTEM_DEF(ticker)
for(var/team_type in GLOB.antagonist_teams)
var/datum/team/team = GLOB.antagonist_teams[team_type]
team.declare_completion()

mode.declare_completion()//To declare normal completion.

//calls auto_declare_completion_* for all modes
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/tickets/mentor_tickets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ GLOBAL_REAL(SSmentor_tickets, /datum/controller/subsystem/tickets/mentor_tickets

/datum/controller/subsystem/tickets/mentor_tickets/Initialize()
close_messages = list("<font color='red' size='3'><b>- [ticket_name] Закрыт -</b></font>",
"<span class='boldmessage'>Пожалуйста, постарайтесь быть как можно более описательными в тикетах. Менторы не знают всей ситуации, в которой вы находитесь, и нуждаются в дополнительной информации, чтобы дать вам полезный ответ.</span>",
span_boldmessage("Пожалуйста, постарайтесь быть как можно более описательными в тикетах. Менторы не знают всей ситуации, в которой вы находитесь, и нуждаются в дополнительной информации, чтобы дать вам полезный ответ."),
"<span class='[span_class]'>Ваш [ticket_name] теперь закрыт.</span>")
return ..()

Expand Down
Loading