Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
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
2 changes: 2 additions & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -438,3 +438,5 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE
#define NO_INIT_PARAMETER "no-init"

#define EGG_LAYING_MESSAGES list("lays an egg.","squats down and croons.","begins making a huge racket.","begins clucking raucously.")

#define LIBVG(function, arguments...) call("./libvg.[world.system_type == "UNIX" ? "so" : "dll"]", function)(arguments)
2 changes: 1 addition & 1 deletion code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ SUBSYSTEM_DEF(ticker)
if(GLOB.secret_force_mode != "secret")
var/datum/game_mode/smode = config.pick_mode(GLOB.secret_force_mode)
if(!smode.can_start())
message_admins("\blue Unable to force secret [GLOB.secret_force_mode]. [smode.required_players] players and [smode.required_enemies] eligible antagonists needed.")
message_admins("<font color='blue'>Unable to force secret [GLOB.secret_force_mode]. [smode.required_players] players and [smode.required_enemies] eligible antagonists needed.</font>")
else
mode = smode

Expand Down
8 changes: 4 additions & 4 deletions code/game/gamemodes/sandbox/h_sandbox.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ GLOBAL_VAR_INIT(hsboxspawn, TRUE)
if("hsbtobj")
if(!admin) return
if(GLOB.hsboxspawn)
to_chat(world, "<span class='boldannounce'>Sandbox:</span> <b>\black[usr.key] has disabled object spawning!</b>")
to_chat(world, "<span class='boldannounce'>Sandbox:</span> <b><font color='black'>[usr.key] has disabled object spawning!</font></b>")
GLOB.hsboxspawn = FALSE
return
else
to_chat(world, "<span class='boldnotice'>Sandbox:</span> <b>\black[usr.key] has enabled object spawning!</b>")
to_chat(world, "<span class='boldnotice'>Sandbox:</span> <b><font color='black'>[usr.key] has enabled object spawning!</font></b>")
GLOB.hsboxspawn = TRUE
return
//
Expand All @@ -128,9 +128,9 @@ GLOBAL_VAR_INIT(hsboxspawn, TRUE)
if(!admin) return
var/sbac = CONFIG_GET(flag/sandbox_autoclose)
if(sbac)
to_chat(world, "<span class='boldnotice'>Sandbox:</span> <b>\black [usr.key] has removed the object spawn limiter.</b>")
to_chat(world, "<span class='boldnotice'>Sandbox:</span> <b><font color='black'>[usr.key] has removed the object spawn limiter.</font></b>")
else
to_chat(world, "<span class='danger'>Sandbox:</span> <b>\black [usr.key] has added a limiter to object spawning. The window will now auto-close after use.</b>")
to_chat(world, "<span class='danger'>Sandbox:</span> <b><font color='black'>[usr.key] has added a limiter to object spawning. The window will now auto-close after use.</font></b>")
CONFIG_SET(flag/sandbox_autoclose, !sbac)
return
//
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/communications.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
if(..())
return
if(!is_station_level(z) && !is_centcom_level(z)) //Can only use on centcom and SS13
to_chat(usr, "<span class='boldannounce'>Unable to establish a connection</span>: \black You're too far away from the station!")
to_chat(usr, "<span class='boldannounce'>Unable to establish a connection</span>: <font color='black'>You're too far away from the station!</font>")
return
usr.set_machine(src)

Expand Down Expand Up @@ -432,7 +432,7 @@
if(..())
return
if (z > 6)
to_chat(user, "<span class='boldannounce'>Unable to establish a connection</span>: \black You're too far away from the station!")
to_chat(user, "<span class='boldannounce'>Unable to establish a connection</span>: <font color='black'>You're too far away from the station!</font>")
return

user.set_machine(src)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/obj/machinery/computer/robotics/interact(mob/user)
if (src.z > 6)
to_chat(user, "<span class='boldannounce'>Unable to establish a connection</span>: \black You're too far away from the station!")
to_chat(user, "<span class='boldannounce'>Unable to establish a connection</span>: <font color='black'>You're too far away from the station!</font>")
return
user.set_machine(src)
var/dat
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/security.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
if(..())
return
if(src.z > 6)
to_chat(user, "<span class='boldannounce'>Unable to establish a connection</span>: \black You're too far away from the station!")
to_chat(user, "<span class='boldannounce'>Unable to establish a connection</span>: <font color='black'>You're too far away from the station!</font>")
return
var/dat

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/hologram.dm
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ Possible to do for anyone motivated enough:

