mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 16:47:13 +01:00
Refactors most spans into span procs (#59645)
Converts most spans into span procs. Mostly used regex for this and sorted out any compile time errors afterwards so there could be some bugs. Was initially going to do defines, but ninja said to make it into a proc, and if there's any overhead, they can easily be changed to defines. Makes it easier to control the formatting and prevents typos when creating spans as it'll runtime if you misspell instead of silently failing. Reduces the code you need to write when writing spans, as you don't need to close the span as that's automatically handled by the proc. (Note from Lemon: This should be converted to defines once we update the minimum version to 514. Didn't do it now because byond pain and such)
This commit is contained in:
@@ -61,7 +61,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
msg += " Administrators have been informed."
|
||||
log_game("[key_name(src)] Has hit the per-minute topic limit of [mtl] topic calls in a given game minute")
|
||||
message_admins("[ADMIN_LOOKUPFLW(usr)] [ADMIN_KICK(usr)] Has hit the per-minute topic limit of [mtl] topic calls in a given game minute")
|
||||
to_chat(src, "<span class='danger'>[msg]</span>")
|
||||
to_chat(src, span_danger("[msg]"))
|
||||
return
|
||||
|
||||
var/stl = CONFIG_GET(number/second_topic_limit)
|
||||
@@ -74,7 +74,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
topiclimiter[SECOND_COUNT] = 0
|
||||
topiclimiter[SECOND_COUNT] += 1
|
||||
if (topiclimiter[SECOND_COUNT] > stl)
|
||||
to_chat(src, "<span class='danger'>Your previous action was ignored because you've done too many in a second</span>")
|
||||
to_chat(src, span_danger("Your previous action was ignored because you've done too many in a second"))
|
||||
return
|
||||
|
||||
// Tgui Topic middleware
|
||||
@@ -89,7 +89,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
|
||||
//byond bug ID:2256651
|
||||
if (asset_cache_job && (asset_cache_job in completed_asset_jobs))
|
||||
to_chat(src, "<span class='danger'>An error has been detected in how your client is receiving resources. Attempting to correct.... (If you keep seeing these messages you might want to close byond and reconnect)</span>")
|
||||
to_chat(src, span_danger("An error has been detected in how your client is receiving resources. Attempting to correct.... (If you keep seeing these messages you might want to close byond and reconnect)"))
|
||||
src << browse("...", "window=asset_cache_browser")
|
||||
return
|
||||
if (href_list["asset_cache_preload_data"])
|
||||
@@ -171,11 +171,11 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
if(CONFIG_GET(flag/automute_on) && !holder && last_message == message)
|
||||
src.last_message_count++
|
||||
if(src.last_message_count >= SPAM_TRIGGER_AUTOMUTE)
|
||||
to_chat(src, "<span class='danger'>You have exceeded the spam filter limit for identical messages. An auto-mute was applied.</span>")
|
||||
to_chat(src, span_danger("You have exceeded the spam filter limit for identical messages. An auto-mute was applied."))
|
||||
cmd_admin_mute(src, mute_type, 1)
|
||||
return TRUE
|
||||
if(src.last_message_count >= SPAM_TRIGGER_WARNING)
|
||||
to_chat(src, "<span class='danger'>You are nearing the spam filter limit for identical messages.</span>")
|
||||
to_chat(src, span_danger("You are nearing the spam filter limit for identical messages."))
|
||||
return FALSE
|
||||
else
|
||||
last_message = message
|
||||
@@ -277,10 +277,10 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
alert_mob_dupe_login = TRUE
|
||||
if(matches)
|
||||
if(C)
|
||||
message_admins("<span class='danger'><B>Notice: </B></span><span class='notice'>[key_name_admin(src)] has the same [matches] as [key_name_admin(C)].</span>")
|
||||
message_admins(span_danger("<B>Notice: </B></span><span class='notice'>[key_name_admin(src)] has the same [matches] as [key_name_admin(C)]."))
|
||||
log_admin_private("Notice: [key_name(src)] has the same [matches] as [key_name(C)].")
|
||||
else
|
||||
message_admins("<span class='danger'><B>Notice: </B></span><span class='notice'>[key_name_admin(src)] has the same [matches] as [key_name_admin(C)] (no longer logged in). </span>")
|
||||
message_admins(span_danger("<B>Notice: </B></span><span class='notice'>[key_name_admin(src)] has the same [matches] as [key_name_admin(C)] (no longer logged in). "))
|
||||
log_admin_private("Notice: [key_name(src)] has the same [matches] as [key_name(C)] (no longer logged in).")
|
||||
var/reconnecting = FALSE
|
||||
if(GLOB.player_details[ckey])
|
||||
@@ -301,16 +301,16 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
|
||||
if (byond_version >= 512)
|
||||
if (!byond_build || byond_build < 1386)
|
||||
message_admins("<span class='adminnotice'>[key_name(src)] has been detected as spoofing their byond version. Connection rejected.</span>")
|
||||
message_admins(span_adminnotice("[key_name(src)] has been detected as spoofing their byond version. Connection rejected."))
|
||||
add_system_note("Spoofed-Byond-Version", "Detected as using a spoofed byond version.")
|
||||
log_access("Failed Login: [key] - Spoofed byond version")
|
||||
qdel(src)
|
||||
|
||||
if (num2text(byond_build) in GLOB.blacklisted_builds)
|
||||
log_access("Failed login: [key] - blacklisted byond version")
|
||||
to_chat(src, "<span class='userdanger'>Your version of byond is blacklisted.</span>")
|
||||
to_chat(src, "<span class='danger'>Byond build [byond_build] ([byond_version].[byond_build]) has been blacklisted for the following reason: [GLOB.blacklisted_builds[num2text(byond_build)]].</span>")
|
||||
to_chat(src, "<span class='danger'>Please download a new version of byond. If [byond_build] is the latest, you can go to <a href=\"https://secure.byond.com/download/build\">BYOND's website</a> to download other versions.</span>")
|
||||
to_chat(src, span_userdanger("Your version of byond is blacklisted."))
|
||||
to_chat(src, span_danger("Byond build [byond_build] ([byond_version].[byond_build]) has been blacklisted for the following reason: [GLOB.blacklisted_builds[num2text(byond_build)]]."))
|
||||
to_chat(src, span_danger("Please download a new version of byond. If [byond_build] is the latest, you can go to <a href=\"https://secure.byond.com/download/build\">BYOND's website</a> to download other versions."))
|
||||
if(connecting_admin)
|
||||
to_chat(src, "As an admin, you are being allowed to continue using this version, but please consider changing byond versions")
|
||||
else
|
||||
@@ -337,7 +337,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
var/ceb = CONFIG_GET(number/client_error_build)
|
||||
var/cwv = CONFIG_GET(number/client_warn_version)
|
||||
if (byond_version < cev || (byond_version == cev && byond_build < ceb)) //Out of date client.
|
||||
to_chat(src, "<span class='danger'><b>Your version of BYOND is too old:</b></span>")
|
||||
to_chat(src, span_danger("<b>Your version of BYOND is too old:</b>"))
|
||||
to_chat(src, CONFIG_GET(string/client_error_message))
|
||||
to_chat(src, "Your version: [byond_version].[byond_build]")
|
||||
to_chat(src, "Required version: [cev].[ceb] or later")
|
||||
@@ -356,7 +356,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
msg += "Visit <a href=\"https://secure.byond.com/download\">BYOND's website</a> to get the latest version of BYOND.<br>"
|
||||
src << browse(msg, "window=warning_popup")
|
||||
else
|
||||
to_chat(src, "<span class='danger'><b>Your version of byond may be getting out of date:</b></span>")
|
||||
to_chat(src, span_danger("<b>Your version of byond may be getting out of date:</b>"))
|
||||
to_chat(src, CONFIG_GET(string/client_warn_message))
|
||||
to_chat(src, "Your version: [byond_version]")
|
||||
to_chat(src, "Required version to remove this message: [cwv] or later")
|
||||
@@ -413,7 +413,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
apply_clickcatcher()
|
||||
|
||||
if(prefs.lastchangelog != GLOB.changelog_hash) //bolds the changelog button on the interface so we know there are updates.
|
||||
to_chat(src, "<span class='info'>You have unread updates in the changelog.</span>")
|
||||
to_chat(src, span_info("You have unread updates in the changelog."))
|
||||
if(CONFIG_GET(flag/aggressive_changelog))
|
||||
changelog()
|
||||
else
|
||||
@@ -428,7 +428,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
convert_notes_sql(ckey)
|
||||
to_chat(src, get_message_output("message", ckey))
|
||||
if(!winexists(src, "asset_cache_browser")) // The client is using a custom skin, tell them.
|
||||
to_chat(src, "<span class='warning'>Unable to access asset cache browser, if you are using a custom skin file, please allow DS to download the updated version, if you are not, then make a bug report. This is not a critical issue but can cause issues with resource downloading, as it is impossible to know when extra resources arrived to you.</span>")
|
||||
to_chat(src, span_warning("Unable to access asset cache browser, if you are using a custom skin file, please allow DS to download the updated version, if you are not, then make a bug report. This is not a critical issue but can cause issues with resource downloading, as it is impossible to know when extra resources arrived to you."))
|
||||
|
||||
update_ambience_pref()
|
||||
|
||||
@@ -555,7 +555,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
if(minutes <= living_recs && !CONFIG_GET(flag/panic_bunker_interview))
|
||||
var/reject_message = "Failed Login: [key] - Account attempting to connect during panic bunker, but they do not have the required living time [minutes]/[living_recs]"
|
||||
log_access(reject_message)
|
||||
message_admins("<span class='adminnotice'>[reject_message]</span>")
|
||||
message_admins(span_adminnotice("[reject_message]"))
|
||||
var/message = CONFIG_GET(string/panic_bunker_message)
|
||||
message = replacetext(message, "%minutes%", living_recs)
|
||||
to_chat(src, message)
|
||||
@@ -563,7 +563,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
var/list/panic_addr = CONFIG_GET(string/panic_server_address)
|
||||
if(panic_addr && !connectiontopic_a["redirect"])
|
||||
var/panic_name = CONFIG_GET(string/panic_server_name)
|
||||
to_chat(src, "<span class='notice'>Sending you to [panic_name ? panic_name : panic_addr].</span>")
|
||||
to_chat(src, span_notice("Sending you to [panic_name ? panic_name : panic_addr]."))
|
||||
winset(src, null, "command=.options")
|
||||
src << link("[panic_addr]?redirect=1")
|
||||
qdel(query_client_in_db)
|
||||
@@ -710,7 +710,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
if (oldcid)
|
||||
if (!topic || !topic["token"] || !tokens[ckey] || topic["token"] != tokens[ckey])
|
||||
if (!cidcheck_spoofckeys[ckey])
|
||||
message_admins("<span class='adminnotice'>[key_name(src)] appears to have attempted to spoof a cid randomizer check.</span>")
|
||||
message_admins(span_adminnotice("[key_name(src)] appears to have attempted to spoof a cid randomizer check."))
|
||||
cidcheck_spoofckeys[ckey] = TRUE
|
||||
cidcheck[ckey] = computer_id
|
||||
tokens[ckey] = cid_check_reconnect()
|
||||
@@ -726,11 +726,11 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
if (oldcid != computer_id && computer_id != lastcid) //IT CHANGED!!!
|
||||
cidcheck -= ckey //so they can try again after removing the cid randomizer.
|
||||
|
||||
to_chat(src, "<span class='userdanger'>Connection Error:</span>")
|
||||
to_chat(src, "<span class='danger'>Invalid ComputerID(spoofed). Please remove the ComputerID spoofer from your byond installation and try again.</span>")
|
||||
to_chat(src, span_userdanger("Connection Error:"))
|
||||
to_chat(src, span_danger("Invalid ComputerID(spoofed). Please remove the ComputerID spoofer from your byond installation and try again."))
|
||||
|
||||
if (!cidcheck_failedckeys[ckey])
|
||||
message_admins("<span class='adminnotice'>[key_name(src)] has been detected as using a cid randomizer. Connection rejected.</span>")
|
||||
message_admins(span_adminnotice("[key_name(src)] has been detected as using a cid randomizer. Connection rejected."))
|
||||
send2tgs_adminless_only("CidRandomizer", "[key_name(src)] has been detected as using a cid randomizer. Connection rejected.")
|
||||
cidcheck_failedckeys[ckey] = TRUE
|
||||
note_randomizer_user()
|
||||
@@ -741,11 +741,11 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
return TRUE
|
||||
else
|
||||
if (cidcheck_failedckeys[ckey])
|
||||
message_admins("<span class='adminnotice'>[key_name_admin(src)] has been allowed to connect after showing they removed their cid randomizer</span>")
|
||||
message_admins(span_adminnotice("[key_name_admin(src)] has been allowed to connect after showing they removed their cid randomizer"))
|
||||
send2tgs_adminless_only("CidRandomizer", "[key_name(src)] has been allowed to connect after showing they removed their cid randomizer.")
|
||||
cidcheck_failedckeys -= ckey
|
||||
if (cidcheck_spoofckeys[ckey])
|
||||
message_admins("<span class='adminnotice'>[key_name_admin(src)] has been allowed to connect after appearing to have attempted to spoof a cid randomizer check because it <i>appears</i> they aren't spoofing one this time</span>")
|
||||
message_admins(span_adminnotice("[key_name_admin(src)] has been allowed to connect after appearing to have attempted to spoof a cid randomizer check because it <i>appears</i> they aren't spoofing one this time"))
|
||||
cidcheck_spoofckeys -= ckey
|
||||
cidcheck -= ckey
|
||||
else if (computer_id != lastcid)
|
||||
@@ -806,7 +806,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
if (CONFIG_GET(string/ipintel_email))
|
||||
var/datum/ipintel/res = get_ip_intel(address)
|
||||
if (res.intel >= CONFIG_GET(number/ipintel_rating_bad))
|
||||
message_admins("<span class='adminnotice'>Proxy Detection: [key_name_admin(src)] IP intel rated [res.intel*100]% likely to be a Proxy/VPN.</span>")
|
||||
message_admins(span_adminnotice("Proxy Detection: [key_name_admin(src)] IP intel rated [res.intel*100]% likely to be a Proxy/VPN."))
|
||||
ip_intel = res.intel
|
||||
|
||||
/client/Click(atom/object, atom/location, control, params)
|
||||
@@ -846,7 +846,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
add_system_note("aimbot", "Is using the middle click aimbot exploit")
|
||||
log_game("[key_name(src)] Has hit the per-minute click limit of [mcl] clicks in a given game minute")
|
||||
message_admins("[ADMIN_LOOKUPFLW(usr)] [ADMIN_KICK(usr)] Has hit the per-minute click limit of [mcl] clicks in a given game minute")
|
||||
to_chat(src, "<span class='danger'>[msg]</span>")
|
||||
to_chat(src, span_danger("[msg]"))
|
||||
return
|
||||
|
||||
var/scl = CONFIG_GET(number/second_click_limit)
|
||||
@@ -859,7 +859,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
clicklimiter[SECOND_COUNT] = 0
|
||||
clicklimiter[SECOND_COUNT] += 1+(!!ab)
|
||||
if (clicklimiter[SECOND_COUNT] > scl)
|
||||
to_chat(src, "<span class='danger'>Your previous click was ignored because you've done too many in a second</span>")
|
||||
to_chat(src, span_danger("Your previous click was ignored because you've done too many in a second"))
|
||||
return
|
||||
|
||||
if (prefs.hotkeys)
|
||||
@@ -1042,7 +1042,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
var/new_duration = world.realtime + duration
|
||||
if(prefs.hearted_until > new_duration)
|
||||
return
|
||||
to_chat(src, "<span class='nicegreen'>Someone awarded you a heart!</span>")
|
||||
to_chat(src, span_nicegreen("Someone awarded you a heart!"))
|
||||
prefs.hearted_until = new_duration
|
||||
prefs.hearted = TRUE
|
||||
prefs.save_preferences()
|
||||
@@ -1074,7 +1074,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
||||
/client/proc/check_panel_loaded()
|
||||
if(statbrowser_ready)
|
||||
return
|
||||
to_chat(src, "<span class='userdanger'>Statpanel failed to load, click <a href='?src=[REF(src)];reload_statbrowser=1'>here</a> to reload the panel </span>")
|
||||
to_chat(src, span_userdanger("Statpanel failed to load, click <a href='?src=[REF(src)];reload_statbrowser=1'>here</a> to reload the panel "))
|
||||
|
||||
/**
|
||||
* Initializes dropdown menus on client
|
||||
|
||||
Reference in New Issue
Block a user