mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-02 04:52:10 +00:00
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)
63 lines
1.5 KiB
Plaintext
63 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.potentialRandomZlevels && GLOB.potentialRandomZlevels.len)
|
|
to_chat(world, span_boldannounce("Loading away mission..."))
|
|
var/map = pick(GLOB.potentialRandomZlevels)
|
|
load_new_z_level(map, "Away Mission")
|
|
to_chat(world, span_boldannounce("Away mission loaded."))
|
|
|
|
/obj/effect/landmark/awaystart
|
|
name = "away mission spawn"
|
|
desc = "Randomly picked away mission spawn points."
|
|
var/id
|
|
var/delay = TRUE // If the generated destination should be delayed by configured gateway delay
|
|
|
|
/obj/effect/landmark/awaystart/Initialize()
|
|
. = ..()
|
|
var/datum/gateway_destination/point/current
|
|
for(var/datum/gateway_destination/point/D in GLOB.gateway_destinations)
|
|
if(D.id == id)
|
|
current = D
|
|
if(!current)
|
|
current = new
|
|
current.id = id
|
|
if(delay)
|
|
current.wait = CONFIG_GET(number/gateway_delay)
|
|
GLOB.gateway_destinations += current
|
|
current.target_turfs += get_turf(src)
|
|
|
|
/obj/effect/landmark/awaystart/nodelay
|
|
delay = FALSE
|
|
|
|
/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
|