if(is_operational() && (!AI || AI.eyeobj.loc == loc))//If the projector has power and client eye is on it
if (AI && istype(AI.current, /obj/machinery/holopad))
to_chat(user, "<span class='danger'>ERROR:</span> \black Image feed in progress.")
to_chat(user, "<span class='danger'>ERROR:</span><font color='black'>Image feed in progress.</font>")
return

var/obj/effect/overlay/holo_pad_hologram/Hologram = new(loc)//Spawn a blank effect at the location.
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/PDA/PDA.dm
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ GLOBAL_LIST_EMPTY(PDAs)

user.show_message("<span class='notice'>Analyzing Results for [C]:</span>")
if(C.radiation)
user.show_message("\green Radiation Level: \black [C.radiation]")
user.show_message("<font color='green'>Radiation Level: </font><font color='black'>[C.radiation]</font>")
else
user.show_message("<span class='notice'>No radiation detected.</span>")

Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/secrets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
if(result)
SSblackbox.record_feedback("nested tally", "admin_secrets_fun_used", 1, list("Mass Species Change", "[result]"))
log_admin("[key_name(usr)] turned all humans into [result]", 1)
message_admins("\blue [key_name_admin(usr)] turned all humans into [result]")
message_admins("<font color='blue'>[key_name_admin(usr)] turned all humans into [result]</font>")
var/newtype = GLOB.species_list[result]
for(var/mob/living/carbon/human/H in GLOB.carbon_list)
H.set_species(newtype)
Expand Down
8 changes: 4 additions & 4 deletions code/modules/admin/verbs/SDQL2/SDQL_2.dm
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@

else if(char == "'")
if(word != "")
to_chat(usr, "\red SDQL2: You have an error in your SDQL syntax, unexpected ' in query: \"<font color=gray>[query_text]</font>\" following \"<font color=gray>[word]</font>\". Please check your syntax, and try again.")
to_chat(usr, "<font color='red'>SDQL2: You have an error in your SDQL syntax, unexpected ' in query: \"<font color=gray>[query_text]</font>\" following \"<font color=gray>[word]</font>\". Please check your syntax, and try again.</font>")
return null

word = "'"
Expand All @@ -516,15 +516,15 @@
word += char

if(i > len)
to_chat(usr, "\red SDQL2: You have an error in your SDQL syntax, unmatched ' in query: \"<font color=gray>[query_text]</font>\". Please check your syntax, and try again.")
to_chat(usr, "<font color='red'>SDQL2: You have an error in your SDQL syntax, unmatched ' in query: \"<font color=gray>[query_text]</font>\". Please check your syntax, and try again.</font>")
return null

query_list += "[word]'"
word = ""

else if(char == "\"")
if(word != "")
to_chat(usr, "\red SDQL2: You have an error in your SDQL syntax, unexpected \" in query: \"<font color=gray>[query_text]</font>\" following \"<font color=gray>[word]</font>\". Please check your syntax, and try again.")
to_chat(usr, "<font color='red'>SDQL2: You have an error in your SDQL syntax, unexpected \" in query: \"<font color=gray>[query_text]</font>\" following \"<font color=gray>[word]</font>\". Please check your syntax, and try again.</font>")
return null

word = "\""
Expand All @@ -544,7 +544,7 @@
word += char

if(i > len)
to_chat(usr, "\red SDQL2: You have an error in your SDQL syntax, unmatched \" in query: \"<font color=gray>[query_text]</font>\". Please check your syntax, and try again.")
to_chat(usr, "<font color='red'>SDQL2: You have an error in your SDQL syntax, unmatched \" in query: \"<font color=gray>[query_text]</font>\". Please check your syntax, and try again.</font>")
return null

query_list += "[word]\""
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/verbs/randomverbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
change_view(CONFIG_GET(string/default_view))

log_admin("[key_name(usr)] changed their view range to [view].")
//message_admins("\blue [key_name_admin(usr)] changed their view range to [view].") //why? removed by order of XSI
//message_admins("<font color='blue'>[key_name_admin(usr)] changed their view range to [view].</font>") //why? removed by order of XSI

SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Change View Range", "[view]")) //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!

