mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-11 08:06:33 +01:00
21b4095dfd
Upstream 04/17/2026 fixes https://github.com/Bubberstation/Bubberstation/issues/5549 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com> Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com> Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com> Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com> Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com> Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com> Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com> Co-authored-by: loganuk <fakeemail123@aol.com> Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com> Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com> Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com> Co-authored-by: Lucy <lucy@absolucy.moe> Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com> Co-authored-by: Isratosh <Isratosh@hotmail.com> Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com> Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com> Co-authored-by: Alexander V. <volas@ya.ru> Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com> Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com> Co-authored-by: Tim <timothymtorres@gmail.com> Co-authored-by: Iamgoofball <iamgoofball@gmail.com> Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com> Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com> Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com> Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com> Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com> Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com> Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com> Co-authored-by: Josh <josh.adam.powell@gmail.com> Co-authored-by: Josh Powell <josh.powell@softwire.com> Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com> Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com> Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com> Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
112 lines
3.3 KiB
Plaintext
112 lines
3.3 KiB
Plaintext
// How much "space" we give the edge of the map
|
|
GLOBAL_LIST_INIT(potentialRandomZlevels, generateMapList(filename = "awaymissionconfig.txt"))
|
|
GLOBAL_LIST_INIT(potentialConfigRandomZlevels, generate_map_list_from_directory(directory = "[global.config.directory]/away_missions/"))
|
|
|
|
/proc/createRandomZlevel(config_gateway = FALSE)
|
|
var/map
|
|
if(config_gateway && GLOB.potentialConfigRandomZlevels?.len)
|
|
map = pick_n_take(GLOB.potentialConfigRandomZlevels)
|
|
else if(GLOB.potentialRandomZlevels?.len)
|
|
map = pick_n_take(GLOB.potentialRandomZlevels)
|
|
else
|
|
return to_chat(world, span_boldannounce("No valid away mission files, loading aborted."))
|
|
to_chat(world, span_boldannounce("Loading away mission..."))
|
|
var/loaded = load_new_z_level(map, "Away Mission", config_gateway)
|
|
to_chat(world, span_boldannounce("Away mission [loaded ? "loaded" : "aborted due to errors"]."))
|
|
if(!loaded)
|
|
message_admins("Away mission [map] loading failed due to errors.")
|
|
log_admin("Away mission [map] loading failed due to errors.")
|
|
createRandomZlevel(config_gateway)
|
|
|
|
/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.name = name
|
|
current.id = id
|
|
if(delay)
|
|
var/list/waits_by_id = CONFIG_GET(keyed_list/gateway_delays_by_id)
|
|
var/wait_to_use = !isnull(waits_by_id[id]) ? waits_by_id[id] : CONFIG_GET(number/gateway_delay)
|
|
current.wait = wait_to_use
|
|
GLOB.gateway_destinations += current
|
|
current.target_turfs += get_turf(src)
|
|
return INITIALIZE_HINT_QDEL
|
|
|
|
/obj/effect/landmark/awaystart/nodelay
|
|
delay = FALSE
|
|
|
|
/obj/effect/landmark/awaystart/beach
|
|
name = "beach away spawn"
|
|
id = AWAYSTART_BEACH
|
|
|
|
/obj/effect/landmark/awaystart/museum
|
|
name = "buseum away spawn"
|
|
id = AWAYSTART_MUSEUM
|
|
|
|
/obj/effect/landmark/awaystart/research
|
|
name = "research outpost away spawn"
|
|
id = AWAYSTART_RESEARCH
|
|
|
|
/obj/effect/landmark/awaystart/moonoutpost
|
|
name = "Moon Outpost 19 away spawn"
|
|
id = AWAYSTART_MOONOUTPOST
|
|
|
|
/obj/effect/landmark/awaystart/snowcabin
|
|
name = "snow cabin away spawn"
|
|
id = AWAYSTART_SNOWCABIN
|
|
|
|
/obj/effect/landmark/awaystart/underground
|
|
name = "Underground Outpost 45 away spawn"
|
|
id = AWAYSTART_UNDERGROUND
|
|
|
|
/proc/generateMapList(filename)
|
|
. = list()
|
|
filename = "[global.config.directory]/[SANITIZE_FILENAME(filename)]"
|
|
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 = LOWER_TEXT(copytext(t, 1, pos))
|
|
|
|
else
|
|
name = LOWER_TEXT(t)
|
|
|
|
if (!name)
|
|
continue
|
|
|
|
. += t
|
|
|
|
/// Returns a list of all maps to be found in the directory that is passed in.
|
|
/proc/generate_map_list_from_directory(directory)
|
|
var/list/config_maps = list()
|
|
var/list/maps = flist(directory)
|
|
for(var/map_file in maps)
|
|
if(!findtext(map_file, ".dmm"))
|
|
continue
|
|
config_maps += (directory + map_file)
|
|
return config_maps
|