Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions code/__DEFINES/__globals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
/// 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())

// VOIDCREW EDIT CHANGE START - BYOND 516.1670+ rejects number keys in list() (tg #93801)
/// 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())

// VOIDCREW EDIT CHANGE END
/// Create a typed global with an initializer expression
#define GLOBAL_DATUM_INIT(X, Typepath, InitValue) GLOBAL_RAW(Typepath/##X); GLOBAL_MANAGED(X, InitValue)

Expand Down
6 changes: 4 additions & 2 deletions code/__DEFINES/atmospherics/atmos_piping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@
#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
// VOIDCREW EDIT CHANGE START - BYOND 516.1670+ rejects number keys in list() (tg #93801)
#define TANK_RESULTS_REACTION "results_reaction"
/// Additional information of the tank.
#define TANK_RESULTS_MISC 2
#define TANK_RESULTS_MISC "results_misc"
// VOIDCREW EDIT CHANGE END

/// Color used by omni-color pipes
#define ATMOS_COLOR_OMNI COLOR_VERY_LIGHT_GRAY
Expand Down
7 changes: 4 additions & 3 deletions code/__DEFINES/food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
FOOD_QUALITY_NORMAL = "okay",
FOOD_QUALITY_NICE = "nice",
FOOD_QUALITY_GOOD = "good",
Expand All @@ -132,7 +132,8 @@ GLOBAL_LIST_INIT(food_quality_description, list(
))

