From d84a87f66840894a05049615787200ca94150d7a Mon Sep 17 00:00:00 2001 From: Roxy <75404941+TealSeer@users.noreply.github.com> Date: Sat, 8 Nov 2025 17:19:55 -0500 Subject: [PATCH] Rewrites to fix compiler errors on 516.1670+ (#93801) ## About The Pull Request Fixes all instances of numbers being used as assoc list keys in things that aren't alists, either by turning them into alists or changing the keys to something else. Also adds new macros to support creating global alists, as a few global lists became alists. Most of these are pretty simple and self-explanatory but - The GLOB.huds one necessitated rewriting because code depended on it being a non-assoc list, which it technically was because the defines it used as keys were numbers so BYOND turned it into a regular list, most of this was for loops through all the subtypes of `/datum/atom_hud/data/diagnostic` of which there's only one, so I just changed it to get that type directly by key - NT Frontier used number indexes which it looped through for some reason and also passed to TGUI, changed these to strings and adjusted the TGUI to match, I tested this and it works fine ## Why It's Good For The Game Makes the code compile, I couldn't test everything but I tried to check all usages of affected vars to make sure they wouldn't break from being switched to alists, a TM might be in order just to be sure nothing's fucked ## Changelog :cl: refactor: rewrote all cases of numbers being used as keys in non-alist associative lists /:cl: --- code/__DEFINES/__globals.dm | 6 ++ code/__DEFINES/atmospherics/atmos_piping.dm | 4 +- code/__DEFINES/food.dm | 4 +- code/__DEFINES/research.dm | 4 +- code/__byond_version_compat.dm | 3 - .../subsystem/dynamic/_dynamic_ruleset.dm | 65 ++++++++----------- .../dynamic/dynamic_ruleset_midround.dm | 24 +++---- .../dynamic/dynamic_ruleset_roundstart.dm | 12 ++-- .../subsystem/processing/station.dm | 2 +- code/controllers/subsystem/timer.dm | 40 ++++++------ code/datums/hud.dm | 2 +- .../quirks/neutral_quirks/transhumanist.dm | 6 +- code/game/data_huds.dm | 8 +-- code/game/machinery/doors/airlock.dm | 8 +-- code/game/machinery/launch_pad.dm | 8 +-- code/modules/admin/smites/boneless.dm | 2 +- .../atmospherics/gasmixtures/reactions.dm | 8 +-- code/modules/mob/living/basic/bots/_bots.dm | 4 +- code/modules/mob/living/basic/drone/_drone.dm | 4 +- code/modules/mob/living/living.dm | 4 +- code/modules/mob/living/silicon/silicon.dm | 4 +- .../mob/living/simple_animal/bot/bot.dm | 4 +- .../mob_spawn/corpses/mining_corpses.dm | 2 +- code/modules/research/ordnance/_scipaper.dm | 24 +++---- code/modules/vehicles/mecha/_mecha.dm | 8 +-- .../packages/tgui/interfaces/NtosScipaper.jsx | 12 ++-- 26 files changed, 131 insertions(+), 141 deletions(-) diff --git a/code/__DEFINES/__globals.dm b/code/__DEFINES/__globals.dm index 3639d559255..9f3ea839e76 100644 --- a/code/__DEFINES/__globals.dm +++ b/code/__DEFINES/__globals.dm @@ -49,6 +49,12 @@ /// Create a typed list global that is initialized as an empty list #define GLOBAL_LIST_EMPTY_TYPED(X, Typepath) GLOBAL_LIST_INIT_TYPED(X, Typepath, list()) +/// Create an alist global with an initializer expression +#define GLOBAL_ALIST_INIT(X, InitValue) GLOBAL_RAW(/alist/##X); GLOBAL_MANAGED(X, InitValue) + +// Create an alist global that is initialized as an empty list +#define GLOBAL_ALIST_EMPTY(X) GLOBAL_ALIST_INIT(X, alist()) + /// Create a typed global with an initializer expression #define GLOBAL_DATUM_INIT(X, Typepath, InitValue) GLOBAL_RAW(Typepath/##X); GLOBAL_MANAGED(X, InitValue) diff --git a/code/__DEFINES/atmospherics/atmos_piping.dm b/code/__DEFINES/atmospherics/atmos_piping.dm index 188798f95d2..54d29ffa59d 100644 --- a/code/__DEFINES/atmospherics/atmos_piping.dm +++ b/code/__DEFINES/atmospherics/atmos_piping.dm @@ -68,9 +68,9 @@ #define TANK_MERGE_OVERPRESSURE "tank_overpressure" // Indices for the reaction_results returned by explosion_information() /// Reactions that have happened in the tank. -#define TANK_RESULTS_REACTION 1 +#define TANK_RESULTS_REACTION "results_reaction" /// Additional information of the tank. -#define TANK_RESULTS_MISC 2 +#define TANK_RESULTS_MISC "results_misc" /// Color used by omni-color pipes #define ATMOS_COLOR_OMNI COLOR_VERY_LIGHT_GRAY diff --git a/code/__DEFINES/food.dm b/code/__DEFINES/food.dm index acc6a6528e5..96d110d3799 100644 --- a/code/__DEFINES/food.dm +++ b/code/__DEFINES/food.dm @@ -121,7 +121,7 @@ DEFINE_BITFIELD(foodtypes, list( #define FOOD_COMPLEXITY_5 5 /// Labels for food quality -GLOBAL_LIST_INIT(food_quality_description, list( +GLOBAL_ALIST_INIT(food_quality_description, alist( FOOD_QUALITY_NORMAL = "okay", FOOD_QUALITY_NICE = "nice", FOOD_QUALITY_GOOD = "good", @@ -132,7 +132,7 @@ GLOBAL_LIST_INIT(food_quality_description, list( )) /// Weighted lists of crafted food buffs randomly given according to crafting_complexity unless the food has a specific buff -GLOBAL_LIST_INIT(food_buffs, list( +GLOBAL_ALIST_INIT(food_buffs, alist( FOOD_COMPLEXITY_1 = list( /datum/status_effect/food/haste = 1, ), diff --git a/code/__DEFINES/research.dm b/code/__DEFINES/research.dm index f3b2cf81948..c78b4938621 100644 --- a/code/__DEFINES/research.dm +++ b/code/__DEFINES/research.dm @@ -74,8 +74,8 @@ //Defines how many percent of vat grown atoms come out as hue shifted color mutants. A flat chance for now, maybe in the future dependant on the cell line. #define CYTO_SHINY_CHANCE 15 -#define SCIPAPER_COOPERATION_INDEX 1 -#define SCIPAPER_FUNDING_INDEX 2 +#define SCIPAPER_COOPERATION_INDEX "cooperation" +#define SCIPAPER_FUNDING_INDEX "funding" #define SCIENTIFIC_COOPERATION_PURCHASE_MULTIPLIER 0.01 /// How much money is one point of gain worth. #define SCIPAPER_GAIN_TO_MONEY 125 diff --git a/code/__byond_version_compat.dm b/code/__byond_version_compat.dm index 0320e224c97..186a8844bcf 100644 --- a/code/__byond_version_compat.dm +++ b/code/__byond_version_compat.dm @@ -13,9 +13,6 @@ #if (DM_VERSION == 516 && DM_BUILD == 1660) #error This version of BYOND (516.1660) has a bug which prevents this codebase from loading properly. If possible, update your BYOND version. Otherwise, visit www.byond.com/download/build to download an older release. #endif -#if (DM_VERSION == 516 && (DM_BUILD == 1670 || DM_BUILD == 1671)) -#error This version of BYOND (516.1671) has a bug which prevents this codebase from compiling. If possible, update your BYOND version. Otherwise, visit www.byond.com/download/build to download an older release. -#endif // Keep savefile compatibilty at minimum supported level /savefile/byond_version = MIN_COMPILER_VERSION diff --git a/code/controllers/subsystem/dynamic/_dynamic_ruleset.dm b/code/controllers/subsystem/dynamic/_dynamic_ruleset.dm index e03f733eb7a..ece1d5f1b4b 100644 --- a/code/controllers/subsystem/dynamic/_dynamic_ruleset.dm +++ b/code/controllers/subsystem/dynamic/_dynamic_ruleset.dm @@ -33,7 +33,7 @@ * Or * - A single weight for all tiers. */ - var/list/weight = 0 + var/alist/weight = 0 /** * The min population for which this ruleset is available. * @@ -43,7 +43,7 @@ * Or * - A single min population for all tiers. */ - var/list/min_pop = 0 + var/alist/min_pop = 0 /// List of roles that are blacklisted from this ruleset /// For roundstart rulesets, it will prevent players from being selected for this ruleset if they have one of these roles /// For latejoin or midround rulesets, it will prevent players from being assigned to this ruleset if they have one of these roles @@ -121,47 +121,15 @@ return FALSE return ..() -/// Used to create tier lists for weights and min_pop values +/// Used to create tier alists for weights and min_pop values /datum/dynamic_ruleset/proc/load_tier_list(list/incoming_list) PRIVATE_PROC(TRUE) - var/list/tier_list = new /list(4) - // loads a list of list("2" = 1, "3" = 3) into a list(null, 1, 3, null) + var/alist/tier_list = alist() + // loads a list of list("2" = 1, "3" = 3) into an alist(2 = 1, 3 = 3) for(var/tier in incoming_list) tier_list[text2num(tier)] = incoming_list[tier] - // turn list(null, 1, 3, null) into list(1, 1, 3, null) - for(var/i in 1 to length(tier_list)) - var/val = tier_list[i] - if(isnum(val)) - break - for(var/j in i to length(tier_list)) - var/other_val = tier_list[j] - if(!isnum(other_val)) - continue - tier_list[i] = other_val - break - - // turn list(1, 1, 3, null) into list(1, 1, 3, 3) - for(var/i in length(tier_list) to 1 step -1) - var/val = tier_list[i] - if(isnum(val)) - break - for(var/j in i to 1 step -1) - var/other_val = tier_list[j] - if(!isnum(other_val)) - continue - tier_list[i] = other_val - break - - // we can assert that tier[1] and tier[4] are not null, but we cannot say the same for tier[2] and tier[3] - // this can be happen due to the following setup: list(1, null, null, 4) - // (which is an invalid config, and should be fixed by the operator) - if(isnull(tier_list[2])) - tier_list[2] = tier_list[1] - if(isnull(tier_list[3])) - tier_list[3] = tier_list[4] - return tier_list /** @@ -170,6 +138,25 @@ /datum/dynamic_ruleset/proc/can_be_selected() return TRUE +/// Gets the list value for the given tier, otherwise use next highest tier, +/// or failing that, next lowest +/datum/dynamic_ruleset/proc/get_tier_specific_value(alist/values, tier) + PRIVATE_PROC(TRUE) + if(isnum(values[tier])) + return values[tier] + + // search higher tiers + for(var/i in tier to 4) + if(isnum(values[i])) + return values[i] + + // no dice, lower tiers? + for(var/i in tier to 1 step -1) + if(isnum(values[i])) + return values[i] + + return 0 + /** * Calculates the weight of this ruleset for the given tier. * @@ -183,11 +170,11 @@ return 0 if(!can_be_selected()) return 0 - var/final_minpop = islist(min_pop) ? min_pop[tier] : min_pop + var/final_minpop = islist(min_pop) ? get_tier_specific_value(min_pop, tier) : min_pop if(final_minpop > population_size) return 0 - var/final_weight = islist(weight) ? weight[tier] : weight + var/final_weight = islist(weight) ? get_tier_specific_value(weight, tier) : weight for(var/datum/dynamic_ruleset/other_ruleset as anything in SSdynamic.executed_rulesets) if(other_ruleset == src) continue diff --git a/code/controllers/subsystem/dynamic/dynamic_ruleset_midround.dm b/code/controllers/subsystem/dynamic/dynamic_ruleset_midround.dm index 6df942b5242..95672517f9c 100644 --- a/code/controllers/subsystem/dynamic/dynamic_ruleset_midround.dm +++ b/code/controllers/subsystem/dynamic/dynamic_ruleset_midround.dm @@ -26,7 +26,7 @@ midround_type = HEAVY_MIDROUND false_alarm_able = TRUE ruleset_flags = RULESET_INVADER - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 0, DYNAMIC_TIER_MEDIUMHIGH = 1, @@ -271,7 +271,7 @@ pref_flag = ROLE_WIZARD_MIDROUND jobban_flag = ROLE_WIZARD ruleset_flags = RULESET_INVADER|RULESET_HIGH_IMPACT - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 0, DYNAMIC_TIER_MEDIUMHIGH = 1, @@ -294,7 +294,7 @@ pref_flag = ROLE_OPERATIVE_MIDROUND jobban_flag = ROLE_OPERATIVE ruleset_flags = RULESET_INVADER|RULESET_HIGH_IMPACT - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 1, DYNAMIC_TIER_MEDIUMHIGH = 3, @@ -378,7 +378,7 @@ false_alarm_able = TRUE pref_flag = ROLE_BLOB ruleset_flags = RULESET_INVADER - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 1, DYNAMIC_TIER_MEDIUMHIGH = 3, @@ -418,7 +418,7 @@ false_alarm_able = TRUE pref_flag = ROLE_ALIEN ruleset_flags = RULESET_INVADER - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 1, DYNAMIC_TIER_MEDIUMHIGH = 5, @@ -505,7 +505,7 @@ false_alarm_able = TRUE pref_flag = ROLE_SPACE_DRAGON ruleset_flags = RULESET_INVADER - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 3, DYNAMIC_TIER_MEDIUMHIGH = 5, @@ -575,7 +575,7 @@ midround_type = HEAVY_MIDROUND pref_flag = ROLE_NINJA ruleset_flags = RULESET_INVADER - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 0, DYNAMIC_TIER_MEDIUMHIGH = 1, @@ -678,7 +678,7 @@ min_antag_cap = 2 max_antag_cap = 3 repeatable_weight_decrease = 4 - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 3, DYNAMIC_TIER_MEDIUMHIGH = 4, @@ -1104,7 +1104,7 @@ max_antag_cap = 4 repeatable_weight_decrease = 8 blacklisted_roles = list() - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 3, DYNAMIC_TIER_MEDIUMHIGH = 8, @@ -1119,7 +1119,7 @@ pref_flag = ROLE_MALF_MIDROUND jobban_flag = ROLE_MALF ruleset_flags = RULESET_HIGH_IMPACT - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 1, DYNAMIC_TIER_MEDIUMHIGH = 3, @@ -1147,7 +1147,7 @@ midround_type = HEAVY_MIDROUND pref_flag = ROLE_BLOB_INFECTION jobban_flag = ROLE_BLOB - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 1, DYNAMIC_TIER_MEDIUMHIGH = 3, @@ -1171,7 +1171,7 @@ midround_type = LIGHT_MIDROUND pref_flag = ROLE_OBSESSED blacklisted_roles = list() - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 5, DYNAMIC_TIER_LOWMEDIUM = 5, DYNAMIC_TIER_MEDIUMHIGH = 3, diff --git a/code/controllers/subsystem/dynamic/dynamic_ruleset_roundstart.dm b/code/controllers/subsystem/dynamic/dynamic_ruleset_roundstart.dm index 7bea57bffe8..417f7164c21 100644 --- a/code/controllers/subsystem/dynamic/dynamic_ruleset_roundstart.dm +++ b/code/controllers/subsystem/dynamic/dynamic_ruleset_roundstart.dm @@ -49,7 +49,7 @@ pref_flag = ROLE_MALF preview_antag_datum = /datum/antagonist/malf_ai ruleset_flags = RULESET_HIGH_IMPACT - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 1, DYNAMIC_TIER_MEDIUMHIGH = 3, @@ -116,7 +116,7 @@ preview_antag_datum = /datum/antagonist/wizard pref_flag = ROLE_WIZARD ruleset_flags = RULESET_INVADER|RULESET_HIGH_IMPACT - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 0, DYNAMIC_TIER_MEDIUMHIGH = 1, @@ -147,7 +147,7 @@ preview_antag_datum = /datum/antagonist/cult pref_flag = ROLE_CULTIST ruleset_flags = RULESET_HIGH_IMPACT - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 1, DYNAMIC_TIER_MEDIUMHIGH = 3, @@ -208,7 +208,7 @@ preview_antag_datum = /datum/antagonist/nukeop pref_flag = ROLE_OPERATIVE ruleset_flags = RULESET_INVADER|RULESET_HIGH_IMPACT - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 1, DYNAMIC_TIER_MEDIUMHIGH = 3, @@ -292,7 +292,7 @@ preview_antag_datum = /datum/antagonist/rev/head pref_flag = ROLE_REV_HEAD ruleset_flags = RULESET_HIGH_IMPACT - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 1, DYNAMIC_TIER_MEDIUMHIGH = 3, @@ -367,7 +367,7 @@ config_tag = "Roundstart Spies" preview_antag_datum = /datum/antagonist/spy pref_flag = ROLE_SPY - weight = list( + weight = alist( DYNAMIC_TIER_LOW = 0, DYNAMIC_TIER_LOWMEDIUM = 1, DYNAMIC_TIER_MEDIUMHIGH = 3, diff --git a/code/controllers/subsystem/processing/station.dm b/code/controllers/subsystem/processing/station.dm index 7ca7b283204..c19e04559cd 100644 --- a/code/controllers/subsystem/processing/station.dm +++ b/code/controllers/subsystem/processing/station.dm @@ -7,7 +7,7 @@ PROCESSING_SUBSYSTEM_DEF(station) ///A list of currently active station traits var/list/station_traits = list() ///Assoc list of trait type || assoc list of traits with weighted value. Used for picking traits from a specific category. - var/list/selectable_traits_by_types = list(STATION_TRAIT_POSITIVE = list(), STATION_TRAIT_NEUTRAL = list(), STATION_TRAIT_NEGATIVE = list()) + var/alist/selectable_traits_by_types = alist(STATION_TRAIT_POSITIVE = list(), STATION_TRAIT_NEUTRAL = list(), STATION_TRAIT_NEGATIVE = list()) ///Currently active announcer. Starts as a type but gets initialized after traits are selected var/datum/centcom_announcer/announcer = /datum/centcom_announcer/default ///A list of trait roles that should be protected from antag diff --git a/code/controllers/subsystem/timer.dm b/code/controllers/subsystem/timer.dm index 20fe4eb47b6..ef6826396c2 100644 --- a/code/controllers/subsystem/timer.dm +++ b/code/controllers/subsystem/timer.dm @@ -519,30 +519,30 @@ SUBSYSTEM_DEF(timer) #if defined(TIMER_DEBUG) // Generate debug-friendly list for timer, more complex but also more expensive timer_info = list( - 1 = id, - 2 = timeToRun, - 3 = wait, - 4 = flags, - 5 = callBack, /* Safe to hold this directly because it's never del'd */ - 6 = "[callBack.object]", - 7 = text_ref(callBack.object), - 8 = getcallingtype(), - 9 = callBack.delegate, - 10 = callBack.arguments ? callBack.arguments.Copy() : null, - 11 = "[source]" + /* 1 = */ id, + /* 2 = */ timeToRun, + /* 3 = */ wait, + /* 4 = */ flags, + /* 5 = */ callBack, /* Safe to hold this directly because it's never del'd */ + /* 6 = */ "[callBack.object]", + /* 7 = */ text_ref(callBack.object), + /* 8 = */ getcallingtype(), + /* 9 = */ callBack.delegate, + /* 10 = */ callBack.arguments ? callBack.arguments.Copy() : null, + /* 11 = */ "[source]" ) #else // Generate a debuggable list for the timer, simpler but wayyyy cheaper, string generation (and ref/copy memes) is a bitch and this saves a LOT of time timer_info = list( - 1 = id, - 2 = timeToRun, - 3 = wait, - 4 = flags, - 5 = callBack, /* Safe to hold this directly because it's never del'd */ - 6 = "[callBack.object]", - 7 = getcallingtype(), - 8 = callBack.delegate, - 9 = "[source]" + /* 1 = */ id, + /* 2 = */ timeToRun, + /* 3 = */ wait, + /* 4 = */ flags, + /* 5 = */ callBack, /* Safe to hold this directly because it's never del'd */ + /* 6 = */ "[callBack.object]", + /* 7 = */ getcallingtype(), + /* 8 = */ callBack.delegate, + /* 9 = */ "[source]" ) #endif diff --git a/code/datums/hud.dm b/code/datums/hud.dm index 8c7678347ee..263337375fc 100644 --- a/code/datums/hud.dm +++ b/code/datums/hud.dm @@ -7,7 +7,7 @@ GLOBAL_LIST_EMPTY(all_huds) GLOBAL_LIST_EMPTY(huds_by_category) //GLOBAL HUD LIST -GLOBAL_LIST_INIT(huds, list( +GLOBAL_ALIST_INIT(huds, alist( DATA_HUD_SECURITY_BASIC = new /datum/atom_hud/data/human/security/basic(), DATA_HUD_SECURITY_ADVANCED = new /datum/atom_hud/data/human/security/advanced(), DATA_HUD_MEDICAL_BASIC = new /datum/atom_hud/data/human/medical/basic(), diff --git a/code/datums/quirks/neutral_quirks/transhumanist.dm b/code/datums/quirks/neutral_quirks/transhumanist.dm index cbd85150e76..58b9c1a6bd0 100644 --- a/code/datums/quirks/neutral_quirks/transhumanist.dm +++ b/code/datums/quirks/neutral_quirks/transhumanist.dm @@ -66,7 +66,7 @@ else if(organ.organ_flags & ORGAN_ORGANIC) organic_bodytypes += 0.02 - return list( + return alist( BODYPART_SCORE_ORGANIC = organic_bodytypes, BODYPART_SCORE_SILICON = silicon_bodytypes, BODYPART_SCORE_OTHER_BODYTYPES = other_bodytypes, @@ -76,7 +76,7 @@ /datum/quirk/transhumanist/proc/calculate_bodypart_score() SIGNAL_HANDLER - var/list/score = get_bodypart_score(quirk_holder) + var/alist/score = get_bodypart_score(quirk_holder) var/organic_bodytypes = score[BODYPART_SCORE_ORGANIC] var/silicon_bodytypes = score[BODYPART_SCORE_SILICON] var/other_bodytypes = score[BODYPART_SCORE_OTHER_BODYTYPES] @@ -177,7 +177,7 @@ continue if(iscarbon(target)) - var/list/score = get_bodypart_score(target, limbs_only = TRUE) + var/alist/score = get_bodypart_score(target, limbs_only = TRUE) // For an average human, they'll need 2 augmented limbs to not get counted as an organic nor a silicon. // If some monstrosity has 20-30 organic limbs, they'll likely need more. if(score[BODYPART_SCORE_OVERALL] < 1) diff --git a/code/game/data_huds.dm b/code/game/data_huds.dm index dbda746a728..892c91faced 100644 --- a/code/game/data_huds.dm +++ b/code/game/data_huds.dm @@ -8,12 +8,12 @@ /* DATA HUD DATUMS */ /atom/proc/add_to_all_human_data_huds() - for(var/datum/atom_hud/data/human/hud in GLOB.huds) - hud.add_atom_to_hud(src) + for(var/hud_key, hud_type in GLOB.huds) + astype(hud_type, /datum/atom_hud/data/human)?.add_atom_to_hud(src) /atom/proc/remove_from_all_data_huds() - for(var/datum/atom_hud/data/hud in GLOB.huds) - hud.remove_atom_from_hud(src) + for(var/hud_key, hud_type in GLOB.huds) + astype(hud_type, /datum/atom_hud/data)?.remove_atom_from_hud(src) /datum/atom_hud/data diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 65ce845a44b..d63e26f2fb3 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -179,8 +179,8 @@ damage_deflection = AIRLOCK_DAMAGE_DEFLECTION_R prepare_huds() - for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) - diag_hud.add_atom_to_hud(src) + var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] + diag_hud.add_atom_to_hud(src) diag_hud_set_electrified() @@ -314,8 +314,8 @@ close_others.Cut() QDEL_NULL(note) QDEL_NULL(seal) - for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) - diag_hud.remove_atom_from_hud(src) + var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] + diag_hud.remove_atom_from_hud(src) return ..() /obj/machinery/door/airlock/Exited(atom/movable/gone, direction) diff --git a/code/game/machinery/launch_pad.dm b/code/game/machinery/launch_pad.dm index 471e43f9413..1323a3354a6 100644 --- a/code/game/machinery/launch_pad.dm +++ b/code/game/machinery/launch_pad.dm @@ -38,8 +38,8 @@ /obj/machinery/launchpad/Initialize(mapload) . = ..() prepare_huds() - for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) - diag_hud.add_atom_to_hud(src) + var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] + diag_hud.add_atom_to_hud(src) update_hud() @@ -57,8 +57,8 @@ return ..() /obj/machinery/launchpad/Destroy() - for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) - diag_hud.remove_atom_from_hud(src) + var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] + diag_hud.remove_atom_from_hud(src) return ..() /obj/machinery/launchpad/examine(mob/user) diff --git a/code/modules/admin/smites/boneless.dm b/code/modules/admin/smites/boneless.dm index a3031ce13ff..3fd1a1121f4 100644 --- a/code/modules/admin/smites/boneless.dm +++ b/code/modules/admin/smites/boneless.dm @@ -11,7 +11,7 @@ var/mob/living/carbon/carbon_target = target for(var/obj/item/bodypart/limb as anything in carbon_target.bodyparts) - var/severity = pick_weight(list( + var/severity = pick_weight(alist( WOUND_SEVERITY_MODERATE = 1, WOUND_SEVERITY_SEVERE = 2, WOUND_SEVERITY_CRITICAL = 2, diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm index ffd45abb600..64cd36ca239 100644 --- a/code/modules/atmospherics/gasmixtures/reactions.dm +++ b/code/modules/atmospherics/gasmixtures/reactions.dm @@ -7,10 +7,10 @@ //Builds a list of gas id to reaction group for(var/gas_id in GLOB.meta_gas_info) priority_reactions[gas_id] = list( - PRIORITY_PRE_FORMATION = list(), - PRIORITY_FORMATION = list(), - PRIORITY_POST_FORMATION = list(), - PRIORITY_FIRE = list() + /* PRIORITY_PRE_FORMATION = */ list(), + /* PRIORITY_FORMATION = */ list(), + /* PRIORITY_POST_FORMATION = */ list(), + /* PRIORITY_FIRE = */ list() ) for(var/datum/gas_reaction/reaction as anything in subtypesof(/datum/gas_reaction)) diff --git a/code/modules/mob/living/basic/bots/_bots.dm b/code/modules/mob/living/basic/bots/_bots.dm index 58ecef8863d..5311dd06de7 100644 --- a/code/modules/mob/living/basic/bots/_bots.dm +++ b/code/modules/mob/living/basic/bots/_bots.dm @@ -131,8 +131,8 @@ GLOBAL_LIST_INIT(command_strings, list( //Adds bot to the diagnostic HUD system prepare_huds() - for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) - diag_hud.add_atom_to_hud(src) + var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] + diag_hud.add_atom_to_hud(src) diag_hud_set_bothealth() diag_hud_set_botstat() diag_hud_set_botmode() diff --git a/code/modules/mob/living/basic/drone/_drone.dm b/code/modules/mob/living/basic/drone/_drone.dm index d595dc5196b..d0825c53722 100644 --- a/code/modules/mob/living/basic/drone/_drone.dm +++ b/code/modules/mob/living/basic/drone/_drone.dm @@ -134,8 +134,8 @@ shy_update() alert_drones(DRONE_NET_CONNECT) - for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) - diag_hud.add_atom_to_hud(src) + var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] + diag_hud.add_atom_to_hud(src) add_traits(list( TRAIT_VENTCRAWLER_ALWAYS, diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index c3a0f479558..4581bdc6132 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -8,8 +8,8 @@ set_name() var/datum/atom_hud/data/human/medical/advanced/medhud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] medhud.add_atom_to_hud(src) - for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) - diag_hud.add_atom_to_hud(src) + var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] + diag_hud.add_atom_to_hud(src) faction += "[REF(src)]" GLOB.mob_living_list += src SSpoints_of_interest.make_point_of_interest(src) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index ae8b3531e7d..35dd81f7822 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -60,8 +60,8 @@ faction += FACTION_SILICON if(ispath(radio)) radio = new radio(src) - for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) - diag_hud.add_atom_to_hud(src) + var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] + diag_hud.add_atom_to_hud(src) diag_hud_set_status() diag_hud_set_health() add_sensors() diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 7fbe53a584e..8e742979b32 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -183,8 +183,8 @@ //Adds bot to the diagnostic HUD system prepare_huds() - for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) - diag_hud.add_atom_to_hud(src) + var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] + diag_hud.add_atom_to_hud(src) diag_hud_set_bothealth() diag_hud_set_botstat() diag_hud_set_botmode() diff --git a/code/modules/mob_spawn/corpses/mining_corpses.dm b/code/modules/mob_spawn/corpses/mining_corpses.dm index 4dc4e7d5ad0..1b15f0a39c0 100644 --- a/code/modules/mob_spawn/corpses/mining_corpses.dm +++ b/code/modules/mob_spawn/corpses/mining_corpses.dm @@ -262,7 +262,7 @@ else backpack_contents += backpack_loot if(prob(30)) - backpack_contents += list(/obj/item/stack/sheet/mineral/bananium = pick_weight(list( 1 = 3, 2 = 2, 3 = 1))) + backpack_contents += list(/obj/item/stack/sheet/mineral/bananium = pick_weight(alist( 1 = 3, 2 = 2, 3 = 1))) if(prob(10)) l_pocket = pick_weight(list( /obj/item/bikehorn/golden = 3, diff --git a/code/modules/research/ordnance/_scipaper.dm b/code/modules/research/ordnance/_scipaper.dm index f1d94af7631..7d3ea79b332 100644 --- a/code/modules/research/ordnance/_scipaper.dm +++ b/code/modules/research/ordnance/_scipaper.dm @@ -102,12 +102,12 @@ if(!tier || !experiment_path || !tracked_variable) return FALSE var/gain = calculate_gains(tier) - for (var/gain_type in 1 to gains.len) - gains[gain_type] = gain + for (var/gain_index in gains) + gains[gain_index] = gain if(!partner_path) continue var/datum/scientific_partner/partner = locate(partner_path) in SSresearch.scientific_partners - gains[gain_type] *= partner.multipliers[gain_type] + gains[gain_index] *= partner.multipliers[gain_index] /** Fully check if our paper have all the required variables, and prevent duplicate papers being published in the same tier. * Things to check: tier, gain, and partner here. ex_path and record datums in subtypes. @@ -151,23 +151,23 @@ /datum/scientific_paper/proc/return_gist() var/list/gist = list() var/list/transcripted_gains = list(SCIPAPER_COOPERATION_INDEX, SCIPAPER_FUNDING_INDEX) - for (var/index in 1 to transcripted_gains.len) + for (var/gain_index in transcripted_gains) if (!gains) - transcripted_gains[index] = "None" + transcripted_gains[gain_index] = "None" continue - switch (round(gains[index])) + switch (round(gains[gain_index])) if(-INFINITY to 0) - transcripted_gains[index] = "None" + transcripted_gains[gain_index] = "None" if(1 to 24) - transcripted_gains[index] = "Little" + transcripted_gains[gain_index] = "Little" if(25 to 49) - transcripted_gains[index] = "Moderate" + transcripted_gains[gain_index] = "Moderate" if(50 to 99) - transcripted_gains[index] = "Significant" + transcripted_gains[gain_index] = "Significant" if(100 to INFINITY) - transcripted_gains[index] = "Huge" + transcripted_gains[gain_index] = "Huge" else - transcripted_gains[index] = "Undefined" + transcripted_gains[gain_index] = "Undefined" gist["gains"] = transcripted_gains gist["title"] = title gist["author"] = author diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm index 82b69a43f8b..a418950f1d3 100644 --- a/code/modules/vehicles/mecha/_mecha.dm +++ b/code/modules/vehicles/mecha/_mecha.dm @@ -249,8 +249,8 @@ log_message("[src.name] created.", LOG_MECHA) GLOB.mechas_list += src //global mech list prepare_huds() - for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) - diag_hud.add_atom_to_hud(src) + var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] + diag_hud.add_atom_to_hud(src) diag_hud_set_mechhealth() diag_hud_set_mechcell() diag_hud_set_mechstat() @@ -305,8 +305,8 @@ QDEL_NULL(chassis_camera) GLOB.mechas_list -= src //global mech list - for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) - diag_hud.remove_atom_from_hud(src) //YEET + var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] + diag_hud.remove_atom_from_hud(src) //YEET return ..() ///Add parts on mech spawning. Skipped in manual construction. diff --git a/tgui/packages/tgui/interfaces/NtosScipaper.jsx b/tgui/packages/tgui/interfaces/NtosScipaper.jsx index 16ecad2e837..1f099b42f90 100644 --- a/tgui/packages/tgui/interfaces/NtosScipaper.jsx +++ b/tgui/packages/tgui/interfaces/NtosScipaper.jsx @@ -196,7 +196,7 @@ const PaperPublishing = (props) => { icon="info-circle" /> {' Cooperation: '} -
{gains[coopIndex - 1]}+
{gains[coopIndex]}