mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-14 19:51:59 +00:00
* every case of initialize that should have mapload, does * E Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com> Co-authored-by: Gandalf <jzo123@hotmail.com>
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(mapload)
|
|
. = ..()
|
|
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
|