From cdb6257f0e2dfbd79bce453090f8284e1b5b82f0 Mon Sep 17 00:00:00 2001 From: pgmzeta Date: Sun, 22 Dec 2024 21:24:05 -0800 Subject: [PATCH] Fix trader herbs/plants not giving extractable reagents (#21789) --- code/modules/economy/commodity.dm | 69 ++++++++++++++----- .../economy/requisition/rc_civilian.dm | 2 +- code/modules/economy/shady_robot.dm | 26 +++---- code/modules/economy/trader.dm | 61 ++++++++-------- code/modules/food_and_drink/snacks.dm | 3 + code/obj/item/plants.dm | 5 ++ 6 files changed, 107 insertions(+), 59 deletions(-) diff --git a/code/modules/economy/commodity.dm b/code/modules/economy/commodity.dm index c815781776fb1..d739e0abcc2bd 100644 --- a/code/modules/economy/commodity.dm +++ b/code/modules/economy/commodity.dm @@ -425,83 +425,116 @@ desc = "Illegal drugs." onmarket = 0 -/// these are things that you can sell to the traders +// these have two separate subtypes because herbs need separate spawnable types for reagents -/datum/commodity/drugs/poppies +// traders buy these from players + +/datum/commodity/drugs/buy/poppies comname = "Poppies" comtype = /obj/item/plant/herb/poppy price = PAY_UNTRAINED -/datum/commodity/drugs/shrooms +/datum/commodity/drugs/buy/shrooms comname = "Psilocybin" comtype = /obj/item/reagent_containers/food/snacks/mushroom/psilocybin price = PAY_UNTRAINED -/datum/commodity/drugs/cannabis +/datum/commodity/drugs/buy/cannabis comname = "Cannabis" comtype = /obj/item/plant/herb/cannabis price = PAY_UNTRAINED/2 -/datum/commodity/drugs/cannabis_mega +/datum/commodity/drugs/buy/cannabis_mega comname = "Rainbow Cannabis" comtype = /obj/item/plant/herb/cannabis/mega price = PAY_UNTRAINED -/datum/commodity/drugs/cannabis_white +/datum/commodity/drugs/buy/cannabis_white comname = "White Cannabis" comtype = /obj/item/plant/herb/cannabis/white price = PAY_UNTRAINED -/datum/commodity/drugs/cannabis_omega +/datum/commodity/drugs/buy/cannabis_omega comname = "Omega Cannabis" comtype = /obj/item/plant/herb/cannabis/omega price = PAY_TRADESMAN -///// things you can buy from the traders +// traders sell these to players + + +/datum/commodity/drugs/sell/cannabis_omega + comname = "Omega Cannabis" + comtype = /obj/item/plant/herb/cannabis/omega/spawnable + price = PAY_TRADESMAN + +datum/commodity/drugs/sell/poppies + comname = "Poppies" + comtype = /obj/item/plant/herb/poppy/spawnable + price = PAY_UNTRAINED + +/datum/commodity/drugs/sell/shrooms + comname = "Psilocybin" + comtype = /obj/item/reagent_containers/food/snacks/mushroom/psilocybin/spawnable + price = PAY_UNTRAINED -/datum/commodity/drugs/methamphetamine +/datum/commodity/drugs/sell/cannabis + comname = "Cannabis" + comtype = /obj/item/plant/herb/cannabis/spawnable + price = PAY_UNTRAINED/2 + +/datum/commodity/drugs/sell/cannabis_mega + comname = "Rainbow Cannabis" + comtype = /obj/item/plant/herb/cannabis/mega/spawnable + price = PAY_UNTRAINED + +/datum/commodity/drugs/sell/cannabis_white + comname = "White Cannabis" + comtype = /obj/item/plant/herb/cannabis/white/spawnable + price = PAY_UNTRAINED + +/datum/commodity/drugs/sell/methamphetamine comname = "Methamphetamine (5x pills)" comtype = /obj/item/storage/pill_bottle/methamphetamine desc = "Methamphetamine is a highly effective and dangerous stimulant drug." price = PAY_DOCTORATE*2 -/datum/commodity/drugs/crank +/datum/commodity/drugs/sell/crank comname = "Crank (5x pills)" comtype = /obj/item/storage/pill_bottle/crank desc = "A cheap and dirty stimulant drug, commonly used by space biker gangs." price = PAY_DOCTORATE -/datum/commodity/drugs/bathsalts +/datum/commodity/drugs/sell/bathsalts comname = "Bath Salts (5x pills)" comtype = /obj/item/storage/pill_bottle/bathsalts desc = "Sometimes packaged as a refreshing bathwater additive, these crystals are definitely not for human consumption." price = PAY_EXECUTIVE*2 -/datum/commodity/drugs/catdrugs +/datum/commodity/drugs/sell/catdrugs comname = "Cat Drugs (5x pills)" comtype = /obj/item/storage/pill_bottle/catdrugs desc = "Uhh..." price = PAY_DOCTORATE -/datum/commodity/drugs/morphine +/datum/commodity/drugs/sell/morphine comname = "Morphine (1x syringe)" comtype = /obj/item/reagent_containers/syringe/morphine desc = "A strong but highly addictive opiate painkiller with sedative side effects." price = PAY_DOCTORATE -/datum/commodity/drugs/krokodil +/datum/commodity/drugs/sell/krokodil comname = "Krokodil (1x syringe)" comtype = /obj/item/reagent_containers/syringe/krokodil desc = "A sketchy homemade opiate often used by disgruntled Cosmonauts." price = PAY_UNTRAINED -/datum/commodity/drugs/lsd +/datum/commodity/drugs/sell/lsd comname = "LSD (1x patch)" comtype = /obj/item/reagent_containers/patch/LSD desc = "A highly potent hallucinogenic substance. Far out, maaaan." price = PAY_UNTRAINED -/datum/commodity/drug/lsd_bee +/datum/commodity/drugs/sell/lsd_bee comname = "LSBee (1x patch)" comtype = /obj/item/reagent_containers/patch/lsd_bee desc = "A highly potent hallucinogenic substance. It smells like honey." @@ -513,7 +546,7 @@ desc = "A nugget of weapons grade uranium. Label says it's roughly 'size 5'." price = PAY_IMPORTANT -/datum/commodity/drugs/cyberpunk +/datum/commodity/drugs/sell/cyberpunk comname = "Designer Drugs (5x pills)" comtype = /obj/item/storage/pill_bottle/cyberpunk desc = "Who knows what you might get." @@ -1950,7 +1983,7 @@ /datum/commodity/drugs/poppies/greg comname = "Poppies" desc = "In respect of those lost during the colonization of the frontier, we are now offering poppies." - comtype = /obj/item/plant/herb/poppy + comtype = /obj/item/plant/herb/poppy/spawnable onmarket = 0 price = PAY_UNTRAINED diff --git a/code/modules/economy/requisition/rc_civilian.dm b/code/modules/economy/requisition/rc_civilian.dm index 559e5542ef14a..473c8dfc99bab 100644 --- a/code/modules/economy/requisition/rc_civilian.dm +++ b/code/modules/economy/requisition/rc_civilian.dm @@ -428,7 +428,7 @@ ABSTRACT_TYPE(/datum/rc_entry/reagent/caterdrink) /datum/rc_entry/item/cannabis name = "cannabis" - commodity = /datum/commodity/drugs/cannabis + commodity = /datum/commodity/drugs/buy/cannabis feemod = 420 /datum/rc_entry/reagent/glitter diff --git a/code/modules/economy/shady_robot.dm b/code/modules/economy/shady_robot.dm index 1c3a134df3a16..4e14a64063420 100644 --- a/code/modules/economy/shady_robot.dm +++ b/code/modules/economy/shady_robot.dm @@ -66,22 +66,22 @@ /datum/commodity/contraband/ntso_uniform, /datum/commodity/contraband/ntso_vest, /datum/commodity/contraband/ntso_beret, - /datum/commodity/drugs/methamphetamine, - /datum/commodity/drugs/crank, - /datum/commodity/drugs/catdrugs, - /datum/commodity/drugs/morphine, - /datum/commodity/drugs/krokodil, - /datum/commodity/drugs/lsd, - /datum/commodity/drug/lsd_bee, - /datum/commodity/drugs/shrooms, - /datum/commodity/drugs/cannabis, - /datum/commodity/drugs/cannabis_mega, - /datum/commodity/drugs/cannabis_white, - /datum/commodity/drugs/cannabis_omega, + /datum/commodity/drugs/sell/methamphetamine, + /datum/commodity/drugs/sell/crank, + /datum/commodity/drugs/sell/catdrugs, + /datum/commodity/drugs/sell/morphine, + /datum/commodity/drugs/sell/krokodil, + /datum/commodity/drugs/sell/lsd, + /datum/commodity/drugs/sell/lsd_bee, + /datum/commodity/drugs/sell/shrooms, + /datum/commodity/drugs/sell/cannabis, + /datum/commodity/drugs/sell/cannabis_mega, + /datum/commodity/drugs/sell/cannabis_white, + /datum/commodity/drugs/sell/cannabis_omega, /datum/commodity/produce/special/ghostchili, /datum/commodity/contraband/secheadset, /datum/commodity/medical/strange_reagent, - /datum/commodity/drugs/cyberpunk, + /datum/commodity/drugs/sell/cyberpunk, /datum/commodity/contraband/swatmask, /datum/commodity/contraband/briefcase, /datum/commodity/bodyparts/heart, diff --git a/code/modules/economy/trader.dm b/code/modules/economy/trader.dm index a04647afbd66b..92d9381538764 100644 --- a/code/modules/economy/trader.dm +++ b/code/modules/economy/trader.dm @@ -667,7 +667,12 @@ ABSTRACT_TYPE(/obj/npc/trader/random) picture = "generic.png" angrynope = "Not right now..." whotext = "" + ///What base type do they buy/sell? var/commercetype = null + ///What do they buy (overrides commercetype) + var/buy_commercetype_override = null + ///What do they sell (overrides commercetype) + var/sell_commercetype_override = null var/list/possible_icon_states = list("welder") var/list/descriptions = list("Broken", "ohgodwhy", "1800-coder") @@ -729,8 +734,8 @@ ABSTRACT_TYPE(/obj/npc/trader/random) var/items_for_sale = rand(5,8) var/items_wanted = rand(2,5) - var/list/selltypes = typesof(commercetype) - var/list/buytypes = typesof(commercetype) + var/list/selltypes = typesof(sell_commercetype_override ? sell_commercetype_override : commercetype) + var/list/buytypes = typesof(buy_commercetype_override ? buy_commercetype_override : commercetype) while(length(selltypes) > 0 && length(src.goods_sell) < items_for_sale) var/pickedselltype = pick(selltypes) @@ -774,6 +779,8 @@ ABSTRACT_TYPE(/obj/npc/trader/random) /obj/npc/trader/random/drugs commercetype = /datum/commodity/drugs + buy_commercetype_override = /datum/commodity/drugs/buy + sell_commercetype_override = /datum/commodity/drugs/sell possible_icon_states = list("petbee","possum","bumblespider") descriptions = list("off-brand pharmaceutical", "recreational chemicals") @@ -1085,21 +1092,21 @@ ABSTRACT_TYPE(/obj/npc/trader/robot/robuddy) src.goods_sell += new /datum/commodity/contraband/ntso_beret(src) src.goods_sell += new /datum/commodity/contraband/ntso_vest(src) src.goods_sell += new /datum/commodity/contraband/swatmask/NT(src) - src.goods_sell += new /datum/commodity/drugs/methamphetamine(src) - src.goods_sell += new /datum/commodity/drugs/crank(src) - src.goods_sell += new /datum/commodity/drugs/catdrugs(src) - src.goods_sell += new /datum/commodity/drugs/morphine(src) - src.goods_sell += new /datum/commodity/drugs/krokodil(src) - src.goods_sell += new /datum/commodity/drugs/lsd(src) - src.goods_sell += new /datum/commodity/drug/lsd_bee(src) + src.goods_sell += new /datum/commodity/drugs/sell/methamphetamine(src) + src.goods_sell += new /datum/commodity/drugs/sell/crank(src) + src.goods_sell += new /datum/commodity/drugs/sell/catdrugs(src) + src.goods_sell += new /datum/commodity/drugs/sell/morphine(src) + src.goods_sell += new /datum/commodity/drugs/sell/krokodil(src) + src.goods_sell += new /datum/commodity/drugs/sell/lsd(src) + src.goods_sell += new /datum/commodity/drugs/sell/lsd_bee(src) src.goods_sell += new /datum/commodity/relics/bootlegfirework(src) src.goods_sell += new /datum/commodity/pills/uranium(src) - src.goods_buy += new /datum/commodity/drugs/shrooms(src) - src.goods_buy += new /datum/commodity/drugs/cannabis(src) - src.goods_buy += new /datum/commodity/drugs/cannabis_mega(src) - src.goods_buy += new /datum/commodity/drugs/cannabis_white(src) - src.goods_buy += new /datum/commodity/drugs/cannabis_omega(src) + src.goods_buy += new /datum/commodity/drugs/buy/shrooms(src) + src.goods_buy += new /datum/commodity/drugs/buy/cannabis(src) + src.goods_buy += new /datum/commodity/drugs/buy/cannabis_mega(src) + src.goods_buy += new /datum/commodity/drugs/buy/cannabis_white(src) + src.goods_buy += new /datum/commodity/drugs/buy/cannabis_omega(src) /obj/npc/trader/robot/robuddy/diner name = "B.I.F.F." @@ -1431,13 +1438,13 @@ ABSTRACT_TYPE(/obj/npc/trader/robot/robuddy) //// sell list ////////////////////////////////////////// ///////////////////////////////////////////////////////// src.goods_sell += new /datum/commodity/pills/uranium(src) - src.goods_sell += new /datum/commodity/drugs/methamphetamine(src) - src.goods_sell += new /datum/commodity/drugs/crank(src) - src.goods_sell += new /datum/commodity/drugs/catdrugs(src) - src.goods_sell += new /datum/commodity/drugs/morphine(src) - src.goods_sell += new /datum/commodity/drugs/krokodil(src) - src.goods_sell += new /datum/commodity/drugs/lsd(src) - src.goods_sell += new /datum/commodity/drug/lsd_bee(src) + src.goods_sell += new /datum/commodity/drugs/sell/methamphetamine(src) + src.goods_sell += new /datum/commodity/drugs/sell/crank(src) + src.goods_sell += new /datum/commodity/drugs/sell/catdrugs(src) + src.goods_sell += new /datum/commodity/drugs/sell/morphine(src) + src.goods_sell += new /datum/commodity/drugs/sell/krokodil(src) + src.goods_sell += new /datum/commodity/drugs/sell/lsd(src) + src.goods_sell += new /datum/commodity/drugs/sell/lsd_bee(src) src.goods_sell += new /datum/commodity/medical/ether(src) src.goods_sell += new /datum/commodity/medical/toxin(src) src.goods_sell += new /datum/commodity/medical/cyanide(src) @@ -1447,12 +1454,12 @@ ABSTRACT_TYPE(/obj/npc/trader/robot/robuddy) ///////////////////////////////////////////////////////// //// buy list /////////////////////////////////////////// ///////////////////////////////////////////////////////// - src.goods_buy += new /datum/commodity/drugs/poppies(src) - src.goods_buy += new /datum/commodity/drugs/shrooms(src) - src.goods_buy += new /datum/commodity/drugs/cannabis(src) - src.goods_buy += new /datum/commodity/drugs/cannabis_mega(src) - src.goods_buy += new /datum/commodity/drugs/cannabis_white(src) - src.goods_buy += new /datum/commodity/drugs/cannabis_omega(src) + src.goods_buy += new /datum/commodity/drugs/buy/poppies(src) + src.goods_buy += new /datum/commodity/drugs/buy/shrooms(src) + src.goods_buy += new /datum/commodity/drugs/buy/cannabis(src) + src.goods_buy += new /datum/commodity/drugs/buy/cannabis_mega(src) + src.goods_buy += new /datum/commodity/drugs/buy/cannabis_white(src) + src.goods_buy += new /datum/commodity/drugs/buy/cannabis_omega(src) ///////////////////////////////////////////////////////// greeting= {"A hand sticking out from a toilet waves in your direction."} diff --git a/code/modules/food_and_drink/snacks.dm b/code/modules/food_and_drink/snacks.dm index 4e54c39b0629c..4044c3b0a7764 100644 --- a/code/modules/food_and_drink/snacks.dm +++ b/code/modules/food_and_drink/snacks.dm @@ -1394,6 +1394,9 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food/snacks/soup) food_color = "#A76933" heal_amt = 1 +/obj/item/reagent_containers/food/snacks/mushroom/psilocybin/spawnable + initial_reagents = list("psilocybin" = 40) + /obj/item/reagent_containers/food/snacks/mushroom/cloak name = "space mushroom" desc = "A mushroom cap of Space Fungus. It doesn't smell of anything." diff --git a/code/obj/item/plants.dm b/code/obj/item/plants.dm index f7a4fa904861b..103550c595b58 100644 --- a/code/obj/item/plants.dm +++ b/code/obj/item/plants.dm @@ -402,6 +402,11 @@ ABSTRACT_TYPE(/obj/item/plant/herb) desc = "A distinctive red flower." icon_state = "poppy" +/obj/item/plant/herb/poppy/spawnable + make_reagents() + src.create_reagents(85) + reagents.add_reagent("morphine", 40) + /obj/item/plant/herb/tea name = "tea leaves" crop_suffix = " leaves"