mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 19:22:20 +00:00
## About The Pull Request I've a few gripes with start points and the gateway delay. First of all, there's no way to discriminate peaceful away locations that do not need a with a 30 minutes timegate from the rest. Places like the beach and the museum hardly have anything OP that could tip the scales. Second, none of the awaystart landmarks have identifiers of their own, which means all awaystart landmarks from all away missions are linked under the same destination point datum. This is hardly an issue in the current state where only one map is ever loaded and all maps have only one way in that directs you to one of several locations at least until the gateways are linked, but it's nevertheless something that I have to take care of, since the config requires it. ## Why It's Good For The Game See above. ## Changelog 🆑 config: Added a config for specific gateway delays so locations like the beach and the museum don't have to take 30 minutes to become available like the rest. /🆑
120 lines
3.4 KiB
Plaintext
120 lines
3.4 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/caves
|
|
name = "caves away spawn"
|
|
id = AWAYSTART_CAVES
|
|
|
|
/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/snowdin
|
|
name = "Snowdin away spawn"
|
|
id = AWAYSTART_SNOWDIN
|
|
|
|
/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
|