From 6d1f61b8432a6c1c9b683b49650d688f6df75d53 Mon Sep 17 00:00:00 2001 From: Roxy <75404941+TealSeer@users.noreply.github.com> Date: Tue, 17 Nov 2026 13:34:37 -0800 Subject: [PATCH 1/4] Rewrite number-keyed lists for BYOND 516.1670+ (tg #93801) BYOND 516.1670 and newer refuse to compile number keys in list(). Lists read by index keep list() with the keys commented out, lists that need real keys become alists, and the code that read them is updated. Ported from tgstation/tgstation#93801, minus the mass changeling and mass traitor rulesets, which this codebase doesn't have. --- code/__DEFINES/__globals.dm | 6 ++ code/__DEFINES/atmospherics/atmos_piping.dm | 4 +- code/__DEFINES/food.dm | 4 +- code/__DEFINES/research.dm | 4 +- .../subsystem/dynamic/_dynamic_ruleset.dm | 65 ++++++++----------- .../dynamic/dynamic_ruleset_midround.dm | 20 +++--- .../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 ++-- 25 files changed, 129 insertions(+), 136 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 6238e3e6638..d35c354463f 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", @@ -143,7 +143,7 @@ GLOBAL_LIST_INIT(food_quality_events, 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 c8a5b1d6e9b..a58a5ed065c 100644 --- a/code/__DEFINES/research.dm +++ b/code/__DEFINES/research.dm @@ -66,8 +66,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/controllers/subsystem/dynamic/_dynamic_ruleset.dm b/code/controllers/subsystem/dynamic/_dynamic_ruleset.dm index 2ca15349339..d1410941f90 100644 --- a/code/controllers/subsystem/dynamic/_dynamic_ruleset.dm +++ b/code/controllers/subsystem/dynamic/_dynamic_ruleset.dm @@ -30,7 +30,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. * @@ -40,7 +40,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 @@ -116,47 +116,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 /** @@ -165,6 +133,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. * @@ -178,11 +165,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 2058df26c0e..24238013888 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, @@ -415,7 +415,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, @@ -502,7 +502,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, @@ -572,7 +572,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, @@ -1077,7 +1077,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, @@ -1105,7 +1105,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, @@ -1129,7 +1129,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 1bdfe947615..6cb3d6e2a92 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 45a10f3a974..0c1118f16b9 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 e81ded951fe..bdfcf45d1f6 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 04ba0e52439..35d0ed314c4 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 30a969532b7..2f415dbb371 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() @@ -308,8 +308,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 7a76dc6ec4e..1641e4307d9 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 4cdf7f8ecf3..ca991fe37e7 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 6ddaea0e51a..a6fec58d534 100644 --- a/code/modules/mob/living/basic/drone/_drone.dm +++ b/code/modules/mob/living/basic/drone/_drone.dm @@ -133,8 +133,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 4778809a828..b115162dbd3 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 // VOIDCREW EDIT: mobs created on a planet inherit that footprint's native alliance. diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index b8c1c7d281f..48961e180ee 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -59,8 +59,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 cb740063e55..eb530c8958e 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 9edfbeddf8b..5160a5ef434 100644 --- a/code/modules/mob_spawn/corpses/mining_corpses.dm +++ b/code/modules/mob_spawn/corpses/mining_corpses.dm @@ -261,7 +261,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 b2e64b15edf..a7a84e05c71 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]}