Expand Down
6 changes: 3 additions & 3 deletions code/modules/awaymissions/gateway.dm
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ GLOBAL_DATUM(the_gateway, /obj/machinery/gateway/centerstation)
/obj/machinery/gateway/centeraway/attackby(obj/item/device/W, mob/user, params)
if(istype(W, /obj/item/device/multitool))
if(calibrated)
to_chat(user, "\black The gate is already calibrated, there is no work for you to do here.")
to_chat(user, "<font color='black'>The gate is already calibrated, there is no work for you to do here.</font>")
return
else
to_chat(user, "<span class='boldnotice'>Recalibration successful!</span>: \black This gate's systems have been fine tuned. Travel to this gate will now be on target.")
to_chat(user, "<span class='boldnotice'>Recalibration successful!</span>: <font color='black'>This gate's systems have been fine tuned. Travel to this gate will now be on target.</font>")
calibrated = TRUE
return

Expand Down Expand Up @@ -201,7 +201,7 @@ GLOBAL_DATUM(the_gateway, /obj/machinery/gateway/centerstation)

/obj/machinery/gateway/centeraway/proc/check_exile_implant(mob/living/L)
for(var/obj/item/implant/exile/E in L.implants)//Checking that there is an exile implant
to_chat(L, "\black The station gate has detected your exile implant and is blocking your entry.")
to_chat(L, "<font color='black'>The station gate has detected your exile implant and is blocking your entry.</font>")
return TRUE
return FALSE

Expand Down
2 changes: 2 additions & 0 deletions code/modules/client/client_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
var/list/topiclimiter

var/datum/chatOutput/chatOutput
// This gets set by goonchat.
var/encoding = "1252"

var/list/credits //lazy list of all credit object bound to this client

Expand Down
18 changes: 18 additions & 0 deletions code/modules/goonchat/browserOutput.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,22 @@ GLOBAL_DATUM_INIT(iconCache, /savefile, new("data/iconCache.sav")) //Cache of ic
if("setMusicVolume")
data = setMusicVolume(arglist(params))

if("encoding")
var/encoding = href_list["encoding"]
var/static/regex/RE = regex("windows-(874|125\[0-8])")
if (RE.Find(encoding))
owner.encoding = RE.group[1]

else if (encoding == "gb2312")
owner.encoding = "2312"

// This seems to be the result on Japanese locales, but the client still seems to accept 1252.
else if (encoding == "_autodetect")
owner.encoding = "1252"

else
stack_trace("Unknown encoding received from client: \"[sanitize(encoding)]\". Please report this as a bug.")

if(data)
ehjax_send(data = data)

Expand Down Expand Up @@ -211,6 +227,8 @@ GLOBAL_DATUM_INIT(iconCache, /savefile, new("data/iconCache.sav")) //Cache of ic
message = replacetext(message, "\n", "<br>")
message = replacetext(message, "\t", "[GLOB.TAB][GLOB.TAB]")

message = to_utf8(message, target)

for(var/I in targets)
//Grab us a client if possible
var/client/C = grab_client(I)
Expand Down
6 changes: 6 additions & 0 deletions code/modules/goonchat/browserassets/js/browserOutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,12 @@ if (typeof $ === 'undefined') {
}

