diff --git a/code/__DEFINES/station.dm b/code/__DEFINES/station.dm index 63430b52c37..5a04961429f 100644 --- a/code/__DEFINES/station.dm +++ b/code/__DEFINES/station.dm @@ -2,6 +2,13 @@ #define STATION_TRAIT_NEUTRAL 2 #define STATION_TRAIT_NEGATIVE 3 +///Defines for the cost of different station traits. This one is the default. +#define STATION_TRAIT_COST_FULL 1 +///Cost for smaller traits that could fly under the radar, and are only minorly negative/positive if not neutral. +#define STATION_TRAIT_COST_LOW 0.5 +///Cost for very little, and mainly neutral traits that hardly amount to anything really that interesting. +#define STATION_TRAIT_COST_MINIMAL 0.3 + /// Only run on planet stations #define STATION_TRAIT_PLANETARY (1<<0) /// Only run on space stations diff --git a/code/controllers/configuration/entries/game_options.dm b/code/controllers/configuration/entries/game_options.dm index 761659ec60f..f377964700f 100644 --- a/code/controllers/configuration/entries/game_options.dm +++ b/code/controllers/configuration/entries/game_options.dm @@ -430,3 +430,18 @@ /datum/config_entry/flag/give_tutorials_without_db /datum/config_entry/string/new_player_alert_role_id + +/datum/config_entry/keyed_list/positive_station_traits + default = list("0" = 8, "1" = 4, "2" = 2, "3" = 1) + key_mode = KEY_MODE_TEXT + value_mode = VALUE_MODE_NUM + +/datum/config_entry/keyed_list/negative_station_traits + default = list("0" = 8, "1" = 4, "2" = 2, "3" = 1) + key_mode = KEY_MODE_TEXT + value_mode = VALUE_MODE_NUM + +/datum/config_entry/keyed_list/neutral_station_traits + default = list("0" = 10, "1" = 10, "2" = 3, "2.5" = 1) + key_mode = KEY_MODE_TEXT + value_mode = VALUE_MODE_NUM diff --git a/code/controllers/subsystem/processing/station.dm b/code/controllers/subsystem/processing/station.dm index 5c9795b87fd..9d99e19a70b 100644 --- a/code/controllers/subsystem/processing/station.dm +++ b/code/controllers/subsystem/processing/station.dm @@ -73,22 +73,36 @@ PROCESSING_SUBSYSTEM_DEF(station) selectable_traits_by_types[initial(trait_typepath.trait_type)][trait_typepath] = initial(trait_typepath.weight) - var/positive_trait_count = pick(20;0, 5;1, 1;2) - var/neutral_trait_count = pick(10;0, 10;1, 3;2) - var/negative_trait_count = pick(20;0, 5;1, 1;2) + var/positive_trait_budget = text2num(pick_weight(CONFIG_GET(keyed_list/positive_station_traits))) + var/neutral_trait_budget = text2num(pick_weight(CONFIG_GET(keyed_list/neutral_station_traits))) + var/negative_trait_budget = text2num(pick_weight(CONFIG_GET(keyed_list/negative_station_traits))) - pick_traits(STATION_TRAIT_POSITIVE, positive_trait_count) - pick_traits(STATION_TRAIT_NEUTRAL, neutral_trait_count) - pick_traits(STATION_TRAIT_NEGATIVE, negative_trait_count) + pick_traits(STATION_TRAIT_POSITIVE, positive_trait_budget) + pick_traits(STATION_TRAIT_NEUTRAL, neutral_trait_budget) + pick_traits(STATION_TRAIT_NEGATIVE, negative_trait_budget) -///Picks traits of a specific category (e.g. bad or good) and a specified amount, then initializes them, adds them to the list of traits, -///then removes them from possible traits as to not roll twice. -/datum/controller/subsystem/processing/station/proc/pick_traits(trait_sign, amount) - if(!amount) +/** + * Picks traits of a specific category (e.g. bad or good), initializes them, adds them to the list of traits, + * then removes them from possible traits as to not roll twice and subtracts their cost from the budget. + * All until the whole budget is spent or no more traits can be picked with it. + */ +/datum/controller/subsystem/processing/station/proc/pick_traits(trait_sign, budget) + if(!budget) return - for(var/iterator in 1 to amount) - var/datum/station_trait/trait_type = pick_weight(selectable_traits_by_types[trait_sign]) //Rolls from the table for the specific trait type - selectable_traits_by_types[trait_sign] -= trait_type + ///A list of traits of the same trait sign + var/list/selectable_traits = selectable_traits_by_types[trait_sign] + while(budget) + ///Remove any station trait with a cost bigger than the budget + for(var/datum/station_trait/proto_trait as anything in selectable_traits) + if(initial(proto_trait.cost) > budget) + selectable_traits -= proto_trait + ///We have spare budget but no trait that can be bought with what's left of it + if(!length(selectable_traits)) + return + //Rolls from the table for the specific trait type + var/datum/station_trait/trait_type = pick_weight(selectable_traits) + selectable_traits -= trait_type + budget -= initial(trait_type.cost) setup_trait(trait_type) ///Creates a given trait of a specific type, while also removing any blacklisted ones from the future pool. diff --git a/code/datums/station_traits/_station_trait.dm b/code/datums/station_traits/_station_trait.dm index 54a711aaba6..d340a8503d5 100644 --- a/code/datums/station_traits/_station_trait.dm +++ b/code/datums/station_traits/_station_trait.dm @@ -11,6 +11,8 @@ GLOBAL_LIST_EMPTY(lobby_station_traits) var/trait_processes = FALSE ///Chance relative to other traits of its type to be picked var/weight = 10 + ///The cost of the trait, which is removed from the budget. + var/cost = STATION_TRAIT_COST_FULL ///Whether this trait is always enabled; generally used for debugging var/force = FALSE ///Does this trait show in the centcom report? diff --git a/code/datums/station_traits/negative_traits.dm b/code/datums/station_traits/negative_traits.dm index f73bd480f84..6890c4b8275 100644 --- a/code/datums/station_traits/negative_traits.dm +++ b/code/datums/station_traits/negative_traits.dm @@ -123,6 +123,7 @@ name = "Cleaned out maintenance" trait_type = STATION_TRAIT_NEGATIVE weight = 5 + cost = STATION_TRAIT_COST_LOW //Most of maints is literal trash anyway show_in_report = TRUE report_message = "Our workers cleaned out most of the junk in the maintenace areas." blacklist = list(/datum/station_trait/filled_maint) @@ -167,6 +168,7 @@ name = "Bot Language Matrix Malfunction" trait_type = STATION_TRAIT_NEGATIVE weight = 4 + cost = STATION_TRAIT_COST_LOW show_in_report = TRUE report_message = "Your station's friendly bots have had their language matrix fried due to an event, resulting in some strange and unfamiliar speech patterns." trait_to_give = STATION_TRAIT_BOTS_GLITCHED @@ -187,6 +189,7 @@ name = "Revenge of Pun Pun" trait_type = STATION_TRAIT_NEGATIVE weight = 2 + cost = STATION_TRAIT_COST_LOW // Way too much is done on atoms SS to be reverted, and it'd look // kinda clunky on round start. It's not impossible to make this work, @@ -319,6 +322,7 @@ report_message = "The space around your station is clouded by heavy pockets of space dust. Expect an increased likelyhood of space dust storms damaging the station hull." trait_type = STATION_TRAIT_NEGATIVE weight = 2 + cost = STATION_TRAIT_COST_LOW event_control_path = /datum/round_event_control/meteor_wave/dust_storm weight_multiplier = 2 max_occurrences_modifier = 3 diff --git a/code/datums/station_traits/neutral_traits.dm b/code/datums/station_traits/neutral_traits.dm index 5d49155a3c1..ba6cfcac377 100644 --- a/code/datums/station_traits/neutral_traits.dm +++ b/code/datums/station_traits/neutral_traits.dm @@ -1,7 +1,9 @@ +///This station traits gives 5 bananium sheets to the clown (and every dead clown out there in deep space or lavaland). /datum/station_trait/bananium_shipment name = "Bananium Shipment" trait_type = STATION_TRAIT_NEUTRAL weight = 5 + cost = STATION_TRAIT_COST_LOW report_message = "Rumors has it that the clown planet has been sending support packages to clowns in this system." trait_to_give = STATION_TRAIT_BANANIUM_SHIPMENTS @@ -9,6 +11,7 @@ name = "Unnatural atmospherical properties" trait_type = STATION_TRAIT_NEUTRAL weight = 5 + cost = STATION_TRAIT_COST_LOW show_in_report = TRUE report_message = "System's local planet has irregular atmospherical properties." trait_to_give = STATION_TRAIT_UNNATURAL_ATMOSPHERE @@ -42,6 +45,7 @@ trait_type = STATION_TRAIT_NEUTRAL weight = 5 show_in_report = FALSE + cost = STATION_TRAIT_COST_LOW report_message = "Ian has gone exploring somewhere in the station." /datum/station_trait/ian_adventure/on_round_start() @@ -99,8 +103,9 @@ /datum/station_trait/glitched_pdas name = "PDA glitch" trait_type = STATION_TRAIT_NEUTRAL - weight = 15 + weight = 10 show_in_report = TRUE + cost = STATION_TRAIT_COST_MINIMAL report_message = "Something seems to be wrong with the PDAs issued to you all this shift. Nothing too bad though." trait_to_give = STATION_TRAIT_PDA_GLITCHED @@ -133,6 +138,7 @@ trait_type = STATION_TRAIT_NEUTRAL weight = 10 show_in_report = TRUE + cost = STATION_TRAIT_COST_MINIMAL report_message = "Due to a shortage in standard issue jumpsuits, we have provided your assistants with one of our backup supplies." /datum/station_trait/colored_assistants/New() @@ -276,6 +282,7 @@ name = "Scarves" trait_type = STATION_TRAIT_NEUTRAL weight = 10 + cost = STATION_TRAIT_COST_MINIMAL show_in_report = TRUE var/list/scarves @@ -309,6 +316,7 @@ trait_type = STATION_TRAIT_NEUTRAL show_in_report = TRUE weight = 10 + cost = STATION_TRAIT_COST_MINIMAL report_message = "It has become temporarily fashionable to use a wallet, so everyone on the station has been issued one." /datum/station_trait/wallets/New() diff --git a/code/datums/station_traits/positive_traits.dm b/code/datums/station_traits/positive_traits.dm index 4ed552fa393..2c6b1c6524a 100644 --- a/code/datums/station_traits/positive_traits.dm +++ b/code/datums/station_traits/positive_traits.dm @@ -54,6 +54,7 @@ name = "Bountiful bounties" trait_type = STATION_TRAIT_POSITIVE weight = 5 + cost = STATION_TRAIT_COST_LOW show_in_report = TRUE report_message = "It seems collectors in this system are extra keen to on bounties, and will pay more to see their completion." @@ -68,7 +69,6 @@ report_message = "Prices are low in this system, BUY BUY BUY!" blacklist = list(/datum/station_trait/distant_supply_lines) - /datum/station_trait/strong_supply_lines/on_round_start() SSeconomy.pack_price_modifier *= 0.8 @@ -76,6 +76,7 @@ name = "Filled up maintenance" trait_type = STATION_TRAIT_POSITIVE weight = 5 + cost = STATION_TRAIT_COST_LOW show_in_report = TRUE report_message = "Our workers accidentally forgot more of their personal belongings in the maintenace areas." blacklist = list(/datum/station_trait/empty_maint) @@ -176,14 +177,12 @@ report_message = "All members of the station have received an implant to notify each other if one of them dies. This should help improve job-safety!" var/datum/deathrattle_group/deathrattle_group - /datum/station_trait/deathrattle_all/New() . = ..() deathrattle_group = new("station group") blacklist = subtypesof(/datum/station_trait/deathrattle_department) RegisterSignal(SSdcs, COMSIG_GLOB_JOB_AFTER_SPAWN, PROC_REF(on_job_after_spawn)) - /datum/station_trait/deathrattle_all/proc/on_job_after_spawn(datum/source, datum/job/job, mob/living/spawned, client/player_client) SIGNAL_HANDLER @@ -280,6 +279,7 @@ name = "Advanced Medbots" trait_type = STATION_TRAIT_POSITIVE weight = 5 + cost = STATION_TRAIT_COST_LOW show_in_report = TRUE report_message = "Your station's medibots have received a hardware upgrade, enabling expanded healing capabilities." trait_to_give = STATION_TRAIT_MEDBOT_MANIA @@ -316,6 +316,7 @@ report_message = "A repair technician left their wallet in a locker somewhere. They would greatly appreciate if you could locate and return it to them when the shift has ended." trait_type = STATION_TRAIT_POSITIVE weight = 5 + cost = STATION_TRAIT_COST_LOW show_in_report = TRUE /datum/station_trait/missing_wallet/on_round_start() diff --git a/config/game_options.txt b/config/game_options.txt index 24b013b3fee..feb40f9f703 100644 --- a/config/game_options.txt +++ b/config/game_options.txt @@ -563,3 +563,21 @@ DISALLOW_TITLE_MUSIC ## This is primarily useful for developing tutorials. If you have a proper DB setup, you ## don't need (or want) this. #GIVE_TUTORIALS_WITHOUT_DB + +## Configuration for station traits of each type. +## The first value (key) is the budget, or the space available to use for station traits of that type. Some take more space than others. +## The second value (assoc) is the weight associated with said budget compared to the rest for that type. +POSITIVE_STATION_TRAITS 0 8 +POSITIVE_STATION_TRAITS 1 4 +POSITIVE_STATION_TRAITS 2 2 +POSITIVE_STATION_TRAITS 3 1 + +NEUTRAL_STATION_TRAITS 0 10 +NEUTRAL_STATION_TRAITS 1 10 +NEUTRAL_STATION_TRAITS 2 3 +NEUTRAL_STATION_TRAITS 2.5 1 + +NEGATIVE_STATION_TRAITS 0 8 +NEGATIVE_STATION_TRAITS 1 4 +NEGATIVE_STATION_TRAITS 2 2 +NEGATIVE_STATION_TRAITS 3 1 \ No newline at end of file