From 663eff7b5eb1c5e4cee8cf924c4130fb26939225 Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Mon, 24 May 2021 14:25:18 +0000 Subject: [PATCH] MAP ROTATION PART 2 (#12345) * MAP ROTATION * Tweaks + New additions * Apply suggestions from code review Co-authored-by: dearmochi * Fixes improper naming * Fixes map vote Co-authored-by: dearmochi --- .github/workflows/ci.yml | 2 +- _maps/base_map.dm | 5 + _maps/cyberiad.dm | 27 ----- _maps/delta.dm | 30 ----- _maps/map_datums.dm | 1 + _maps/metastation.dm | 27 ----- code/__HELPERS/names.dm | 9 +- code/__HELPERS/text.dm | 57 +++++++++ code/_globalvars/mapping.dm | 3 - code/_globalvars/misc.dm | 3 - code/controllers/configuration.dm | 5 + code/controllers/subsystem/dbcore.dm | 2 +- code/controllers/subsystem/mapping.dm | 112 ++++++++++++++---- code/controllers/subsystem/titlescreen.dm | 2 - code/controllers/subsystem/vote.dm | 35 +++++- code/game/objects/items/devices/autopsy.dm | 2 +- code/game/world.dm | 2 +- code/modules/admin/admin_verbs.dm | 3 +- code/modules/admin/topic.dm | 2 +- code/modules/admin/verbs/mapping.dm | 25 ++++ .../contractor/datums/syndicate_contract.dm | 6 +- code/modules/awaymissions/maploader/reader.dm | 5 + code/modules/map_fluff/cyberiad.dm | 10 -- code/modules/map_fluff/delta.dm | 10 -- code/modules/map_fluff/maps.dm | 10 -- code/modules/map_fluff/metastation.dm | 10 -- code/modules/mapping/base_map_datum.dm | 14 +++ code/modules/mapping/cyberiad.dm | 4 + code/modules/mapping/delta.dm | 4 + code/modules/mapping/metastation.dm | 4 + code/modules/mob/mob.dm | 3 + code/modules/shuttle/emergency.dm | 2 + code/modules/space_management/level_traits.dm | 3 +- code/modules/tgui/tgui.dm | 2 +- code/modules/world_topic/status.dm | 2 +- config/example/config.txt | 5 +- paradise.dme | 11 +- tools/ci/dm.sh | 6 - 38 files changed, 273 insertions(+), 192 deletions(-) create mode 100644 _maps/base_map.dm delete mode 100644 _maps/cyberiad.dm delete mode 100644 _maps/delta.dm create mode 100644 _maps/map_datums.dm delete mode 100644 _maps/metastation.dm delete mode 100644 code/modules/map_fluff/cyberiad.dm delete mode 100644 code/modules/map_fluff/delta.dm delete mode 100644 code/modules/map_fluff/maps.dm delete mode 100644 code/modules/map_fluff/metastation.dm create mode 100644 code/modules/mapping/base_map_datum.dm create mode 100644 code/modules/mapping/cyberiad.dm create mode 100644 code/modules/mapping/delta.dm create mode 100644 code/modules/mapping/metastation.dm diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88eec1aece6..4b5975725c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: tools/ci/install_byond.sh source $HOME/BYOND/byond/bin/byondsetup tools/ci/generate_maplist.sh - tools/ci/dm.sh -Mci_map_testing paradise.dme + tools/ci/dm.sh -DCIMAP paradise.dme unit_tests_and_sql: name: Unit Tests + SQL Validation diff --git a/_maps/base_map.dm b/_maps/base_map.dm new file mode 100644 index 00000000000..2c44a73bb67 --- /dev/null +++ b/_maps/base_map.dm @@ -0,0 +1,5 @@ +#include "map_files\generic\centcomm.dmm" +#define CC_TRANSITION_CONFIG DECLARE_LEVEL(CENTCOMM, SELFLOOPING, list(ADMIN_LEVEL, BLOCK_TELEPORT, IMPEDES_MAGIC)) +#ifdef CIMAP +#include "ci_map_testing.dm" +#endif diff --git a/_maps/cyberiad.dm b/_maps/cyberiad.dm deleted file mode 100644 index ebdcba2a08e..00000000000 --- a/_maps/cyberiad.dm +++ /dev/null @@ -1,27 +0,0 @@ -/* -All z-levels should be identical in size. Their numbers should not matter. -The order of z-levels should not matter as long as their attributes are properly defined at MAP_TRANSITION_CONFIG. -Old code checked for the number of the z-level (for example whether there are any revheads on Z1), -currently it should check for the define (for example whether there are any revheads on any z-levels defined as STATION_LEVEL). -z1 = centcomm -z2 = station -z3 = lavaland -*/ - -#if !defined(USING_MAP_DATUM) - #include "map_files\generic\centcomm.dmm" - #include "map_files\cyberiad\cyberiad.dmm" - #include "map_files\generic\Lavaland.dmm" - - #define MAP_TRANSITION_CONFIG list(\ -DECLARE_LEVEL(CENTCOMM, SELFLOOPING, list(ADMIN_LEVEL, BLOCK_TELEPORT, IMPEDES_MAGIC)),\ -DECLARE_LEVEL(MAIN_STATION, CROSSLINKED, list(STATION_LEVEL, STATION_CONTACT, REACHABLE, AI_OK)),\ -DECLARE_LEVEL(MINING, SELFLOOPING, list(ORE_LEVEL, REACHABLE, STATION_CONTACT, HAS_WEATHER, AI_OK))) - - #define USING_MAP_DATUM /datum/map/cyberiad - -#elif !defined(MAP_OVERRIDE) - - #warn a map has already been included, ignoring Cyberiad. - -#endif diff --git a/_maps/delta.dm b/_maps/delta.dm deleted file mode 100644 index 89540207d8d..00000000000 --- a/_maps/delta.dm +++ /dev/null @@ -1,30 +0,0 @@ -/* -All z-levels should be identical in size. Their numbers should not matter. -The order of z-levels should not matter as long as their attributes are properly defined at MAP_TRANSITION_CONFIG. -Old code checked for the number of the z-level (for example whether there are any revheads on Z1), -currently it should check for the define (for example whether there are any revheads on any z-levels defined as STATION_LEVEL). -z1 = centcomm -z2 = station -z3 = lavaland - -Original design by Okand37 of TG Station -Lovingly ported by Purpose2 to Paradise -*/ - -#if !defined(USING_MAP_DATUM) - #include "map_files\generic\centcomm.dmm" - #include "map_files\delta\delta.dmm" - #include "map_files\generic\Lavaland.dmm" - - #define MAP_TRANSITION_CONFIG list(\ -DECLARE_LEVEL(CENTCOMM, SELFLOOPING, list(ADMIN_LEVEL, BLOCK_TELEPORT, IMPEDES_MAGIC)),\ -DECLARE_LEVEL(MAIN_STATION, CROSSLINKED, list(STATION_LEVEL, STATION_CONTACT, REACHABLE, AI_OK)),\ -DECLARE_LEVEL(MINING, SELFLOOPING, list(ORE_LEVEL, REACHABLE, STATION_CONTACT, HAS_WEATHER, AI_OK))) - - #define USING_MAP_DATUM /datum/map/delta - -#elif !defined(MAP_OVERRIDE) - - #warn a map has already been included, ignoring Delta. - -#endif diff --git a/_maps/map_datums.dm b/_maps/map_datums.dm new file mode 100644 index 00000000000..0e355540dc8 --- /dev/null +++ b/_maps/map_datums.dm @@ -0,0 +1 @@ +// See code/modules/mapping for map datums diff --git a/_maps/metastation.dm b/_maps/metastation.dm deleted file mode 100644 index 1e71d218835..00000000000 --- a/_maps/metastation.dm +++ /dev/null @@ -1,27 +0,0 @@ -/* -All z-levels should be identical in size. Their numbers should not matter. -The order of z-levels should not matter as long as their attributes are properly defined at MAP_TRANSITION_CONFIG. -Old code checked for the number of the z-level (for example whether there are any revheads on Z1), -currently it should check for the define (for example whether there are any revheads on any z-levels defined as STATION_LEVEL). -z1 = centcomm -z2 = station -z3 = lavaland -*/ - -#if !defined(USING_MAP_DATUM) - #include "map_files\generic\centcomm.dmm" - #include "map_files\MetaStation\MetaStation.dmm" - #include "map_files\generic\Lavaland.dmm" - - #define MAP_TRANSITION_CONFIG list(\ -DECLARE_LEVEL(CENTCOMM, SELFLOOPING, list(ADMIN_LEVEL, BLOCK_TELEPORT, IMPEDES_MAGIC)),\ -DECLARE_LEVEL(MAIN_STATION, CROSSLINKED, list(STATION_LEVEL, STATION_CONTACT, REACHABLE, AI_OK)),\ -DECLARE_LEVEL(MINING, SELFLOOPING, list(ORE_LEVEL, REACHABLE, STATION_CONTACT, HAS_WEATHER, AI_OK))) - - #define USING_MAP_DATUM /datum/map/metastation - -#elif !defined(MAP_OVERRIDE) - - #warn a map has already been included, ignoring MetaStation. - -#endif diff --git a/code/__HELPERS/names.dm b/code/__HELPERS/names.dm index 29e0f9b52b9..b8b47aa8656 100644 --- a/code/__HELPERS/names.dm +++ b/code/__HELPERS/names.dm @@ -15,9 +15,9 @@ GLOBAL_VAR(church_name) return name -GLOBAL_VAR(command_name) +// TODO: Remove this. Its always gonna be NAS Trurl /proc/command_name() - return GLOB.using_map.dock_name + return "NAS Trurl" GLOBAL_VAR(religion_name) /proc/religion_name() @@ -31,11 +31,8 @@ GLOBAL_VAR(religion_name) return capitalize(name) -/proc/system_name() - return GLOB.using_map.starsys_name - /proc/station_name() - return GLOB.using_map.station_name + return SSmapping.map_datum.fluff_name /proc/new_station_name() var/random = rand(1,5) diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm index 68acde69228..11a04c7cc3c 100644 --- a/code/__HELPERS/text.dm +++ b/code/__HELPERS/text.dm @@ -653,6 +653,62 @@ // return the split html object to the caller return s +//Used for applying byonds text macros to strings that are loaded at runtime +/proc/apply_text_macros(string) + var/next_backslash = findtext(string, "\\") + if(!next_backslash) + return string + + var/leng = length(string) + + var/next_space = findtext(string, " ", next_backslash + length(string[next_backslash])) + if(!next_space) + next_space = leng - next_backslash + + if(!next_space) //trailing bs + return string + + var/base = next_backslash == 1 ? "" : copytext(string, 1, next_backslash) + var/macro = lowertext(copytext(string, next_backslash + length(string[next_backslash]), next_space)) + var/rest = next_backslash > leng ? "" : copytext(string, next_space + length(string[next_space])) + + //See https://secure.byond.com/docs/ref/info.html#/DM/text/macros + switch(macro) + //prefixes/agnostic + if("the") + rest = text("\the []", rest) + if("a") + rest = text("\a []", rest) + if("an") + rest = text("\an []", rest) + if("proper") + rest = text("\proper []", rest) + if("improper") + rest = text("\improper []", rest) + if("roman") + rest = text("\roman []", rest) + //postfixes + if("th") + base = text("[]\th", rest) + if("s") + base = text("[]\s", rest) + if("he") + base = text("[]\he", rest) + if("she") + base = text("[]\she", rest) + if("his") + base = text("[]\his", rest) + if("himself") + base = text("[]\himself", rest) + if("herself") + base = text("[]\herself", rest) + if("hers") + base = text("[]\hers", rest) + + . = base + if(rest) + . += .(rest) + /** * Proc to generate a "rank colour" from a client * @@ -671,3 +727,4 @@ if(C.donator_level) return "#e67e22" // Patreon orange return null + diff --git a/code/_globalvars/mapping.dm b/code/_globalvars/mapping.dm index 2b435e0bede..caf4a2a58bb 100644 --- a/code/_globalvars/mapping.dm +++ b/code/_globalvars/mapping.dm @@ -8,9 +8,6 @@ GLOBAL_LIST_INIT(alldirs, list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, S GLOBAL_LIST_INIT(alldirs2, list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST, NORTH, SOUTH, EAST, WEST)) GLOBAL_LIST_INIT(diagonals, list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)) -// This must exist early on or shit breaks bad -GLOBAL_DATUM_INIT(using_map, /datum/map, new USING_MAP_DATUM) - GLOBAL_LIST(global_map) // This is the array of zlevels | list(list(1,5),list(4,3)) | becomes a 2D array of zlevels //Resulting sector map looks like //|_1_|_4_| diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index 6d28489127a..554fa2581a4 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -86,9 +86,6 @@ GLOBAL_VAR_INIT(copier_items_printed, 0) GLOBAL_VAR_INIT(copier_max_items, 300) GLOBAL_VAR_INIT(copier_items_printed_logged, FALSE) - -GLOBAL_VAR(map_name) // Self explanatory - GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) // Station datacore, manifest, etc GLOBAL_VAR_INIT(panic_bunker_enabled, FALSE) // Is the panic bunker enabled diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 3b39682efbf..26be0f214b7 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -275,6 +275,9 @@ /// Enable auto profiler of rounds var/auto_profile = FALSE + // Enable map voting + var/map_voting_enabled = FALSE + /datum/configuration/New() for(var/T in subtypesof(/datum/game_mode)) var/datum/game_mode/M = T @@ -770,6 +773,8 @@ max_client_cid_history = text2num(value) if("enable_auto_profiler") auto_profile = TRUE + if("enable_map_voting") + map_voting_enabled = TRUE else log_config("Unknown setting in configuration: '[name]'") diff --git a/code/controllers/subsystem/dbcore.dm b/code/controllers/subsystem/dbcore.dm index 81aab3b0759..4cfe06083e3 100644 --- a/code/controllers/subsystem/dbcore.dm +++ b/code/controllers/subsystem/dbcore.dm @@ -193,7 +193,7 @@ SUBSYSTEM_DEF(dbcore) if(!IsConnected()) return var/datum/db_query/query_round_end = SSdbcore.NewQuery( - "UPDATE [format_table_name("round")] SET end_datetime = Now(), game_mode_result = :game_mode_result, station_name = :station_name WHERE id = :round_id", + "UPDATE [format_table_name("round")] SET end_datetime = Now(), game_mode_result = :game_mode_result WHERE id = :round_id", list("game_mode_result" = SSticker.mode_result, "station_name" = station_name(), "round_id" = GLOB.round_id) ) query_round_end.Execute() diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index ac8165aca7a..87846d051f0 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -1,31 +1,51 @@ SUBSYSTEM_DEF(mapping) - name = "Mapping" - init_order = INIT_ORDER_MAPPING // 9 - flags = SS_NO_FIRE + name = "Mapping" + init_order = INIT_ORDER_MAPPING // 9 + flags = SS_NO_FIRE + /// What map datum are we using + var/datum/map/map_datum + /// What map will be used next round + var/datum/map/next_map + +// This has to be here because world/New() uses [station_name()], which looks this datum up +/datum/controller/subsystem/mapping/PreInit() + . = ..() + if(map_datum) // Dont do this again if we are recovering + return + if(fexists("data/next_map.txt")) + var/list/lines = file2list("data/next_map.txt") + // Check its valid + try + map_datum = text2path(lines[1]) + map_datum = new map_datum + catch + map_datum = new /datum/map/cyberiad // Assume cyberiad if non-existent + fdel("data/next_map.txt") // Remove to avoid the same map existing forever + else + map_datum = new /datum/map/cyberiad // Assume cyberiad if non-existent + +/datum/controller/subsystem/mapping/Shutdown() + if(next_map) // Save map for next round + var/F = file("data/next_map.txt") + F << next_map.type /datum/controller/subsystem/mapping/Initialize(timeofday) // Load all Z level templates preloadTemplates() + + // Load the station + loadStation() + + // Load lavaland + loadLavaland() + // Pick a random away mission. if(!config.disable_away_missions) load_away_mission() + // Seed space ruins if(!config.disable_space_ruins) - // load in extra levels of space ruins - var/load_zlevels_timer = start_watch() - log_startup_progress("Creating random space levels...") - var/num_extra_space = rand(config.extra_space_ruin_levels_min, config.extra_space_ruin_levels_max) - for(var/i = 1, i <= num_extra_space, i++) - GLOB.space_manager.add_new_zlevel("Ruin Area #[i]", linkage = CROSSLINKED, traits = list(REACHABLE, SPAWN_RUINS)) - log_startup_progress("Loaded random space levels in [stop_watch(load_zlevels_timer)]s.") - - // Now spawn ruins, random budget between 20 and 30 for all zlevels combined. - // While this may seem like a high number, the amount of ruin Z levels can be anywhere between 3 and 7. - // Note that this budget is not split evenly accross all zlevels - log_startup_progress("Seeding ruins...") - var/seed_ruins_timer = start_watch() - seedRuins(levels_by_trait(SPAWN_RUINS), rand(20, 30), /area/space, GLOB.space_ruins_templates) - log_startup_progress("Successfully seeded ruins in [stop_watch(seed_ruins_timer)]s.") + handleRuins() // Makes a blank space level for the sake of randomness GLOB.space_manager.add_new_zlevel("Empty Area", linkage = CROSSLINKED, traits = list(REACHABLE)) @@ -63,12 +83,6 @@ SUBSYSTEM_DEF(mapping) GLOB.ghostteleportlocs = sortAssoc(GLOB.ghostteleportlocs) - // Map name. Break these down into SSmapping controller vars instaed of GLOBs at some point - if(GLOB.using_map && GLOB.using_map.name) - GLOB.map_name = "[GLOB.using_map.name]" - else - GLOB.map_name = "Unknown" - // World name if(config && config.server_name) world.name = "[config.server_name]: [station_name()]" @@ -77,6 +91,56 @@ SUBSYSTEM_DEF(mapping) return ..() +// Do not confuse with seedRuins() +/datum/controller/subsystem/mapping/proc/handleRuins() + // load in extra levels of space ruins + var/load_zlevels_timer = start_watch() + log_startup_progress("Creating random space levels...") + var/num_extra_space = rand(config.extra_space_ruin_levels_min, config.extra_space_ruin_levels_max) + for(var/i in 1 to num_extra_space) + GLOB.space_manager.add_new_zlevel("Ruin Area #[i]", linkage = CROSSLINKED, traits = list(REACHABLE, SPAWN_RUINS)) + log_startup_progress("Loaded random space levels in [stop_watch(load_zlevels_timer)]s.") + + // Now spawn ruins, random budget between 20 and 30 for all zlevels combined. + // While this may seem like a high number, the amount of ruin Z levels can be anywhere between 3 and 7. + // Note that this budget is not split evenly accross all zlevels + log_startup_progress("Seeding ruins...") + var/seed_ruins_timer = start_watch() + seedRuins(levels_by_trait(SPAWN_RUINS), rand(20, 30), /area/space, GLOB.space_ruins_templates) + log_startup_progress("Successfully seeded ruins in [stop_watch(seed_ruins_timer)]s.") + +// Loads in the station +/datum/controller/subsystem/mapping/proc/loadStation() + ASSERT(map_datum.map_path) + if(!fexists(map_datum.map_path)) + // Make a VERY OBVIOUS error + to_chat(world, "ERROR: The path specified for the map to load is invalid. No station has been loaded!") + return + + var/watch = start_watch() + log_startup_progress("Loading [map_datum.fluff_name]...") + // This should always be Z2, but you never know + var/map_z_level = GLOB.space_manager.add_new_zlevel(MAIN_STATION, linkage = CROSSLINKED, traits = list(STATION_LEVEL, STATION_CONTACT, REACHABLE, AI_OK)) + GLOB.maploader.load_map(file(map_datum.map_path), z_offset = map_z_level) + log_startup_progress("Loaded [map_datum.fluff_name] in [stop_watch(watch)]s") + + // Save station name in the DB + if(!SSdbcore.IsConnected()) + return + var/datum/db_query/query_set_map = SSdbcore.NewQuery( + "UPDATE [format_table_name("round")] SET start_datetime=NOW(), map_name=:mapname, station_name=:stationname WHERE id=:round_id", + list("mapname" = map_datum.technical_name, "stationname" = map_datum.fluff_name, "round_id" = GLOB.round_id) + ) + query_set_map.Execute(async = FALSE) // This happens during a time of intense server lag, so should be non-async + qdel(query_set_map) + +// Loads in lavaland +/datum/controller/subsystem/mapping/proc/loadLavaland() + var/watch = start_watch() + log_startup_progress("Loading Lavaland...") + var/lavaland_z_level = GLOB.space_manager.add_new_zlevel(MINING, linkage = SELFLOOPING, traits = list(ORE_LEVEL, REACHABLE, STATION_CONTACT, HAS_WEATHER, AI_OK)) + GLOB.maploader.load_map(file("_maps/map_files/generic/Lavaland.dmm"), z_offset = lavaland_z_level) + log_startup_progress("Loaded Lavaland in [stop_watch(watch)]s") /datum/controller/subsystem/mapping/proc/seedRuins(list/z_levels = null, budget = 0, whitelist = /area/space, list/potentialRuins) if(!z_levels || !z_levels.len) diff --git a/code/controllers/subsystem/titlescreen.dm b/code/controllers/subsystem/titlescreen.dm index 7fe59ec9093..90ea775885e 100644 --- a/code/controllers/subsystem/titlescreen.dm +++ b/code/controllers/subsystem/titlescreen.dm @@ -16,8 +16,6 @@ SUBSYSTEM_DEF(title) else if(L.len > 1) if(use_rare_screens && lowertext(L[1]) == "rare") title_screens += S - else if(GLOB.using_map && (lowertext(L[1]) == lowertext(GLOB.using_map.name))) - title_screens += S if(!isemptylist(title_screens)) if(length(title_screens) > 1) diff --git a/code/controllers/subsystem/vote.dm b/code/controllers/subsystem/vote.dm index 346297d900f..743d14a3962 100644 --- a/code/controllers/subsystem/vote.dm +++ b/code/controllers/subsystem/vote.dm @@ -177,6 +177,16 @@ SUBSYSTEM_DEF(vote) if("crew_transfer") if(. == "Initiate Crew Transfer") init_shift_change(null, 1) + if("map") + // Find target map. + var/datum/map/top_voted_map + for(var/x in subtypesof(/datum/map)) + var/datum/map/M = x + // Set top voted map + if(. == "[initial(M.fluff_name)] ([initial(M.technical_name)])") + top_voted_map = M + to_chat(world, "Map for next round: [initial(top_voted_map.fluff_name)] ([initial(top_voted_map.technical_name)])") + SSmapping.next_map = new top_voted_map if(restart) @@ -197,7 +207,7 @@ SUBSYSTEM_DEF(vote) return vote return 0 -/datum/controller/subsystem/vote/proc/initiate_vote(vote_type, initiator_key) +/datum/controller/subsystem/vote/proc/initiate_vote(vote_type, initiator_key, code_invoked = FALSE) if(!mode) if(started_time != null && !check_rights(R_ADMIN)) var/next_allowed_time = (started_time + config.vote_delay) @@ -223,6 +233,14 @@ SUBSYSTEM_DEF(vote) return 0 question = "End the shift?" choices.Add("Initiate Crew Transfer", "Continue The Round") + if("map") + if(!(check_rights(R_SERVER) || code_invoked)) + return FALSE + question = "Map for next round" + for(var/x in subtypesof(/datum/map)) + var/datum/map/M = x + choices.Add("[initial(M.fluff_name)] ([initial(M.technical_name)])") + if("custom") question = html_encode(input(usr,"What is the vote for?") as text|null) if(!question) return 0 @@ -248,11 +266,7 @@ SUBSYSTEM_DEF(vote) Click here or type vote to place your vote. You have [config.vote_period/10] seconds to vote."}) switch(vote_type) - if("crew_transfer") - SEND_SOUND(world, sound('sound/ambience/alarm4.ogg')) - if("gamemode") - SEND_SOUND(world, sound('sound/ambience/alarm4.ogg')) - if("custom") + if("crew_transfer", "gamemode", "custom", "map") SEND_SOUND(world, sound('sound/ambience/alarm4.ogg')) if(mode == "gamemode" && SSticker.ticker_going) SSticker.ticker_going = FALSE @@ -321,6 +335,12 @@ SUBSYSTEM_DEF(vote) if(admin) dat += "\t([config.allow_vote_mode?"Allowed":"Disallowed"])" + dat += "
  • " + if(admin) + dat += "Map" + else + dat += "Map (Disallowed)" + dat += "
  • " //custom if(admin) @@ -381,6 +401,9 @@ SUBSYSTEM_DEF(vote) if("gamemode") if(config.allow_vote_mode || admin) initiate_vote("gamemode",usr.key) + if("map") + if(admin) + initiate_vote("map", usr.key) if("crew_transfer") if(config.allow_vote_restart || admin) initiate_vote("crew_transfer",usr.key) diff --git a/code/game/objects/items/devices/autopsy.dm b/code/game/objects/items/devices/autopsy.dm index c96e935432c..181389800db 100644 --- a/code/game/objects/items/devices/autopsy.dm +++ b/code/game/objects/items/devices/autopsy.dm @@ -74,7 +74,7 @@ var/dead_notes = input("Insert any relevant notes") var/obj/item/paper/R = new(user.loc) R.name = "Official Coroner's Report - [dead_name]" - R.info = "Nanotrasen Science Station [GLOB.using_map.station_short] - Coroner's Report

    Name of Deceased: [dead_name]

    Rank of Deceased: [dead_rank]

    Time of Death: [dead_tod]

    Cause of Death: [dead_cause]

    Trace Chemicals: [dead_chems]

    Additional Coroner's Notes: [dead_notes]

    Coroner's Signature: " + R.info = "[SSmapping.map_datum.fluff_name] - Coroner's Report

    Name of Deceased: [dead_name]

    Rank of Deceased: [dead_rank]

    Time of Death: [dead_tod]

    Cause of Death: [dead_cause]

    Trace Chemicals: [dead_chems]

    Additional Coroner's Notes: [dead_notes]

    Coroner's Signature: " playsound(loc, 'sound/goonstation/machines/printer_thermal.ogg', 50, 1) sleep(10) user.put_in_hands(R) diff --git a/code/game/world.dm b/code/game/world.dm index 8573327076a..c72ed4859ab 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -1,4 +1,4 @@ -GLOBAL_LIST_INIT(map_transition_config, MAP_TRANSITION_CONFIG) +GLOBAL_LIST_INIT(map_transition_config, list(CC_TRANSITION_CONFIG)) /world/New() // IMPORTANT diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index f63473216a9..ef2b92e28d7 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -137,7 +137,8 @@ GLOBAL_LIST_INIT(admin_verbs_server, list( /client/proc/toggle_antagHUD_restrictions, /client/proc/set_ooc, /client/proc/reset_ooc, - /client/proc/toggledrones + /client/proc/toggledrones, + /client/proc/set_next_map )) GLOBAL_LIST_INIT(admin_verbs_debug, list( /client/proc/cmd_admin_list_open_jobs, diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 35a48a0bf16..e6341f14ed7 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -2341,7 +2341,7 @@ P.name = "Central Command - paper" var/stypes = list("Handle it yourselves!","Illegible fax","Fax not signed","Not Right Now","You are wasting our time", "Keep up the good work", "ERT Instructions") var/stype = input(src.owner, "Which type of standard reply do you wish to send to [H]?","Choose your paperwork", "") as null|anything in stypes - var/tmsg = "



    Nanotrasen Science Station [GLOB.using_map.station_short]


    NAS Trurl Communications Department Report


    " + var/tmsg = "



    [SSmapping.map_datum.fluff_name]


    NAS Trurl Communications Department Report


    " if(stype == "Handle it yourselves!") tmsg += "Greetings, esteemed crewmember. Your fax has been DECLINED automatically by NAS Trurl Fax Registration.

    Please proceed in accordance with Standard Operating Procedure and/or Space Law. You are fully trained to handle this situation without Central Command intervention.

    This is an automatic message." else if(stype == "Illegible fax") diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index 43b806b86f5..90b0fb912ae 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -179,3 +179,28 @@ GLOBAL_VAR_INIT(intercom_range_display_status, 0) to_chat(world, "There are [count] objects of type [type_path] in the game world.") SSblackbox.record_feedback("tally", "admin_verb", 1, "Count Objects (Global)") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + +/client/proc/set_next_map() + set category = "Server" + set name = "Set Next Map" + + if(!check_rights(R_SERVER)) + return + + var/list/map_datums = list() + for(var/x in subtypesof(/datum/map)) + var/datum/map/M = x + map_datums["[initial(M.fluff_name)] ([initial(M.technical_name)])"] = M // Put our map in + + var/target_map_name = input(usr, "Select target map", "Next map", null) as null|anything in map_datums + + if(!target_map_name) + return + + var/datum/map/TM = map_datums[target_map_name] + SSmapping.next_map = new TM + var/announce_to_players = alert(usr, "Do you wish to tell the playerbase about your choice?", "Announce", "Yes", "No") + message_admins("[key_name_admin(usr)] has set the next map to [SSmapping.next_map.fluff_name] ([SSmapping.next_map.technical_name])") + log_admin("[key_name(usr)] has set the next map to [SSmapping.next_map.fluff_name] ([SSmapping.next_map.technical_name])") + if(announce_to_players == "Yes") + to_chat(world, "[key] has chosen the following map for next round: [SSmapping.next_map.fluff_name] ([SSmapping.next_map.technical_name])") diff --git a/code/modules/antagonists/traitor/contractor/datums/syndicate_contract.dm b/code/modules/antagonists/traitor/contractor/datums/syndicate_contract.dm index 210f2cb01fd..fe18df41628 100644 --- a/code/modules/antagonists/traitor/contractor/datums/syndicate_contract.dm +++ b/code/modules/antagonists/traitor/contractor/datums/syndicate_contract.dm @@ -301,7 +301,7 @@ else if(!ismob(contract.target.current)) invalidate() return - U.message_holder("Extraction signal received, agent. [GLOB.using_map.full_name]'s bluespace transport jamming systems have been sabotaged. "\ + U.message_holder("Extraction signal received, agent. [SSmapping.map_datum.fluff_name]'s bluespace transport jamming systems have been sabotaged. "\ + "We have opened a temporary portal at your flare location - proceed to the target's extraction by inserting them into the portal.", 'sound/effects/confirmdropoff.ogg') // Open a portal var/obj/effect/portal/redspace/contractor/P = new(get_turf(F), pick(GLOB.syndieprisonwarp), null, 0) @@ -528,7 +528,7 @@ var/datum/feed_message/FM = new FM.author = "Nyx Daily" FM.admin_locked = TRUE - FM.body = "Suspected Syndicate activity was reported in the system. Rumours have surfaced about a [R?.fields["rank"] || M?.mind.assigned_role || DEFAULT_RANK] aboard the [GLOB.using_map.full_name] being the victim of a kidnapping.\n\n" +\ + FM.body = "Suspected Syndicate activity was reported in the system. Rumours have surfaced about a [R?.fields["rank"] || M?.mind.assigned_role || DEFAULT_RANK] aboard the [SSmapping.map_datum.fluff_name] being the victim of a kidnapping.\n\n" +\ "A reliable source said the following: There was a note with the victim's initials which were \"[initials]\" and a scribble saying \"[fluff_message]\"" GLOB.news_network.get_channel_by_name("Nyx Daily")?.add_message(FM) @@ -539,7 +539,7 @@ var/datum/feed_message/FM2 = new FM2.author = "Nyx Daily" FM2.admin_locked = TRUE - FM2.body = "Nanotrasen's Asset Management board has resigned today after a series of kidnappings aboard the [GLOB.using_map.full_name]." +\ + FM2.body = "Nanotrasen's Asset Management board has resigned today after a series of kidnappings aboard the [SSmapping.map_datum.fluff_name]." +\ "One former member of the board was heard saying: \"I can't do this anymore. How does a single shift on this cursed station manage to cost us over ten million Credits in ransom payments? Is there no security aboard?!\"" GLOB.news_network.get_channel_by_name("Nyx Daily")?.add_message(FM2) diff --git a/code/modules/awaymissions/maploader/reader.dm b/code/modules/awaymissions/maploader/reader.dm index 9f3e629d6b0..533947d58e3 100644 --- a/code/modules/awaymissions/maploader/reader.dm +++ b/code/modules/awaymissions/maploader/reader.dm @@ -237,6 +237,11 @@ GLOBAL_DATUM_INIT(_preloader, /datum/dmm_suite/preloader, new()) full_def = copytext(full_def, variables_start + 1, length(full_def)) // removing the last '}' fields = readlist(full_def, ";") + for(var/I in fields) + var/value = fields[I] + if(istext(value)) + fields[I] = apply_text_macros(value) + // then fill the members_attributes list with the corresponding variables members_attributes.len++ members_attributes[index++] = fields diff --git a/code/modules/map_fluff/cyberiad.dm b/code/modules/map_fluff/cyberiad.dm deleted file mode 100644 index e0865f6fb1d..00000000000 --- a/code/modules/map_fluff/cyberiad.dm +++ /dev/null @@ -1,10 +0,0 @@ -/datum/map/cyberiad - name = "Cyberiad" - full_name = "NSS Cyberiad" - - station_name = "NSS Cyberiad" - station_short = "Cyberiad" - dock_name = "NAS Trurl" - company_name = "Nanotrasen" - company_short = "NT" - starsys_name = "Epsilon Eridani " diff --git a/code/modules/map_fluff/delta.dm b/code/modules/map_fluff/delta.dm deleted file mode 100644 index d68266e3146..00000000000 --- a/code/modules/map_fluff/delta.dm +++ /dev/null @@ -1,10 +0,0 @@ -/datum/map/delta - name = "Delta" - full_name = "NSS Kerberos" - - station_name = "NSS Kerberos" - station_short = "Kerberos" - dock_name = "NAS Trurl" - company_name = "Nanotrasen" - company_short = "NT" - starsys_name = "Epsilon Eridani " diff --git a/code/modules/map_fluff/maps.dm b/code/modules/map_fluff/maps.dm deleted file mode 100644 index e2684d5c735..00000000000 --- a/code/modules/map_fluff/maps.dm +++ /dev/null @@ -1,10 +0,0 @@ -/datum/map - var/name = "Unnamed Map" - var/full_name = "Unnamed Map" - - var/station_name = "BAD Station" - var/station_short = "Baddy" - var/dock_name = "THE PirateBay" - var/company_name = "BadMan" - var/company_short = "BM" - var/starsys_name = "Dull Star" diff --git a/code/modules/map_fluff/metastation.dm b/code/modules/map_fluff/metastation.dm deleted file mode 100644 index a8714b5cb19..00000000000 --- a/code/modules/map_fluff/metastation.dm +++ /dev/null @@ -1,10 +0,0 @@ -/datum/map/metastation - name = "MetaStation" - full_name = "NSS Cerebron" - - station_name = "NSS Cerebron" - station_short = "Cerebron" - dock_name = "NAS Trurl" - company_name = "Nanotrasen" - company_short = "NT" - starsys_name = "Epsilon Eridani " diff --git a/code/modules/mapping/base_map_datum.dm b/code/modules/mapping/base_map_datum.dm new file mode 100644 index 00000000000..6a5c7260f3a --- /dev/null +++ b/code/modules/mapping/base_map_datum.dm @@ -0,0 +1,14 @@ +/** + * Map Datum + * + * Datum which holds all of the information for maps ingame + * This is used for showing map information, as well as map loading + * + **/ +/datum/map + /// Name of the map to be shown in the statpanel + var/fluff_name + /// Name to be used when using the map from a technical standpoint. Used in TGUI Nanomaps among other things. + var/technical_name + /// Path to the map file + var/map_path diff --git a/code/modules/mapping/cyberiad.dm b/code/modules/mapping/cyberiad.dm new file mode 100644 index 00000000000..29c27d59c73 --- /dev/null +++ b/code/modules/mapping/cyberiad.dm @@ -0,0 +1,4 @@ +/datum/map/cyberiad + fluff_name = "NSS Cyberiad" + technical_name = "Cyberiad" + map_path = "_maps/map_files/cyberiad/cyberiad.dmm" diff --git a/code/modules/mapping/delta.dm b/code/modules/mapping/delta.dm new file mode 100644 index 00000000000..6b8bbce94cd --- /dev/null +++ b/code/modules/mapping/delta.dm @@ -0,0 +1,4 @@ +/datum/map/delta + fluff_name = "NSS Kerberos" + technical_name = "Delta" + map_path = "_maps/map_files/Delta/delta.dmm" diff --git a/code/modules/mapping/metastation.dm b/code/modules/mapping/metastation.dm new file mode 100644 index 00000000000..654aad46ac8 --- /dev/null +++ b/code/modules/mapping/metastation.dm @@ -0,0 +1,4 @@ +/datum/map/metastation + fluff_name = "NSS Cerebron" + technical_name = "MetaStation" + map_path = "_maps/map_files/MetaStation/MetaStation.dmm" diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 601b73a3a38..e0a778a1737 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -963,6 +963,9 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ statpanel("Status") // We only want alt-clicked turfs to come before Status stat(null, "Round ID: [GLOB.round_id ? GLOB.round_id : "NULL"]") + stat(null, "Map: [SSmapping.map_datum.fluff_name]") + if(SSmapping.next_map) + stat(null, "Next Map: [SSmapping.next_map.fluff_name]") if(mob_spell_list && mob_spell_list.len) for(var/obj/effect/proc_holder/spell/S in mob_spell_list) diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index 8a5c2118794..3be1df48458 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -269,6 +269,8 @@ for(var/mob/M in GLOB.player_list) if(!isnewplayer(M) && !M.client.karma_spent && !(M.client.ckey in GLOB.karma_spenders) && !M.get_preference(PREFTOGGLE_DISABLE_KARMA_REMINDER)) to_chat(M, "You have not yet spent your karma for the round; was there a player worthy of receiving your reward? Look under Special Verbs tab, Award Karma.") + if(config.map_voting_enabled) + SSvote.initiate_vote("map", "the server", TRUE) if(SHUTTLE_ESCAPE) if(time_left <= 0) diff --git a/code/modules/space_management/level_traits.dm b/code/modules/space_management/level_traits.dm index 6aa3fa802a7..c11a1e6e47c 100644 --- a/code/modules/space_management/level_traits.dm +++ b/code/modules/space_management/level_traits.dm @@ -36,7 +36,8 @@ secure = (z == level_name_to_num(CENTCOMM)) return secure -GLOBAL_LIST_INIT(default_map_traits, MAP_TRANSITION_CONFIG) +// Only CC +GLOBAL_LIST_INIT(default_map_traits, list(CC_TRANSITION_CONFIG)) /proc/check_level_trait(z, trait) if(!z) diff --git a/code/modules/tgui/tgui.dm b/code/modules/tgui/tgui.dm index ae2b695b005..c9ab043cf4c 100644 --- a/code/modules/tgui/tgui.dm +++ b/code/modules/tgui/tgui.dm @@ -197,7 +197,7 @@ "fancy" = user.client.prefs.toggles2 & PREFTOGGLE_2_FANCYUI, "observer" = isobserver(user), "window" = window_id, - "map" = (GLOB.using_map && GLOB.using_map.name) ? GLOB.using_map.name : "Unknown", + "map" = SSmapping.map_datum.technical_name, "ref" = "[src.UID()]" ) diff --git a/code/modules/world_topic/status.dm b/code/modules/world_topic/status.dm index 84eaf1831f3..0bd3b8d8da4 100644 --- a/code/modules/world_topic/status.dm +++ b/code/modules/world_topic/status.dm @@ -30,7 +30,7 @@ player_count++ status_info["players"] = player_count status_info["admins"] = admin_count - status_info["map_name"] = GLOB.map_name ? GLOB.map_name : "Unknown" + status_info["map_name"] = SSmapping.map_datum.fluff_name // Add more info if we are authed if(key_valid) diff --git a/config/example/config.txt b/config/example/config.txt index c378f41b89d..a88b2f705e4 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -470,4 +470,7 @@ CENTCOM_BAN_DB_URL https://centcom.melonmesa.com/ban/search/ MAX_CLIENT_CID_HISTORY 20 ## Uncomment to enable automatic performance profiling of rounds -ENABLE_AUTO_PROFILER \ No newline at end of file +ENABLE_AUTO_PROFILER + +## Uncomment to enable map voting +#ENABLE_MAP_VOTING diff --git a/paradise.dme b/paradise.dme index 8d48f8e1858..48d929fe5b9 100644 --- a/paradise.dme +++ b/paradise.dme @@ -11,7 +11,8 @@ // END_PREFERENCES // BEGIN_INCLUDE #include "_maps\__MAP_DEFINES.dm" -#include "_maps\cyberiad.dm" +#include "_maps\base_map.dm" +#include "_maps\map_datums.dm" #include "code\_compile_options.dm" #include "code\hub.dm" #include "code\world.dm" @@ -1676,10 +1677,10 @@ #include "code\modules\lighting\lighting_setup.dm" #include "code\modules\lighting\lighting_source.dm" #include "code\modules\lighting\lighting_turf.dm" -#include "code\modules\map_fluff\cyberiad.dm" -#include "code\modules\map_fluff\delta.dm" -#include "code\modules\map_fluff\maps.dm" -#include "code\modules\map_fluff\metastation.dm" +#include "code\modules\mapping\base_map_datum.dm" +#include "code\modules\mapping\cyberiad.dm" +#include "code\modules\mapping\delta.dm" +#include "code\modules\mapping\metastation.dm" #include "code\modules\martial_arts\adminfu.dm" #include "code\modules\martial_arts\brawling.dm" #include "code\modules\martial_arts\cqc.dm" diff --git a/tools/ci/dm.sh b/tools/ci/dm.sh index 6bb00a65d7f..ea432fa5acb 100755 --- a/tools/ci/dm.sh +++ b/tools/ci/dm.sh @@ -38,12 +38,6 @@ do sed -i '1s/^/#define '$arg'\n/' $dmepath.mdme continue fi - if [[ $var == -M* ]] - then - sed -i '1s/^/#define MAP_OVERRIDE\n/' $dmepath.mdme - sed -i 's!// BEGIN_INCLUDE!// BEGIN_INCLUDE\n#include "_maps\\'$arg'.dm"!' $dmepath.mdme - continue - fi done #windows