$(function() {
// Detect encoding.
if (document.defaultCharset)
{
runByond("?_src_=chat&proc=encoding&encoding=" + escaper(document.defaultCharset));
}

$messages = $('#messages');
$subOptions = $('#subOptions');
$subAudio = $('#subAudio');
Expand Down
69 changes: 69 additions & 0 deletions code/modules/libvg/utf8.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Note about encodings:
// Encodings are passed by number as it's simplest to do it like this (citation needed)
// This may cause some confusion with what codes correspond how.
//
// 874 and 1250-1258 are Windows CodePage encodings. The number corresponds to the CodePage.
// 2312 is gb2312 (Chinese)
/proc/_determine_encoding(var/mob_or_client)
. = "1252"
if (istype(mob_or_client, /client))
var/client/C = mob_or_client
. = C.encoding

else if (ismob(mob_or_client))
var/mob/M = mob_or_client
if (M.client)
. = M.client.encoding


/proc/to_utf8(var/message, var/mob_or_client)
return LIBVG("to_utf8", _determine_encoding(mob_or_client), message)

// Converts a byte string to a UTF-8 string, sanitizes it and caps the length.
/proc/utf8_sanitize(var/message, var/mob_or_client, var/length)
return LIBVG("utf8_sanitize", _determine_encoding(mob_or_client), message, num2text(length))

// Get the length (Unicode Scalars) of a UTF-8 string.
/proc/utf8_len(var/message)
return text2num(LIBVG("utf8_len", message))

/proc/utf8_byte_len(var/a)
return length(a)

/proc/utf8_find(var/haystack, var/needle, var/start=1, var/end=0)
return text2num(LIBVG("utf8_find", haystack, needle, "[start]", "[end]"))

/proc/utf8_copy(var/text, var/start=1, var/end=0)
return LIBVG("utf8_copy", text, "[start]", "[end]")

/proc/utf8_replace(var/text, var/from, var/to_, var/start=1, var/end=0)
return LIBVG("utf8_replace", text, from, to_, "[start]", "[end]")

/proc/utf8_index(var/text, var/index)
return LIBVG("utf8_index", text, "[index]")

/proc/utf8_uppercase(var/text)
return LIBVG("utf8_uppercase", text)

/proc/utf8_lowercase(var/text)
return LIBVG("utf8_lowercase", text)

// Removes non-7-bit ASCII characters.
// Useful for things which BYOND touches itself like object names.
/proc/strict_ascii(var/text)
return LIBVG("strict_ascii", text)

/proc/utf8_capitalize(var/text)
return utf8_uppercase(utf8_index(text, 1)) + utf8_copy(text, 2)

/proc/utf8_reverse(var/text)
return LIBVG("utf8_reverse", text)

/proc/utf8_leftpad(var/text, var/count, var/with=" ")
return LIBVG("utf8_leftpad", text, "[count]", with)

/proc/utf8_is_whitespace(var/text)
return text2num(LIBVG("utf8_is_whitespace", text))

/proc/utf8_trim(var/text)
return LIBVG("utf8_trim", text)
6 changes: 3 additions & 3 deletions code/modules/ninja/suit/suit_initialisation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
return
lockIcons(U)//Check for icons.
U.regenerate_icons()
to_chat(U, "<span class='notice'>Linking neural-net interface...\nPattern</span>\green <B>GREEN</B><span class='notice'>, continuing operation.</span>")
to_chat(U, "<span class='notice'>Linking neural-net interface...\nPattern</span><font color='green'><B>GREEN</B></font><span class='notice'>, continuing operation.</span>")
addtimer(CALLBACK(src, .proc/ninitialize_five, delay, U), delay)

/obj/item/clothing/suit/space/space_ninja/proc/ninitialize_five(delay, mob/living/carbon/human/U)
Expand Down Expand Up @@ -79,11 +79,11 @@
addtimer(CALLBACK(src, .proc/deinitialize_six, delay, U), delay)

/obj/item/clothing/suit/space/space_ninja/proc/deinitialize_six(delay, mob/living/carbon/human/U)
to_chat(U, "<span class='notice'>Disconnecting neural-net interface...</span>\green<B>Success</B><span class='notice'>.</span>")
to_chat(U, "<span class='notice'>Disconnecting neural-net interface...</span><font color='green'><B>Success</B></font><span class='notice'>.</span>")
addtimer(CALLBACK(src, .proc/deinitialize_seven, delay, U), delay)

/obj/item/clothing/suit/space/space_ninja/proc/deinitialize_seven(delay, mob/living/carbon/human/U)
to_chat(U, "<span class='notice'>Disengaging neural-net interface...</span>\green<B>Success</B><span class='notice'>.</span>")
to_chat(U, "<span class='notice'>Disengaging neural-net interface...</span><font color='green'><B>Success</B></font><span class='notice'>.</span>")
addtimer(CALLBACK(src, .proc/deinitialize_eight, delay, U), delay)

/obj/item/clothing/suit/space/space_ninja/proc/deinitialize_eight(delay, mob/living/carbon/human/U)
Expand Down
Binary file added libvg.dll
Binary file not shown.
1 change: 1 addition & 0 deletions yogstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1669,6 +1669,7 @@
#include "code\modules\library\lib_readme.dm"
#include "code\modules\library\random_books.dm"
#include "code\modules\library\soapstone.dm"
#include "code\modules\libvg\utf8.dm"
#include "code\modules\lighting\lighting_area.dm"
#include "code\modules\lighting\lighting_atom.dm"
#include "code\modules\lighting\lighting_corner.dm"
Expand Down