mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 01:57:01 +00:00
* Unicode support Part 2 -- copytext() This is the transition of all copytext() calls to be unicode aware and also some nearby calls in the same functions. Most things are just replacing copytext() with copytext_char() as a terrible character limiter but a few others were slightly more involved. I replaced a ton of ```` var/something = sanitize(input()) something = copytext(something, 1, MAX_MESSAGE_LEN) ```` with a single stripped_input() call. stripped_input() already calls html_encode(), trim(), and some other sanitization so there shouldn't be any major issues there. This is still VERY rough btw; DNA is a mess, the status displays are complete ass, there's a copytext() in code\datums\shuttles.dm that I'm not sure what to do with, and I didn't touch anything in the tools folder. I haven't tested this much at all yet, I only got it to compile earlier this morning. There's also likely to be weird bugs until I get around to fixing length(), findtext(), and the rest of the string procs. * Makes the code functional * Assume color hex strings are always # followed by ascii. Properly encodes and decodes the stuff in mob_helpers.dm which fixes some issues there. * Removes ninjaspeak since it's unused
62 lines
1.5 KiB
Plaintext
62 lines
1.5 KiB
Plaintext
// How much "space" we give the edge of the map
|
|
GLOBAL_LIST_INIT(potentialRandomZlevels, generateMapList(filename = "[global.config.directory]/awaymissionconfig.txt"))
|
|
|
|
/proc/createRandomZlevel()
|
|
if(GLOB.awaydestinations.len) //crude, but it saves another var!
|
|
return
|
|
|
|
if(GLOB.potentialRandomZlevels && GLOB.potentialRandomZlevels.len)
|
|
to_chat(world, "<span class='boldannounce'>Loading away mission...</span>")
|
|
var/map = pick(GLOB.potentialRandomZlevels)
|
|
load_new_z_level(map, "Away Mission")
|
|
to_chat(world, "<span class='boldannounce'>Away mission loaded.</span>")
|
|
|
|
/proc/reset_gateway_spawns(reset = FALSE)
|
|
for(var/obj/machinery/gateway/G in world)
|
|
if(reset)
|
|
G.randomspawns = GLOB.awaydestinations
|
|
else
|
|
G.randomspawns.Add(GLOB.awaydestinations)
|
|
|
|
/obj/effect/landmark/awaystart
|
|
name = "away mission spawn"
|
|
desc = "Randomly picked away mission spawn points."
|
|
|
|
/obj/effect/landmark/awaystart/New()
|
|
GLOB.awaydestinations += src
|
|
..()
|
|
|
|
/obj/effect/landmark/awaystart/Destroy()
|
|
GLOB.awaydestinations -= src
|
|
return ..()
|
|
|
|
/proc/generateMapList(filename)
|
|
. = list()
|
|
var/list/Lines = world.file2list(filename)
|
|
|
|
if(!Lines.len)
|
|
return
|
|
for (var/t in Lines)
|
|
if (!t)
|
|
continue
|
|
|
|
t = trim(t)
|
|
if (length(t) == 0)
|
|
continue
|
|
else if (t[1] == "#")
|
|
continue
|
|
|
|
var/pos = findtext(t, " ")
|
|
var/name = null
|
|
|
|
if (pos)
|
|
name = lowertext(copytext(t, 1, pos))
|
|
|
|
else
|
|
name = lowertext(t)
|
|
|
|
if (!name)
|
|
continue
|
|
|
|
. += t
|