/// Mood events for food quality
GLOBAL_LIST_INIT(food_quality_events, list(
// VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list(); upstream deleted this list before its alist pass
GLOBAL_ALIST_INIT(food_quality_events, alist(
FOOD_QUALITY_NORMAL = /datum/mood_event/food,
FOOD_QUALITY_NICE = /datum/mood_event/food/nice,
FOOD_QUALITY_GOOD = /datum/mood_event/food/good,
Expand All @@ -143,7 +144,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( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
FOOD_COMPLEXITY_1 = list(
/datum/status_effect/food/haste = 1,
),
Expand Down
6 changes: 4 additions & 2 deletions code/__DEFINES/research.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@
//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
// VOIDCREW EDIT CHANGE START - BYOND 516.1670+ rejects number keys in list() (tg #93801)
#define SCIPAPER_COOPERATION_INDEX "cooperation"
#define SCIPAPER_FUNDING_INDEX "funding"
// VOIDCREW EDIT CHANGE END
#define SCIENTIFIC_COOPERATION_PURCHASE_MULTIPLIER 0.01
/// How much money is one point of gain worth.
#define SCIPAPER_GAIN_TO_MONEY 125
Expand Down
71 changes: 32 additions & 39 deletions code/controllers/subsystem/dynamic/_dynamic_ruleset.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* Or
* - A single weight for all tiers.
*/
var/list/weight = 0
var/alist/weight = 0 // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
/**
* The min population for which this ruleset is available.
*
Expand All @@ -40,7 +40,7 @@
* Or
* - A single min population for all tiers.
*/
var/list/min_pop = 0
var/alist/min_pop = 0 // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
/// 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
Expand Down Expand Up @@ -116,47 +116,17 @@
return FALSE
return ..()

/// Used to create tier lists for weights and min_pop values
// VOIDCREW EDIT CHANGE START - BYOND 516.1670+ rejects number keys in list() (tg #93801)
/// 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]

// VOIDCREW EDIT CHANGE END
return tier_list

/**
Expand All @@ -165,6 +135,27 @@
/datum/dynamic_ruleset/proc/can_be_selected()
return TRUE

// VOIDCREW EDIT CHANGE START - BYOND 516.1670+ rejects number keys in list() (tg #93801)
/// 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

// VOIDCREW EDIT CHANGE END
/**
* Calculates the weight of this ruleset for the given tier.
*
Expand All @@ -178,11 +169,13 @@
return 0
if(!can_be_selected())
return 0
var/final_minpop = islist(min_pop) ? min_pop[tier] : min_pop
// VOIDCREW EDIT CHANGE START - BYOND 516.1670+ rejects number keys in list() (tg #93801)
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
// VOIDCREW EDIT CHANGE END
for(var/datum/dynamic_ruleset/other_ruleset as anything in SSdynamic.executed_rulesets)
if(other_ruleset == src)
continue
Expand Down
20 changes: 10 additions & 10 deletions code/controllers/subsystem/dynamic/dynamic_ruleset_midround.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
midround_type = HEAVY_MIDROUND
false_alarm_able = TRUE
ruleset_flags = RULESET_INVADER
weight = list(
weight = alist( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 0,
DYNAMIC_TIER_MEDIUMHIGH = 1,
Expand Down Expand Up @@ -271,7 +271,7 @@
pref_flag = ROLE_WIZARD_MIDROUND
jobban_flag = ROLE_WIZARD
ruleset_flags = RULESET_INVADER|RULESET_HIGH_IMPACT
weight = list(
weight = alist( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 0,
DYNAMIC_TIER_MEDIUMHIGH = 1,
Expand All @@ -294,7 +294,7 @@
pref_flag = ROLE_OPERATIVE_MIDROUND
jobban_flag = ROLE_OPERATIVE
ruleset_flags = RULESET_INVADER|RULESET_HIGH_IMPACT
weight = list(
weight = alist( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 1,
DYNAMIC_TIER_MEDIUMHIGH = 3,
Expand Down Expand Up @@ -378,7 +378,7 @@
false_alarm_able = TRUE
pref_flag = ROLE_BLOB
ruleset_flags = RULESET_INVADER
weight = list(
weight = alist( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 1,
DYNAMIC_TIER_MEDIUMHIGH = 3,
Expand Down Expand Up @@ -415,7 +415,7 @@
false_alarm_able = TRUE
pref_flag = ROLE_ALIEN
ruleset_flags = RULESET_INVADER
weight = list(
weight = alist( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 1,
DYNAMIC_TIER_MEDIUMHIGH = 5,
Expand Down Expand Up @@ -502,7 +502,7 @@
false_alarm_able = TRUE
pref_flag = ROLE_SPACE_DRAGON
ruleset_flags = RULESET_INVADER
weight = list(
weight = alist( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 3,
DYNAMIC_TIER_MEDIUMHIGH = 5,
Expand Down Expand Up @@ -572,7 +572,7 @@
midround_type = HEAVY_MIDROUND
pref_flag = ROLE_NINJA
ruleset_flags = RULESET_INVADER
weight = list(
weight = alist( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 0,
DYNAMIC_TIER_MEDIUMHIGH = 1,
Expand Down Expand Up @@ -1077,7 +1077,7 @@
pref_flag = ROLE_MALF_MIDROUND
jobban_flag = ROLE_MALF
ruleset_flags = RULESET_HIGH_IMPACT
weight = list(
weight = alist( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 1,
DYNAMIC_TIER_MEDIUMHIGH = 3,
Expand Down Expand Up @@ -1105,7 +1105,7 @@
midround_type = HEAVY_MIDROUND
pref_flag = ROLE_BLOB_INFECTION
jobban_flag = ROLE_BLOB
weight = list(
weight = alist( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 1,
DYNAMIC_TIER_MEDIUMHIGH = 3,
Expand All @@ -1129,7 +1129,7 @@
midround_type = LIGHT_MIDROUND
pref_flag = ROLE_OBSESSED
blacklisted_roles = list()
weight = list(
weight = alist( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 5,
DYNAMIC_TIER_LOWMEDIUM = 5,
DYNAMIC_TIER_MEDIUMHIGH = 3,
Expand Down
12 changes: 6 additions & 6 deletions code/controllers/subsystem/dynamic/dynamic_ruleset_roundstart.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
pref_flag = ROLE_MALF
preview_antag_datum = /datum/antagonist/malf_ai
ruleset_flags = RULESET_HIGH_IMPACT
weight = list(
weight = alist( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 1,
DYNAMIC_TIER_MEDIUMHIGH = 3,
Expand Down Expand Up @@ -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( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 0,
DYNAMIC_TIER_MEDIUMHIGH = 1,
Expand Down Expand Up @@ -147,7 +147,7 @@
preview_antag_datum = /datum/antagonist/cult
pref_flag = ROLE_CULTIST
ruleset_flags = RULESET_HIGH_IMPACT
weight = list(
weight = alist( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 1,
DYNAMIC_TIER_MEDIUMHIGH = 3,
Expand Down Expand Up @@ -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( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 1,
DYNAMIC_TIER_MEDIUMHIGH = 3,
Expand Down Expand Up @@ -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( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 1,
DYNAMIC_TIER_MEDIUMHIGH = 3,
Expand Down Expand Up @@ -367,7 +367,7 @@
config_tag = "Roundstart Spies"
preview_antag_datum = /datum/antagonist/spy
pref_flag = ROLE_SPY
weight = list(
weight = alist( // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
DYNAMIC_TIER_LOW = 0,
DYNAMIC_TIER_LOWMEDIUM = 1,
DYNAMIC_TIER_MEDIUMHIGH = 3,
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/processing/station.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()) // VOIDCREW EDIT CHANGE - BYOND 516.1670+ rejects number keys in list() (tg #93801)
///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
Expand Down
44 changes: 24 additions & 20 deletions code/controllers/subsystem/timer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -519,30 +519,34 @@ 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]"
// VOIDCREW EDIT CHANGE START - BYOND 516.1670+ rejects number keys in list() (tg #93801)
/* 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]"
// VOIDCREW EDIT CHANGE END
)
#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]"
// VOIDCREW EDIT CHANGE START - BYOND 516.1670+ rejects number keys in list() (tg #93801)
/* 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]"
// VOIDCREW EDIT CHANGE END
)
#endif

Expand Down
Loading
Loading