From c2ca9102db3c4ce17038952df29b0a0e9e992e3f Mon Sep 17 00:00:00 2001 From: fira Date: Thu, 7 Dec 2023 17:40:12 +0100 Subject: [PATCH] ASRS Supply Pools -- Crates Carryover and MessTech supply (#5018) # About the pull request Code refactor aside this has two main effects: * Adds ASRS supply pools. These are categories of ASRS spawned gear that run in parallel of each other, that is to say not taking away from the military operation pool of crates. Right now they're hardcoded to give only one crate, and send a crate of food ingredients every roughly 30 minutes as proof of concept, to resupply the MessTech. * Adds smooth scaling to amount of crates given by ASRS. The legacy formula is `floor(sqrt(xenos/3))` which is rough as for example once the Xeno count goes below 27 you immediately go from 3 crates awarded to 2. To provide a more consistent and reliable supply flow, it's no longer floored - instead the decimal part carries over. **To make up for this, the divider factor of 3 got increasded to 4, reducing available supply by effectively around 15%.** It is still expected to be an overall supply buff and could be increased. Current supply "curve": ![image](https://github.com/cmss13-devs/cmss13/assets/604624/75a698a3-558c-46ea-b43a-eaa004633560) overall supply curve with changes: ![image](https://github.com/cmss13-devs/cmss13/assets/604624/c1198694-d483-43c4-89be-6d46185ef1e3) And the relative effect of both changes to flooring and factor per Xeno count vs current: ![image](https://github.com/cmss13-devs/cmss13/assets/604624/ab8af08e-488a-4383-adf8-c09c460a9ee5) # Explain why it's good for the game As explained above this aims to fix two main issues. The first is lack of supply for shipside roles, you have to budget them which many Reqs won't do - now they can get some supplies regardless. More can still be ordered as needed. In both cases this is additional player interaction shipside. The second is the amount of ASRS crates being highly variable and dropping off suddenly. Carrying over "partial" crates should give a more consistent supply flow. # Testing Photographs and Procedure ![image](https://github.com/cmss13-devs/cmss13/assets/604624/edc14437-7726-431e-aa32-292a76d38c94) Alternate food pool spawning in in parallel - here with boosted frequency for testing # Changelog :cl: add: Introduced ASRS supply pools. As proof of concept, ASRS now spawns a crate of food ingredients every 30 minutes, in addition to regular gear. balance: ASRS now keeps track of partial crates awarded. This means if you should receive 2.5 then 2.5 crates, you now get 2 then 3, rather than 2 and 2. This is intended to result in smoother, more reliable transitions and scaling with varying amount of Xenos on map. balance: Amount of ASRS crates awarded was reduced by about 15.5% to make up for crates carrying over. Overall this should result in an about 5-10% reduction in highpop crates, and ~10% increase in lowpop. Pop being based on xeno count. code: Refactored part of ASRS supply code to be less of a painful, antique artifact. fix: Fixed incorrect weighting in the ASRS supply code, effects on crate distributions are unknown. fix: Fixed HPR ammo ASRS packs failing to spawn and ending up as MK1s instead. fix: Fixed ASRS order numbers not increasing the order IDs... This whole time.. /:cl: --- code/__DEFINES/supply.dm | 17 ++ code/controllers/subsystem/ticker.dm | 2 +- code/datums/ASRS.dm | 146 ++++++++---------- code/datums/supply_packs/_supply_packs.dm | 1 - code/datums/supply_packs/operations.dm | 6 - code/game/supplyshuttle.dm | 146 +++++++++++------- code/modules/admin/tabs/event_tab.dm | 11 +- code/modules/admin/topic/topic.dm | 12 +- .../techs/marine/tier2/orbital_ammo.dm | 6 +- .../cm_tech/techs/marine/tier4/nuke.dm | 6 +- colonialmarines.dme | 1 + 11 files changed, 186 insertions(+), 168 deletions(-) create mode 100644 code/__DEFINES/supply.dm diff --git a/code/__DEFINES/supply.dm b/code/__DEFINES/supply.dm new file mode 100644 index 000000000000..0369b271207c --- /dev/null +++ b/code/__DEFINES/supply.dm @@ -0,0 +1,17 @@ +//We use the cost to determine the spawn chance this equals out the crates that spawn later in the round. +#define ASRS_HIGHEST_WEIGHT 0 //warning this weight wont change. +#define ASRS_VERY_HIGH_WEIGHT 5 +#define ASRS_HIGH_WEIGHT 15 +#define ASRS_MEDIUM_WEIGHT 25 +#define ASRS_LOW_WEIGHT 35 +#define ASRS_VERY_LOW_WEIGHT 50 +#define ASRS_LOWEST_WEIGHT 100 + +// List of pools of supply packs, rolled individually by the ASRS system +/// Main pool of ASRS supplies, dispensing military supplies such as ammo +#define ASRS_POOL_MAIN "Main" +/// Secondary ASRS pool dispening food related items for MessTech +#define ASRS_POOL_FOOD "Food" + +/// Divider to the amount of xeno forces on the planet to ASRS provided crates. It is used as such sqrt(xenos/ASRS_XENO_CRATES_DIVIDER)) +#define ASRS_XENO_CRATES_DIVIDER 4 diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 0153f03565f6..b7dd6123434a 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -254,7 +254,7 @@ SUBSYSTEM_DEF(ticker) if(GLOB.round_statistics) to_chat_spaced(world, html = FONT_SIZE_BIG(SPAN_ROLE_BODY("Welcome to [GLOB.round_statistics.round_name]"))) - GLOB.supply_controller.process() //Start the supply shuttle regenerating points -- TLE + GLOB.supply_controller.start_processing() for(var/i in GLOB.closet_list) //Set up special equipment for lockers and vendors, depending on gamemode var/obj/structure/closet/C = i diff --git a/code/datums/ASRS.dm b/code/datums/ASRS.dm index 73b0f4e1c6a9..57eff892fa58 100644 --- a/code/datums/ASRS.dm +++ b/code/datums/ASRS.dm @@ -2,138 +2,116 @@ //These are non orderable packs that get in automaticly though the ARSR system. //Note these should never show up to buy and some will only show up later in the round. //BIG NOTE: Don't add living things to crates, that's bad, it will break the shuttle. -//We use the cost to determine the spawn chance this equals out the crates that spawn later in the round. -#define ASRS_HIGHEST_WEIGHT 0 //warning this weight wont change. -#define ASRS_VERY_HIGH_WEIGHT 5 -#define ASRS_HIGH_WEIGHT 15 -#define ASRS_MEDIUM_WEIGHT 25 -#define ASRS_LOW_WEIGHT 35 -#define ASRS_VERY_LOW_WEIGHT 50 -#define ASRS_LOWEST_WEIGHT 100 + + +/datum/supply_packs_asrs + /// How likely we are to select this pack over others + var/cost = ASRS_MEDIUM_WEIGHT + /// Which pool of ASRS automatically dispensed supplies this belongs to + var/pool = ASRS_POOL_MAIN + /// What supply pack would this dispense + var/datum/supply_packs/reference_package //=================================== // Rounds -/datum/supply_packs/ammo_rounds_box_rifle/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_rounds_box_rifle + reference_package = /datum/supply_packs/ammo_rounds_box_rifle cost = ASRS_MEDIUM_WEIGHT -/datum/supply_packs/ammo_rounds_box_rifle_ap/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_rounds_box_rifle_ap + reference_package = /datum/supply_packs/ammo_rounds_box_rifle_ap cost = ASRS_LOW_WEIGHT -/datum/supply_packs/ammo_rounds_box_xm88/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_rounds_box_xm88 + reference_package = /datum/supply_packs/ammo_rounds_box_xm88 cost = ASRS_LOW_WEIGHT //=================================== // Magazines -/datum/supply_packs/gun/ammo_hpr/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/gun/ammo_hpr + reference_package = /datum/supply_packs/ammo_hpr cost = ASRS_LOWEST_WEIGHT -/datum/supply_packs/ammo_m4a3_mag_box/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_m4a3_mag_box + reference_package = /datum/supply_packs/ammo_m4a3_mag_box cost = ASRS_LOW_WEIGHT -/datum/supply_packs/ammo_m4a3_mag_box_ap/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_m4a3_mag_box_ap + reference_package = /datum/supply_packs/ammo_m4a3_mag_box_ap cost = ASRS_VERY_LOW_WEIGHT -/datum/supply_packs/ammo_mag_box/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_mag_box + reference_package = /datum/supply_packs/ammo_mag_box cost = ASRS_VERY_LOW_WEIGHT -/datum/supply_packs/ammo_mag_box_ap/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_mag_box_ap + reference_package = /datum/supply_packs/ammo_mag_box_ap -/datum/supply_packs/ammo_m4ra_mag_box/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_m4ra_mag_box + reference_package = /datum/supply_packs/ammo_m4ra_mag_box cost = ASRS_VERY_LOW_WEIGHT -/datum/supply_packs/ammo_m4ra_mag_box_ap/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_m4ra_mag_box_ap + reference_package = /datum/supply_packs/ammo_m4ra_mag_box_ap -/datum/supply_packs/ammo_shell_box/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_shell_box + reference_package = /datum/supply_packs/ammo_shell_box cost = ASRS_VERY_LOW_WEIGHT -/datum/supply_packs/ammo_shell_box_buck/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_shell_box_buck + reference_package = /datum/supply_packs/ammo_shell_box_buck cost = ASRS_VERY_LOW_WEIGHT -/datum/supply_packs/ammo_shell_box_flechette/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_shell_box_flechette + reference_package = /datum/supply_packs/ammo_shell_box_flechette cost = ASRS_VERY_LOW_WEIGHT -/datum/supply_packs/ammo_smartgun/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_smartgun + reference_package = /datum/supply_packs/ammo_smartgun -/datum/supply_packs/ammo_napalm/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_napalm + reference_package = /datum/supply_packs/ammo_napalm cost = ASRS_VERY_LOW_WEIGHT -/datum/supply_packs/ammo_napalm_gel/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_napalm_gel + reference_package = /datum/supply_packs/ammo_napalm_gel cost = ASRS_VERY_LOW_WEIGHT -/datum/supply_packs/ammo_flamer_mixed/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_flamer_mixed + reference_package = /datum/supply_packs/ammo_flamer_mixed cost = ASRS_VERY_LOW_WEIGHT //=================================== // Mortar ammo -/datum/supply_packs/ammo_mortar_he/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_mortar_he + reference_package = /datum/supply_packs/ammo_mortar_he -/datum/supply_packs/ammo_mortar_incend/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_mortar_incend + reference_package = /datum/supply_packs/ammo_mortar_incend -/datum/supply_packs/ammo_mortar_flare/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/ammo_mortar_flare + reference_package = /datum/supply_packs/ammo_mortar_flare //=================================== // Misc supplies -/datum/supply_packs/flares/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/flares + reference_package = /datum/supply_packs/flares cost = ASRS_LOW_WEIGHT -/datum/supply_packs/mre/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/mre + reference_package = /datum/supply_packs/mre cost = ASRS_VERY_LOW_WEIGHT -/datum/supply_packs/flashlights/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/flashlights + reference_package = /datum/supply_packs/flashlights cost = ASRS_VERY_LOW_WEIGHT -/datum/supply_packs/batteries/asrs - buyable = 0 - group = "ASRS" +/datum/supply_packs_asrs/batteries + reference_package = /datum/supply_packs/batteries cost = ASRS_VERY_LOW_WEIGHT -/datum/supply_packs/ingredient/asrs - buyable = 0 - group = "ASRS" - cost = ASRS_LOW_WEIGHT +// ============================ +// FOOD POOL - for Mess Tech gradual supplies throughout the round +/datum/supply_packs_asrs/ingredient + reference_package = /datum/supply_packs/ingredient + pool = ASRS_POOL_FOOD diff --git a/code/datums/supply_packs/_supply_packs.dm b/code/datums/supply_packs/_supply_packs.dm index 061779d9e5ce..5bcd6937f623 100644 --- a/code/datums/supply_packs/_supply_packs.dm +++ b/code/datums/supply_packs/_supply_packs.dm @@ -20,7 +20,6 @@ var/group = null var/buyable = 1 ///Can this pack be bought? These packs don't show up at all - they have to be spawned externally (fe: DEFCON ASRS) var/randomised_num_contained = 0 //Randomly picks X of items out of the contains list instead of using all. - var/iteration_needed = 0 /// How many W-Y dollars are deducted from the supply controller. Only use for contraband. var/dollar_cost = 0 /// How much "heat" this crate adds, too much heat will send an investigation. Only use for contraband. diff --git a/code/datums/supply_packs/operations.dm b/code/datums/supply_packs/operations.dm index dcc270cb00a1..e5525504716a 100644 --- a/code/datums/supply_packs/operations.dm +++ b/code/datums/supply_packs/operations.dm @@ -24,7 +24,6 @@ containername = "OB Ammo Crate (Incendiary x2)" buyable = 0 group = "Operations" - iteration_needed = null /datum/supply_packs/ob_explosive contains = list( @@ -48,7 +47,6 @@ containername = "OB Ammo Crate (HE x2)" buyable = 0 group = "Operations" - iteration_needed = null /datum/supply_packs/ob_cluster contains = list( @@ -72,7 +70,6 @@ containername = "OB Ammo Crate (Cluster x2)" buyable = 0 group = "Operations" - iteration_needed = null /datum/supply_packs/telecommsparts name = "Replacement Telecommunications Parts" @@ -99,7 +96,6 @@ containertype = /obj/structure/machinery/nuclearbomb buyable = 0 group = "Operations" - iteration_needed = null /datum/supply_packs/technuclearbomb name = "Encrypted Operational Nuke" @@ -107,7 +103,6 @@ containertype = /obj/structure/machinery/nuclearbomb/tech buyable = 0 group = "Operations" - iteration_needed = null /datum/supply_packs/spec_kits name = "Weapons Specialist Kits" @@ -122,4 +117,3 @@ containername = "weapons specialist kits crate" buyable = 0 group = "Operations" - iteration_needed = null diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index 2902d96373c2..b689f7b33df3 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -9,6 +9,8 @@ #define KILL_MENDOZA -1 GLOBAL_LIST_EMPTY_TYPED(asrs_empty_space_tiles_list, /turf/open/floor/almayer/empty) +GLOBAL_SUBTYPE_PATHS_LIST_INDEXED(supply_packs_types, /datum/supply_packs, name) +GLOBAL_REFERENCE_LIST_INDEXED_SORTED(supply_packs_datums, /datum/supply_packs, type) GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) @@ -367,7 +369,7 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) /datum/controller/supply var/processing = 1 - var/processing_interval = 300 + var/processing_interval = 30 SECONDS var/iteration = 0 /// Current supply points var/points = 0 @@ -391,15 +393,18 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) /// If the players killed him by sending a live hostile below.. this goes false and they can't order any more contraband. var/mendoza_status = TRUE - var/base_random_crate_interval = 10 //Every how many processing intervals do we get a random crates. + /// How many processing intervals do we get random crates for each pool. Currently only [ASRS_POOL_MAIN] gets scaled amount of crates. + var/list/base_random_crate_intervals = list(ASRS_POOL_MAIN = 10, ASRS_POOL_FOOD = 60) + /// How many partial crates are stored in ASRS per pool to smooth amount given out + var/list/random_crates_carry = list() + /// Pools mapped to list of random ASRS packs that belong to it + var/list/asrs_supply_packs_by_pool var/crate_iteration = 0 //control var/ordernum var/list/shoppinglist = list() var/list/requestlist = list() - var/list/supply_packs = list() - var/list/random_supply_packs = list() //shuttle movement var/datum/shuttle/ferry/supply/shuttle @@ -438,72 +443,91 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) var/tank_points = 0 /datum/controller/supply/New() + . = ..() ordernum = rand(1,9000) LAZYINITLIST(black_market_sold_items) + asrs_supply_packs_by_pool = list() + for(var/subtype in subtypesof(/datum/supply_packs_asrs)) + var/datum/supply_packs_asrs/initial_datum = subtype + var/pool = initial(initial_datum.pool) + if(!pool) + continue + LAZYADD(asrs_supply_packs_by_pool[pool], new subtype()) + random_crates_carry = list() + for(var/pool in base_random_crate_intervals) + random_crates_carry[pool] = 0 + +/datum/controller/supply/proc/start_processing() + START_PROCESSING(SSslowobj, src) //Supply shuttle ticker - handles supply point regenertion and shuttle travelling between centcomm and the station -/datum/controller/supply/process() - for(var/typepath in subtypesof(/datum/supply_packs)) - var/datum/supply_packs/supply_pack = new typepath() - if(supply_pack.group == "ASRS") - random_supply_packs += supply_pack - else - supply_packs[supply_pack.name] = supply_pack - spawn(0) - set background = 1 - while(1) - if(processing) - iteration++ - points += points_per_process - if(iteration >= 20 && iteration % base_random_crate_interval == 0 && GLOB.supply_controller.shoppinglist.len <= 20) - add_random_crates() - crate_iteration++ - sleep(processing_interval) +/datum/controller/supply/process(delta_time) + iteration++ + points += points_per_process + if(iteration < 20) + return + for(var/pool in base_random_crate_intervals) + var/interval = base_random_crate_intervals[pool] + if(interval && iteration % interval == 0 && shoppinglist.len <= 20) + add_random_crates(pool) + crate_iteration++ //This adds function adds the amount of crates that calculate_crate_amount returns -/datum/controller/supply/proc/add_random_crates() - for(var/I=0, I= 1) + var/additional_crates = round(total_carry) + random_crates_carry[pool] -= additional_crates + unit_crate_amount += additional_crates + + return unit_crate_amount //Here we pick what crate type to send to the marines. //This is a weighted pick based upon their cost. //Their cost will go up if the crate is picked -/datum/controller/supply/proc/add_random_crate() - var/datum/supply_packs/C = GLOB.supply_controller.pick_weighted_crate(random_supply_packs) - if(C == null) +/datum/controller/supply/proc/add_random_crate(pool) + if(!asrs_supply_packs_by_pool[pool]) + return + var/datum/supply_packs_asrs/supply_info = pick_weighted_crate(asrs_supply_packs_by_pool[pool]) + if(!GLOB.supply_packs_datums[supply_info.reference_package]) return - C.cost = round(C.cost * ASRS_COST_MULTIPLIER) //We still do this to raise the weight + + supply_info.cost = round(supply_info.cost * ASRS_COST_MULTIPLIER) //We still do this to raise the weight //We have to create a supply order to make the system spawn it. Here we transform a crate into an order. var/datum/supply_order/supply_order = new /datum/supply_order() - supply_order.ordernum = GLOB.supply_controller.ordernum - supply_order.object = C + supply_order.ordernum = ordernum++ + supply_order.object = GLOB.supply_packs_datums[supply_info.reference_package] supply_order.orderedby = "ASRS" supply_order.approvedby = "ASRS" //We add the order to the shopping list - GLOB.supply_controller.shoppinglist += supply_order + shoppinglist += supply_order //Here we weigh the crate based upon it's cost -/datum/controller/supply/proc/pick_weighted_crate(list/cratelist) - var/weighted_crate_list[] - for(var/datum/supply_packs/crate in cratelist) - var/crate_to_add[0] +/datum/controller/supply/proc/pick_weighted_crate(list/datum/supply_packs_asrs/cratelist) + var/list/datum/supply_packs_asrs/weighted_crate_list = list() + for(var/datum/supply_packs_asrs/crate in cratelist) var/weight = (round(10000/crate.cost)) - if(iteration > crate.iteration_needed) - crate_to_add[crate] = weight - weighted_crate_list += crate_to_add + weighted_crate_list[crate] = weight return pickweight(weighted_crate_list) //To stop things being sent to centcomm which should not be sent to centcomm. Recursively checks for these types. @@ -592,8 +616,8 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) if(order.object.contraband == TRUE && prob(5)) // Mendoza loaded the wrong order in. What a dunce! var/list/contraband_list - for(var/supply_name in GLOB.supply_controller.supply_packs) - var/datum/supply_packs/supply_pack = GLOB.supply_controller.supply_packs[supply_name] + for(var/supply_type in GLOB.supply_packs_datums) + var/datum/supply_packs/supply_pack = GLOB.supply_packs_datums[supply_type] if(supply_pack.contraband == FALSE) continue LAZYADD(contraband_list, supply_pack) @@ -747,10 +771,11 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) temp = "Supply budget: $[GLOB.supply_controller.points * SUPPLY_TO_MONEY_MUPLTIPLIER]
" temp += "Back to all categories


" temp += "Request from: [last_viewed_group]

" - for(var/supply_name in GLOB.supply_controller.supply_packs ) - var/datum/supply_packs/N = GLOB.supply_controller.supply_packs[supply_name] - if(N.contraband || N.group != last_viewed_group || !N.buyable) continue //Have to send the type instead of a reference to - temp += "[supply_name] Cost: $[round(N.cost) * SUPPLY_TO_MONEY_MUPLTIPLIER]
" //the obj because it would get caught by the garbage + for(var/supply_type in GLOB.supply_packs_datums) + var/datum/supply_packs/supply_pack = GLOB.supply_packs_datums[supply_type] + if(supply_pack.contraband || supply_pack.group != last_viewed_group || !supply_pack.buyable) + continue //Have to send the type instead of a reference to + temp += "[supply_pack.name] Cost: $[round(supply_pack.cost) * SUPPLY_TO_MONEY_MUPLTIPLIER]
" //the obj because it would get caught by the garbage else if (href_list["doorder"]) if(world.time < reqtime) @@ -759,8 +784,10 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) return //Find the correct supply_pack datum - var/datum/supply_packs/supply_pack = GLOB.supply_controller.supply_packs[href_list["doorder"]] - if(!istype(supply_pack)) return + var/supply_pack_type = GLOB.supply_packs_types[href_list["doorder"]] + if(!supply_pack_type) + return + var/datum/supply_packs/supply_pack = GLOB.supply_packs_datums[supply_pack_type] if(supply_pack.contraband || !supply_pack.buyable) return @@ -946,11 +973,11 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) temp = "Supply budget: $[GLOB.supply_controller.points * SUPPLY_TO_MONEY_MUPLTIPLIER]
" temp += "Back to all categories


" temp += "Request from: [last_viewed_group]

" - for(var/supply_name in GLOB.supply_controller.supply_packs ) - var/datum/supply_packs/supply_pack = GLOB.supply_controller.supply_packs[supply_name] + for(var/supply_type in GLOB.supply_packs_datums) + var/datum/supply_packs/supply_pack = GLOB.supply_packs_datums[supply_type] if(!is_buyable(supply_pack)) continue - temp += "[supply_name] Cost: $[round(supply_pack.cost) * SUPPLY_TO_MONEY_MUPLTIPLIER]
" //the obj because it would get caught by the garbage + temp += "[supply_pack.name] Cost: $[round(supply_pack.cost) * SUPPLY_TO_MONEY_MUPLTIPLIER]
" //the obj because it would get caught by the garbage else if (href_list["doorder"]) if(world.time < reqtime) @@ -959,7 +986,8 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) return //Find the correct supply_pack datum - var/datum/supply_packs/supply_pack = GLOB.supply_controller.supply_packs[href_list["doorder"]] + var/supply_pack_type = GLOB.supply_packs_types[href_list["doorder"]] + var/datum/supply_packs/supply_pack = GLOB.supply_packs_datums[supply_pack_type] if(!istype(supply_pack)) return @@ -1125,11 +1153,11 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) temp = "W-Y Dollars: $[GLOB.supply_controller.black_market_points]
" temp += "Back to black market categories


" temp += "Purchase from: [last_viewed_group]

" - for(var/supply_name in GLOB.supply_controller.supply_packs ) - var/datum/supply_packs/supply_pack = GLOB.supply_controller.supply_packs[supply_name] + for(var/supply_type in GLOB.supply_packs_datums) + var/datum/supply_packs/supply_pack = GLOB.supply_packs_datums[supply_type] if(!is_buyable(supply_pack)) continue - temp += "[supply_name] Cost: $[round(supply_pack.dollar_cost)]
" + temp += "[supply_pack.name] Cost: $[round(supply_pack.dollar_cost)]
" /obj/structure/machinery/computer/supplycomp/proc/handle_mendoza_dialogue() diff --git a/code/modules/admin/tabs/event_tab.dm b/code/modules/admin/tabs/event_tab.dm index 6ae974d2faea..830717ef91b9 100644 --- a/code/modules/admin/tabs/event_tab.dm +++ b/code/modules/admin/tabs/event_tab.dm @@ -421,18 +421,19 @@ /client/proc/give_nuke() if(!check_rights(R_ADMIN)) return - var/nuketype = "Decrypted Operational Nuke" + var/nukename = "Decrypted Operational Nuke" var/encrypt = tgui_alert(src, "Do you want the nuke to be already decrypted?", "Nuke Type", list("Encrypted", "Decrypted"), 20 SECONDS) if(encrypt == "Encrypted") - nuketype = "Encrypted Operational Nuke" + nukename = "Encrypted Operational Nuke" var/prompt = tgui_alert(src, "THIS CAN BE USED TO END THE ROUND. Are you sure you want to spawn a nuke? The nuke will be put onto the ASRS Lift.", "DEFCON 1", list("No", "Yes"), 30 SECONDS) if(prompt != "Yes") return + var/nuketype = GLOB.supply_packs_types[nukename] + var/datum/supply_order/new_order = new() - new_order.ordernum = GLOB.supply_controller.ordernum - GLOB.supply_controller.ordernum++ - new_order.object = GLOB.supply_controller.supply_packs[nuketype] + new_order.ordernum = GLOB.supply_controller.ordernum++ + new_order.object = GLOB.supply_packs_datums[nuketype] new_order.orderedby = MAIN_AI_SYSTEM new_order.approvedby = MAIN_AI_SYSTEM GLOB.supply_controller.shoppinglist += new_order diff --git a/code/modules/admin/topic/topic.dm b/code/modules/admin/topic/topic.dm index 10ba5b0f1091..fa814ca16b7c 100644 --- a/code/modules/admin/topic/topic.dm +++ b/code/modules/admin/topic/topic.dm @@ -1782,19 +1782,19 @@ var/mob/ref_person = locate(href_list["nukeapprove"]) if(!istype(ref_person)) return FALSE - var/nuketype = "Encrypted Operational Nuke" + var/nukename = "Encrypted Operational Nuke" var/prompt = tgui_alert(usr, "Do you want the nuke to be Encrypted?", "Nuke Type", list("Encrypted", "Decrypted"), 20 SECONDS) if(prompt == "Decrypted") - nuketype = "Decrypted Operational Nuke" - prompt = tgui_alert(usr, "Are you sure you want to authorize \a [nuketype] to the marines? This will greatly affect the round!", "DEFCON 1", list("No", "Yes")) + nukename = "Decrypted Operational Nuke" + prompt = tgui_alert(usr, "Are you sure you want to authorize '[nukename]' to the marines? This will greatly affect the round!", "DEFCON 1", list("No", "Yes")) if(prompt != "Yes") return + var/nuketype = GLOB.supply_packs_types[nukename] //make ASRS order for nuke var/datum/supply_order/new_order = new() - new_order.ordernum = GLOB.supply_controller.ordernum - GLOB.supply_controller.ordernum++ - new_order.object = GLOB.supply_controller.supply_packs[nuketype] + new_order.ordernum = GLOB.supply_controller.ordernum++ + new_order.object = GLOB.supply_packs_datums[nuketype] new_order.orderedby = ref_person new_order.approvedby = "USCM High Command" GLOB.supply_controller.shoppinglist += new_order diff --git a/code/modules/cm_tech/techs/marine/tier2/orbital_ammo.dm b/code/modules/cm_tech/techs/marine/tier2/orbital_ammo.dm index d4f2ce6fc0ef..303ea6121734 100644 --- a/code/modules/cm_tech/techs/marine/tier2/orbital_ammo.dm +++ b/code/modules/cm_tech/techs/marine/tier2/orbital_ammo.dm @@ -17,9 +17,9 @@ return var/datum/supply_order/O = new /datum/supply_order() - O.ordernum = GLOB.supply_controller.ordernum - GLOB.supply_controller.ordernum++ - O.object = GLOB.supply_controller.supply_packs[type_to_give] + O.ordernum = GLOB.supply_controller.ordernum++ + var/actual_type = GLOB.supply_packs_types[type_to_give] + O.object = GLOB.supply_packs_datums[actual_type] O.orderedby = MAIN_AI_SYSTEM GLOB.supply_controller.shoppinglist += O diff --git a/code/modules/cm_tech/techs/marine/tier4/nuke.dm b/code/modules/cm_tech/techs/marine/tier4/nuke.dm index 46ffb4a94193..139fefef570c 100644 --- a/code/modules/cm_tech/techs/marine/tier4/nuke.dm +++ b/code/modules/cm_tech/techs/marine/tier4/nuke.dm @@ -21,9 +21,9 @@ . = ..() var/datum/supply_order/new_order = new() - new_order.ordernum = GLOB.supply_controller.ordernum - GLOB.supply_controller.ordernum++ - new_order.object = GLOB.supply_controller.supply_packs["Encrypted Operational Nuke"] + new_order.ordernum = GLOB.supply_controller.ordernum++ + var/actual_type = GLOB.supply_packs_types["Encrypted Operational Nuke"] + new_order.object = GLOB.supply_packs_datums[actual_type] new_order.orderedby = MAIN_AI_SYSTEM new_order.approvedby = MAIN_AI_SYSTEM diff --git a/colonialmarines.dme b/colonialmarines.dme index a2c032428adf..b296555640b7 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -100,6 +100,7 @@ #include "code\__DEFINES\stats.dm" #include "code\__DEFINES\STUI.dm" #include "code\__DEFINES\subsystems.dm" +#include "code\__DEFINES\supply.dm" #include "code\__DEFINES\surgery.dm" #include "code\__DEFINES\techtree.dm" #include "code\__DEFINES\text.dm"