diff --git a/code/modules/cargo/goodies.dm b/code/modules/cargo/goodies.dm index b4457f56138..ee48e48e403 100644 --- a/code/modules/cargo/goodies.dm +++ b/code/modules/cargo/goodies.dm @@ -78,7 +78,10 @@ desc = "For when the enemy absolutely needs to be replaced with lead. Contains one Aussec-designed Combat Shotgun, and one Shotgun Bandolier." cost = PAYCHECK_COMMAND * 15 access_view = ACCESS_ARMORY - contains = list(/obj/item/gun/ballistic/shotgun/automatic/combat, /obj/item/storage/belt/bandolier) + contains = list( + /obj/item/gun/ballistic/shotgun/automatic/combat, + /obj/item/storage/belt/bandolier + ) /datum/supply_pack/goody/disabler_single name = "Disabler Single-Pack" @@ -214,7 +217,10 @@ name = "Medipen Two-Pak" desc = "Contains one standard epinephrine medipen and one standard emergency medkit medipen. For when you want to prepare for the worst." cost = PAYCHECK_CREW * 2 - contains = list(/obj/item/reagent_containers/hypospray/medipen, /obj/item/reagent_containers/hypospray/medipen/ekit) + contains = list( + /obj/item/reagent_containers/hypospray/medipen, + /obj/item/reagent_containers/hypospray/medipen/ekit + ) /datum/supply_pack/goody/mothic_rations name = "Surplus Mothic Ration Pack" diff --git a/code/modules/cargo/orderconsole.dm b/code/modules/cargo/orderconsole.dm index 409dc197e43..e26c0ba7391 100644 --- a/code/modules/cargo/orderconsole.dm +++ b/code/modules/cargo/orderconsole.dm @@ -206,27 +206,11 @@ "goody" = pack.goody, "access" = pack.access, "contraband" = pack.contraband, - "contains" = get_pack_contains(pack), + "contains" = pack.get_contents_ui_data(), )) return packs -/** - * returns a list of the contents of a supply pack - * * pack - the pack to get the contents of - */ -/obj/machinery/computer/cargo/proc/get_pack_contains(datum/supply_pack/pack) - var/list/contains = list() - for(var/obj/item/item as anything in pack.contains) - contains += list(list( - "name" = item.name, - "icon" = item.greyscale_config ? null : item.icon, - "icon_state" = item.greyscale_config ? null : item.icon_state, - "amount" = pack.contains[item] - )) - - return contains - /** * returns the discount multiplier applied to all supply packs, * the discount is calculated as follows: pack_cost * get_discount() diff --git a/code/modules/cargo/packs/_packs.dm b/code/modules/cargo/packs/_packs.dm index bfa95b2a7ed..94f71245882 100644 --- a/code/modules/cargo/packs/_packs.dm +++ b/code/modules/cargo/packs/_packs.dm @@ -45,6 +45,20 @@ /datum/supply_pack/New() id = type +/// Returns data used for cargo purchasing UI +/datum/supply_pack/proc/get_contents_ui_data() + var/list/data = list() + for(var/obj/item/item as anything in contains) + var/list/item_data = list( + "name" = item.name, + "icon" = item.greyscale_config ? null : item.icon, + "icon_state" = item.greyscale_config ? null : item.icon_state, + "amount" = contains[item] + ) + UNTYPED_LIST_ADD(data, item_data) + + return data + /datum/supply_pack/proc/generate(atom/A, datum/bank_account/paying_account) var/obj/structure/closet/crate/C if(paying_account) diff --git a/code/modules/cargo/packs/organic.dm b/code/modules/cargo/packs/organic.dm index a47c92fabc4..294179bf107 100644 --- a/code/modules/cargo/packs/organic.dm +++ b/code/modules/cargo/packs/organic.dm @@ -10,10 +10,8 @@ desc = "Bee business booming? Better be benevolent and boost botany by \ bestowing bi-Beekeeper-suits! Contains two beekeeper suits and matching headwear." cost = CARGO_CRATE_VALUE * 2 - contains = list(/obj/item/clothing/head/utility/beekeeper_head, - /obj/item/clothing/suit/utility/beekeeper_suit, - /obj/item/clothing/head/utility/beekeeper_head, - /obj/item/clothing/suit/utility/beekeeper_suit, + contains = list(/obj/item/clothing/head/utility/beekeeper_head = 2, + /obj/item/clothing/suit/utility/beekeeper_suit = 2, ) crate_name = "beekeeper suits" crate_type = /obj/structure/closet/crate/hydroponics @@ -363,8 +361,7 @@ desc = "A packaged box containing illegal coffee syrups. Possession of these carries a penalty established in the galactic penal code." cost = CARGO_CRATE_VALUE * 6 contains = list( - /obj/item/reagent_containers/cup/bottle/syrup_bottle/laughsyrup, - /obj/item/reagent_containers/cup/bottle/syrup_bottle/laughsyrup, + /obj/item/reagent_containers/cup/bottle/syrup_bottle/laughsyrup = 2, ) crate_name = "illegal syrups box" crate_type = /obj/structure/closet/crate/cardboard diff --git a/code/modules/modular_computers/file_system/programs/budgetordering.dm b/code/modules/modular_computers/file_system/programs/budgetordering.dm index 511c664c137..b05237436a1 100644 --- a/code/modules/modular_computers/file_system/programs/budgetordering.dm +++ b/code/modules/modular_computers/file_system/programs/budgetordering.dm @@ -94,13 +94,18 @@ ) if((P.hidden && (P.contraband && !contraband) || (P.special && !P.special_enabled) || P.drop_pod_only)) continue + + var/obj/item/first_item = length(P.contains) > 0 ? P.contains[1] : null data["supplies"][P.group]["packs"] += list(list( "name" = P.name, "cost" = P.get_cost(), "id" = pack, "desc" = P.desc || P.name, // If there is a description, use it. Otherwise use the pack's name. + "first_item_icon" = first_item?.icon, + "first_item_icon_state" = first_item?.icon_state, "goody" = P.goody, - "access" = P.access + "access" = P.access, + "contains" = P.get_contents_ui_data(), )) //Data regarding the User's capability to buy things.