All-In-One grinder results are now defined by type, not by huge lists

This commit is contained in:
Ashe Higgs
2017-12-14 16:48:25 -05:00
committed by CitadelStationBot
parent a22b225015
commit 2aef00daf0
48 changed files with 356 additions and 235 deletions
@@ -393,6 +393,7 @@
container_type = NONE
spillable = FALSE
isGlass = FALSE
grind_results = list("aluminum" = 10)
/obj/item/reagent_containers/food/drinks/soda_cans/attack(mob/M, mob/user)
if(M == user && !src.reagents.total_volume && user.a_intent == INTENT_HARM && user.zone_selected == "head")
@@ -6,6 +6,7 @@
lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi'
unique_rename = 1
grind_results = list() //To let them be ground up to transfer their reagents
var/bitesize = 2
var/bitecount = 0
var/trash = null
@@ -20,6 +20,7 @@
filling_color = "#F0E68C"
tastes = list("egg" = 1)
foodtype = MEAT
grind_results = list("eggyolk" = 5)
/obj/item/reagent_containers/food/snacks/egg/throw_impact(atom/hit_atom)
if(!..()) //was it caught by a mob?
@@ -28,6 +28,7 @@
filling_color = "#FF1493"
tastes = list("watermelon" = 1)
foodtype = FRUIT
juice_results = list("watermelonjuice" = 5)
/obj/item/reagent_containers/food/snacks/candy_corn
name = "candy corn"
@@ -10,6 +10,7 @@
volume = 10
amount_per_transfer_from_this = 0
list_reagents = list("honey" = 5)
grind_results = list()
var/honey_color = ""
/obj/item/reagent_containers/honeycomb/New()
+23
View File
@@ -15,6 +15,7 @@
// Saves us from having to define each stupid grown's dried_type as itself.
// If you don't want a plant to be driable (watermelons) set this to null in the time definition.
resistance_flags = FLAMMABLE
var/dry_grind = FALSE //If TRUE, this object needs to be dry to be ground up
/obj/item/reagent_containers/food/snacks/grown/Initialize(mapload, obj/item/seeds/new_seed)
. = ..()
@@ -137,6 +138,28 @@
return
return ..()
/obj/item/reagent_containers/food/snacks/grown/grind_requirements()
if(dry_grind && !dry)
to_chat(usr, "<span class='warning'>[src] needs to be dry before it can be ground up!</span>")
return
return TRUE
/obj/item/reagent_containers/food/snacks/grown/on_grind()
var/nutriment = reagents.get_reagent_amount("nutriment")
if(grind_results.len)
for(var/i in 1 to grind_results.len)
grind_results[grind_results[i]] = nutriment
reagents.del_reagent("nutriment")
reagents.del_reagent("vitamin")
/obj/item/reagent_containers/food/snacks/grown/on_juice()
var/nutriment = reagents.get_reagent_amount("nutriment")
if(juice_results.len)
for(var/i in 1 to juice_results.len)
juice_results[juice_results[i]] = nutriment
reagents.del_reagent("nutriment")
reagents.del_reagent("vitamin")
// For item-containing growns such as eggy or gatfruit
/obj/item/reagent_containers/food/snacks/grown/shell/attack_self(mob/user)
var/obj/item/T
+1
View File
@@ -15,6 +15,7 @@
genes = list(/datum/plant_gene/trait/repeated_harvest)
mutatelist = list(/obj/item/seeds/apple/gold)
reagents_add = list("vitamin" = 0.04, "nutriment" = 0.1)
juice_results = list("applejuice" = 0)
/obj/item/reagent_containers/food/snacks/grown/apple
seed = /obj/item/seeds/apple
+1
View File
@@ -13,6 +13,7 @@
genes = list(/datum/plant_gene/trait/slip, /datum/plant_gene/trait/repeated_harvest)
mutatelist = list(/obj/item/seeds/banana/mime, /obj/item/seeds/banana/bluespace)
reagents_add = list("banana" = 0.1, "potassium" = 0.1, "vitamin" = 0.04, "nutriment" = 0.02)
juice_results = list("banana" = 0)
/obj/item/reagent_containers/food/snacks/grown/banana
seed = /obj/item/seeds/banana
+1
View File
@@ -26,6 +26,7 @@
filling_color = "#F0E68C"
bitesize_mod = 2
foodtype = VEGETABLES
grind_results = list("soymilk" = 0)
// Koibean
/obj/item/seeds/soya/koi
@@ -26,6 +26,7 @@
filling_color = "#FF00FF"
bitesize_mod = 2
foodtype = FRUIT
juice_results = list("berryjuice" = 0)
// Poison Berries
/obj/item/seeds/berry/poison
@@ -46,6 +47,7 @@
icon_state = "poisonberrypile"
filling_color = "#C71585"
foodtype = FRUIT | TOXIC
juice_results = list("poisonberryjuice" = 0)
// Death Berries
/obj/item/seeds/berry/death
@@ -121,6 +123,7 @@
filling_color = "#FF0000"
bitesize_mod = 2
foodtype = FRUIT
grind_results = list("cherryjelly" = 0)
// Blue Cherries
/obj/item/seeds/cherry/blue
@@ -142,6 +145,7 @@
filling_color = "#6495ED"
bitesize_mod = 2
foodtype = FRUIT
grind_results = list("bluecherryjelly" = 0)
// Grapes
/obj/item/seeds/grape
@@ -173,6 +177,7 @@
filling_color = "#FF1493"
bitesize_mod = 2
foodtype = FRUIT
juice_results = list("grapejuice" = 0)
// Green Grapes
/obj/item/seeds/grape/green
@@ -22,6 +22,7 @@
filling_color = "#F0E68C"
bitesize_mod = 2
foodtype = GRAIN
grind_results = list("flour" = 0)
// Oat
/obj/item/seeds/wheat/oat
@@ -42,6 +43,7 @@
filling_color = "#556B2F"
bitesize_mod = 2
foodtype = GRAIN
grind_results = list("flour" = 0)
// Rice
/obj/item/seeds/wheat/rice
@@ -63,6 +65,7 @@
filling_color = "#FAFAD2"
bitesize_mod = 2
foodtype = GRAIN
grind_results = list("rice" = 0)
//Meatwheat - grows into synthetic meat
/obj/item/seeds/wheat/meat
@@ -83,6 +86,7 @@
bitesize_mod = 2
seed = /obj/item/seeds/wheat/meat
foodtype = MEAT | GRAIN
grind_results = list("flour" = 0, "blood" = 0)
/obj/item/reagent_containers/food/snacks/grown/meatwheat/attack_self(mob/living/user)
user.visible_message("<span class='notice'>[user] crushes [src] into meat.</span>", "<span class='notice'>You crush [src] into something that resembles meat.</span>")
+3
View File
@@ -30,6 +30,7 @@
desc = "It's so sour, your face will twist."
icon_state = "lime"
filling_color = "#00FF00"
juice_results = list("limejuice" = 0)
// Orange
/obj/item/seeds/orange
@@ -56,6 +57,7 @@
desc = "It's a tangy fruit."
icon_state = "orange"
filling_color = "#FFA500"
juice_results = list("orangejuice" = 0)
// Lemon
/obj/item/seeds/lemon
@@ -81,6 +83,7 @@
desc = "When life gives you lemons, make lemonade."
icon_state = "lemon"
filling_color = "#FFD700"
juice_results = list("lemonjuice" = 0)
// Combustible lemon
/obj/item/seeds/firelemon //combustible lemon is too long so firelemon
+1
View File
@@ -25,6 +25,7 @@
trash = /obj/item/grown/corncob
bitesize_mod = 2
foodtype = VEGETABLES
juice_results = list("corn_starch" = 0)
/obj/item/grown/corncob
name = "corn cob"
@@ -182,6 +182,7 @@
throw_speed = 1
throw_range = 3
attack_verb = list("roasted", "scorched", "burned")
grind_results = list("capsaicin" = 0, "condensedcapsaicin" = 0)
/obj/item/grown/novaflower/add_juice()
..()
+1
View File
@@ -33,6 +33,7 @@
filling_color = "#008000"
bitesize_mod = 3
foodtype = FRUIT
juice_results = list("watermelonjuice" = 0)
// Holymelon
/obj/item/seeds/watermelon/holy
+2
View File
@@ -43,6 +43,7 @@
throw_speed = 1
throw_range = 3
attack_verb = list("stung")
grind_results = list("sacid" = 0)
/obj/item/grown/nettle/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is eating some of [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
@@ -91,6 +92,7 @@
icon_state = "deathnettle"
force = 30
throwforce = 15
grind_results = list("facid" = 1, "sacid" = 1)
/obj/item/grown/nettle/death/add_juice()
..()
+1
View File
@@ -17,6 +17,7 @@
genes = list(/datum/plant_gene/trait/battery)
mutatelist = list(/obj/item/seeds/potato/sweet)
reagents_add = list("vitamin" = 0.04, "nutriment" = 0.1)
juice_results = list("potato" = 0)
/obj/item/reagent_containers/food/snacks/grown/potato
seed = /obj/item/seeds/potato
+3 -1
View File
@@ -24,6 +24,7 @@
filling_color = "#FFA500"
bitesize_mod = 2
foodtype = VEGETABLES
juice_results = list("pumpkinjuice" = 0)
/obj/item/reagent_containers/food/snacks/grown/pumpkin/attackby(obj/item/W as obj, mob/user as mob, params)
if(W.is_sharp())
@@ -53,4 +54,5 @@
icon_state = "blumpkin"
filling_color = "#87CEFA"
bitesize_mod = 2
foodtype = VEGETABLES
foodtype = VEGETABLES
juice_results = list("blumpkinjuice" = 0)
+1
View File
@@ -22,6 +22,7 @@
filling_color = "#FFA500"
bitesize_mod = 2
foodtype = VEGETABLES
juice_results = list("carrotjuice" = 0)
/obj/item/reagent_containers/food/snacks/grown/carrot/attackby(obj/item/I, mob/user, params)
if(I.is_sharp())
+7 -2
View File
@@ -14,7 +14,6 @@
icon_dead = "tea-dead"
genes = list(/datum/plant_gene/trait/repeated_harvest)
mutatelist = list(/obj/item/seeds/tea/astra)
reagents_add = list("vitamin" = 0.04, "teapowder" = 0.1)
/obj/item/reagent_containers/food/snacks/grown/tea
seed = /obj/item/seeds/tea
@@ -22,6 +21,8 @@
desc = "These aromatic tips of the tea plant can be dried to make tea."
icon_state = "tea_aspera_leaves"
filling_color = "#008000"
grind_results = list("teapowder" = 0)
dry_grind = TRUE
// Tea Astra
/obj/item/seeds/tea/astra
@@ -39,6 +40,7 @@
name = "Tea Astra tips"
icon_state = "tea_astra_leaves"
filling_color = "#4582B4"
grind_results = list("teapowder" = 0, "salglu_solution" = 0)
// Coffee
@@ -67,6 +69,8 @@
icon_state = "coffee_arabica"
filling_color = "#DC143C"
bitesize_mod = 2
dry_grind = TRUE
grind_results = list("coffeepowder" = 0)
// Coffee Robusta
/obj/item/seeds/coffee/robusta
@@ -84,4 +88,5 @@
seed = /obj/item/seeds/coffee/robusta
name = "coffee robusta beans"
desc = "Increases robustness by 37 percent!"
icon_state = "coffee_robusta"
icon_state = "coffee_robusta"
grind_results = list("coffeepowder" = 0, "morphine" = 0)
+3
View File
@@ -23,6 +23,8 @@
filling_color = "#FF6347"
bitesize_mod = 2
foodtype = VEGETABLES
grind_results = list("ketchup" = 0)
juice_results = list("tomatojuice" = 0)
// Blood Tomato
/obj/item/seeds/tomato/blood
@@ -44,6 +46,7 @@
splat_type = /obj/effect/gibspawner/generic
filling_color = "#FF0000"
foodtype = VEGETABLES | GROSS
grind_results = list("ketchup" = 0, "blood" = 0)
// Blue Tomato
@@ -62,3 +62,7 @@
/obj/item/grown/microwave_act(obj/machine/microwave/M)
return
/obj/item/grown/on_grind()
for(var/i in 1 to grind_results.len)
grind_results[grind_results[i]] = round(seed.potency)
@@ -110,3 +110,7 @@
eatverb = "devours"
list_reagents = list("nutriment" = 3, "vitamin" = 2)
foodtype = GROSS | MEAT | RAW
grind_results = list("blood" = 20, "liquidgibs" = 5)
/obj/item/reagent_containers/food/snacks/deadmouse/on_grind()
reagents.clear_reagents()
+6
View File
@@ -23,6 +23,7 @@
throw_range = 7
materials = list(MAT_METAL=10)
pressure_resistance = 2
grind_results = list("iron" = 2, "iodine" = 1)
var/colour = "black" //what colour the ink is!
var/traitor_unlock_degrees = 0
var/degrees = 0
@@ -174,7 +175,12 @@
reagents.trans_to(M, reagents.total_volume)
<<<<<<< HEAD
/obj/item/pen/sleepy/New()
=======
/obj/item/pen/sleepy/Initialize()
. = ..()
>>>>>>> d447acd... All-In-One grinder results are now defined by type, not by huge lists (#33181)
create_reagents(45)
reagents.add_reagent("chloralhydrate2", 20)
reagents.add_reagent("mutetoxin", 15)
+1
View File
@@ -391,5 +391,6 @@
/obj/item/device/toner
name = "toner cartridge"
icon_state = "tonercartridge"
grind_results = list("iodine" = 40, "iron" = 10)
var/charges = 5
var/max_charges = 5
+1
View File
@@ -33,6 +33,7 @@
w_class = WEIGHT_CLASS_TINY
resistance_flags = FLAMMABLE
max_integrity = 50
grind_results = list("iodine" = 4)
var/icon/img //Big photo image
var/scribble //Scribble on the back.
var/blueprints = 0 //Does it include the blueprints?
+1
View File
@@ -472,6 +472,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list (new/datum/stack_recipe("cable restrai
attack_verb = list("whipped", "lashed", "disciplined", "flogged")
singular_name = "cable piece"
full_w_class = WEIGHT_CLASS_SMALL
grind_results = list("copper" = 2) //2 copper per cable in the coil
/obj/item/stack/cable_coil/cyborg
is_cyborg = 1
+2
View File
@@ -14,6 +14,7 @@
var/charge = 0 // note %age conveted to actual charge in New
var/maxcharge = 1000
materials = list(MAT_METAL=700, MAT_GLASS=50)
grind_results = list("lithium" = 15, "iron" = 5, "silicon" = 5)
var/rigged = 0 // true if rigged to explode
var/chargerate = 100 //how much power is given every tick in a recharger
var/self_recharge = 0 //does it self recharge, over time, or not?
@@ -107,6 +108,7 @@
to_chat(user, "<span class='notice'>You inject the solution into the power cell.</span>")
if(S.reagents.has_reagent("plasma", 5))
rigged = 1
grind_results["plasma"] = 5
S.reagents.clear_reagents()
+1
View File
@@ -680,6 +680,7 @@
var/base_state
var/switchcount = 0 // number of times switched
materials = list(MAT_GLASS=100)
grind_results = list("silicon" = 5, "nitrogen" = 10) //Nitrogen is used as a cheaper alternative to argon in incandescent lighbulbs
var/rigged = 0 // true if rigged to explode
var/brightness = 2 //how much light it gives off
@@ -2,7 +2,7 @@
#define MILK_TO_BUTTER_COEFF 15
/obj/machinery/reagentgrinder
name = "All-In-One Grinder"
name = "\improper All-In-One Grinder"
desc = "From BlenderTech. Will It Blend? Let's test it out!"
icon = 'icons/obj/kitchen.dmi'
icon_state = "juicer1"
@@ -16,97 +16,6 @@
var/operating = FALSE
var/obj/item/reagent_containers/beaker = null
var/limit = 10
var/static/list/blend_items = list(
//Sheets
/obj/item/stack/sheet/mineral/plasma = list("plasma" = 20),
/obj/item/stack/sheet/metal = list("iron" = 20),
/obj/item/stack/sheet/plasteel = list("iron" = 20, "plasma" = 20),
/obj/item/stack/sheet/mineral/wood = list("carbon" = 20),
/obj/item/stack/sheet/glass = list("silicon" = 20),
/obj/item/stack/sheet/rglass = list("silicon" = 20, "iron" = 20),
/obj/item/stack/sheet/mineral/uranium = list("uranium" = 20),
/obj/item/stack/sheet/mineral/bananium = list("banana" = 20),
/obj/item/stack/sheet/mineral/silver = list("silver" = 20),
/obj/item/stack/sheet/mineral/gold = list("gold" = 20),
/obj/item/stack/sheet/bluespace_crystal = list("bluespace" = 20),
/obj/item/stack/cable_coil = list ("copper" = 5),
/obj/item/ore/bluespace_crystal = list("bluespace" = 20),
/obj/item/grown/nettle/basic = list("sacid" = 0),
/obj/item/grown/nettle/death = list("facid" = 0, "sacid" = 0),
/obj/item/grown/novaflower = list("capsaicin" = 0, "condensedcapsaicin" = 0),
//Blender Stuff
/obj/item/reagent_containers/food/snacks/donkpocket/warm = list("omnizine" = 3),
/obj/item/reagent_containers/food/snacks/grown/soybeans = list("soymilk" = 0),
/obj/item/reagent_containers/food/snacks/grown/tomato = list("ketchup" = 0),
/obj/item/reagent_containers/food/snacks/grown/wheat = list("flour" = -5),
/obj/item/reagent_containers/food/snacks/grown/oat = list("flour" = -5),
/obj/item/reagent_containers/food/snacks/grown/rice = list("rice" = -5),
/obj/item/reagent_containers/food/snacks/donut = list("sprinkles" = -2, "sugar" = 1),
/obj/item/reagent_containers/food/snacks/grown/cherries = list("cherryjelly" = 0),
/obj/item/reagent_containers/food/snacks/grown/bluecherries = list("bluecherryjelly" = 0),
/obj/item/reagent_containers/food/snacks/egg = list("eggyolk" = -5),
/obj/item/reagent_containers/food/snacks/deadmouse = list ("blood" = 20, "gibs" = 5), // You monster
//Grinder stuff, but only if dry
/obj/item/reagent_containers/food/snacks/grown/coffee/robusta = list("coffeepowder" = 0, "morphine" = 0),
/obj/item/reagent_containers/food/snacks/grown/coffee = list("coffeepowder" = 0),
/obj/item/reagent_containers/food/snacks/grown/tea/astra = list("teapowder" = 0, "salglu_solution" = 0),
/obj/item/reagent_containers/food/snacks/grown/tea = list("teapowder" = 0),
//Stuff that doesn't quite fit in the other categories
/obj/item/electronics = list ("iron" = 10, "silicon" = 10),
/obj/item/circuitboard = list ("silicon" = 20, "sacid" = 0.5), // Retrieving acid this way is extremely inefficient
/obj/item/match = list ("phosphorus" = 2),
/obj/item/device/toner = list ("iodine" = 40, "iron" = 10),
/obj/item/photo = list ("iodine" = 4),
/obj/item/pen = list ("iodine" = 2, "iron" = 1),
/obj/item/reagent_containers/food/drinks/soda_cans = list ("aluminium" = 10),
/obj/item/trash/can = list ("aluminium" = 10),
/obj/item/device/flashlight/flare = list ("sulfur" = 15),
/obj/item/device/flashlight/glowstick = list ("phenol" = 15, "hydrodgen" = 10, "oxygen" = 5),
/obj/item/stock_parts/cell = list ("lithium" = 15, "iron" = 5, "silicon" = 5),
/obj/item/soap = list ("lye" = 10),
/obj/item/device/analyzer = list ("mercury" = 5, "iron" = 5, "silicon" = 5),
/obj/item/lighter = list ("iron" = 1, "weldingfuel" = 5, "oil" = 5),
/obj/item/light = list ("silicon" = 5, "nitrogen" = 10), //Nitrogen is used as a cheaper alternative to argon in incandescent lighbulbs
/obj/item/cigbutt/ = list ("carbon" = 2),
/obj/item/trash/coal = list ("carbon" = 20),
/obj/item/stack/medical/bruise_pack = list ("styptic_powder" = 5),
/obj/item/stack/medical/ointment = list ("silver_sulfadiazine" = 5),
//All types that you can put into the grinder to transfer the reagents to the beaker. !Put all recipes above this.!
/obj/item/slime_extract = list(),
/obj/item/reagent_containers/pill = list(),
/obj/item/reagent_containers/food = list(),
/obj/item/reagent_containers/honeycomb = list(),
/obj/item/toy/crayon = list(),
/obj/item/clothing/mask/cigarette = list())
var/static/list/juice_items = list(
//Juicer Stuff
/obj/item/reagent_containers/food/snacks/grown/corn = list("corn_starch" = 0),
/obj/item/reagent_containers/food/snacks/grown/tomato = list("tomatojuice" = 0),
/obj/item/reagent_containers/food/snacks/grown/carrot = list("carrotjuice" = 0),
/obj/item/reagent_containers/food/snacks/grown/berries = list("berryjuice" = 0),
/obj/item/reagent_containers/food/snacks/grown/banana = list("banana" = 0),
/obj/item/reagent_containers/food/snacks/grown/potato = list("potato" = 0),
/obj/item/reagent_containers/food/snacks/grown/citrus/lemon = list("lemonjuice" = 0),
/obj/item/reagent_containers/food/snacks/grown/citrus/orange = list("orangejuice" = 0),
/obj/item/reagent_containers/food/snacks/grown/citrus/lime = list("limejuice" = 0),
/obj/item/reagent_containers/food/snacks/grown/watermelon = list("watermelonjuice" = 0),
/obj/item/reagent_containers/food/snacks/watermelonslice = list("watermelonjuice" = 0),
/obj/item/reagent_containers/food/snacks/grown/berries/poison = list("poisonberryjuice" = 0),
/obj/item/reagent_containers/food/snacks/grown/pumpkin = list("pumpkinjuice" = 0),
/obj/item/reagent_containers/food/snacks/grown/blumpkin = list("blumpkinjuice" = 0),
/obj/item/reagent_containers/food/snacks/grown/apple = list("applejuice" = 0),
/obj/item/reagent_containers/food/snacks/grown/grapes = list("grapejuice" = 0),
/obj/item/reagent_containers/food/snacks/grown/grapes/green = list("grapejuice" = 0))
var/static/list/dried_items = list(
//Grinder stuff, but only if dry,
/obj/item/reagent_containers/food/snacks/grown/coffee/robusta = list("coffeepowder" = 0, "morphine" = 0),
/obj/item/reagent_containers/food/snacks/grown/coffee = list("coffeepowder" = 0),
/obj/item/reagent_containers/food/snacks/grown/tea/astra = list("teapowder" = 0, "salglu_solution" = 0),
/obj/item/reagent_containers/food/snacks/grown/tea = list("teapowder" = 0))
var/list/holdingitems
/obj/machinery/reagentgrinder/Initialize()
@@ -158,6 +67,7 @@
if(!user.transferItemToLoc(I, src))
to_chat(user, "<span class='warning'>[I] is stuck to your hand!</span>")
return TRUE
to_chat(user, "<span class='notice'>You slide [I] into [src].</span>")
beaker = I
update_icon()
updateUsrDialog()
@@ -165,15 +75,8 @@
to_chat(user, "<span class='warning'>There's already a container inside [src].</span>")
return TRUE //no afterattack
if(is_type_in_list(I, dried_items))
if(istype(I, /obj/item/reagent_containers/food/snacks/grown))
var/obj/item/reagent_containers/food/snacks/grown/G = I
if(!G.dry)
to_chat(user, "<span class='warning'>You must dry [G] first!</span>")
return TRUE
if(length(holdingitems) >= limit)
to_chat(user, "The machine cannot hold anymore items.")
if(holdingitems.len >= limit)
to_chat(user, "<span class='warning'>[src] is filled to capacity!</span>")
return TRUE
//Fill machine with a bag!
@@ -192,14 +95,18 @@
updateUsrDialog()
return TRUE
if (!is_type_in_list(I, blend_items) && !is_type_in_list(I, juice_items))
if(!I.grind_results && !I.juice_results)
if(user.a_intent == INTENT_HARM)
return ..()
else
to_chat(user, "<span class='warning'>Cannot refine into a reagent!</span>")
to_chat(user, "<span class='warning'>You cannot grind [I] into reagents!</span>")
return TRUE
if(!I.grind_requirements(src)) //Error messages should be in the objects' definitions
return
if(user.transferItemToLoc(I, src))
to_chat(user, "<span class='notice'>You add [I] to [src].</span>")
holdingitems[I] = TRUE
updateUsrDialog()
return FALSE
@@ -214,7 +121,7 @@
user.set_machine(src)
interact(user)
/obj/machinery/reagentgrinder/interact(mob/user) // The microwave Menu
/obj/machinery/reagentgrinder/interact(mob/user) // The microwave Menu //I am reasonably certain that this is not a microwave
var/is_chamber_empty = FALSE
var/is_beaker_ready = FALSE
var/processing_chamber = ""
@@ -307,60 +214,10 @@
holdingitems -= O
updateUsrDialog()
/obj/machinery/reagentgrinder/proc/get_allowed_by_obj(obj/item/O)
for (var/i in blend_items)
if (istype(O, i))
return blend_items[i]
/obj/machinery/reagentgrinder/proc/get_allowed_juice_by_obj(obj/item/reagent_containers/food/snacks/O)
for(var/i in juice_items)
if(istype(O, i))
return juice_items[i]
/obj/machinery/reagentgrinder/proc/get_grownweapon_amount(obj/item/grown/O)
if (!istype(O) || !O.seed)
return 5
else if (O.seed.potency == -1)
return 5
else
return round(O.seed.potency)
/obj/machinery/reagentgrinder/proc/get_juice_amount(obj/item/reagent_containers/food/snacks/grown/O)
if (!istype(O) || !O.seed)
return 5
else if (O.seed.potency == -1)
return 5
else
return round(5*sqrt(O.seed.potency))
/obj/machinery/reagentgrinder/proc/remove_object(obj/item/O)
holdingitems -= O
qdel(O)
/obj/machinery/reagentgrinder/proc/juice()
power_change()
if(!beaker || (beaker && (beaker.reagents.total_volume >= beaker.reagents.maximum_volume)))
return
operate_for(50, juicing = TRUE)
//Snacks
for(var/obj/item/i in holdingitems)
var/obj/item/I = i
if(istype(I, /obj/item/reagent_containers/food/snacks))
var/obj/item/reagent_containers/food/snacks/O = I
if(beaker.reagents.total_volume >= beaker.reagents.maximum_volume)
break
var/list/allowed = get_allowed_juice_by_obj(O)
if(isnull(allowed))
break
for(var/r_id in allowed)
var/space = beaker.reagents.maximum_volume - beaker.reagents.total_volume
var/amount = get_juice_amount(O)
beaker.reagents.add_reagent(r_id, min(amount, space))
if(beaker.reagents.total_volume >= beaker.reagents.maximum_volume)
break
remove_object(O)
/obj/machinery/reagentgrinder/proc/shake_for(duration)
var/offset = prob(50) ? -2 : 2
var/old_pixel_x = pixel_x
@@ -386,8 +243,26 @@
operating = FALSE
updateUsrDialog()
/obj/machinery/reagentgrinder/proc/grind()
/obj/machinery/reagentgrinder/proc/juice()
power_change()
if(!beaker || (beaker && (beaker.reagents.total_volume >= beaker.reagents.maximum_volume)))
return
operate_for(50, juicing = TRUE)
for(var/obj/item/i in holdingitems)
if(beaker.reagents.total_volume >= beaker.reagents.maximum_volume)
break
var/obj/item/I = i
if(I.juice_results)
juice_item(I)
/obj/machinery/reagentgrinder/proc/juice_item(obj/item/I) //Juicing results can be found in respective object definitions
if(I.on_juice(src) == -1)
to_chat(usr, "<span class='danger'>[src] shorts out as it tries to juice up [I], and transfers it back to storage.</span>")
return
beaker.reagents.add_reagent_list(I.juice_results)
remove_object(I)
/obj/machinery/reagentgrinder/proc/grind()
power_change()
if(!beaker || (beaker && beaker.reagents.total_volume >= beaker.reagents.maximum_volume))
return
@@ -396,82 +271,17 @@
if(beaker.reagents.total_volume >= beaker.reagents.maximum_volume)
break
var/obj/item/I = i
//Snacks
if(istype(I, /obj/item/reagent_containers/food/snacks))
var/obj/item/reagent_containers/food/snacks/O = I
var/list/allowed = get_allowed_by_obj(O)
if(isnull(allowed))
continue
for(var/r_id in allowed)
var/space = beaker.reagents.maximum_volume - beaker.reagents.total_volume
var/amount = allowed[r_id]
if(amount <= 0)
if(amount == 0)
if (O.reagents != null && O.reagents.has_reagent("nutriment"))
beaker.reagents.add_reagent(r_id, min(O.reagents.get_reagent_amount("nutriment"), space))
O.reagents.remove_reagent("nutriment", min(O.reagents.get_reagent_amount("nutriment"), space))
else
if (O.reagents != null && O.reagents.has_reagent("nutriment"))
beaker.reagents.add_reagent(r_id, min(round(O.reagents.get_reagent_amount("nutriment")*abs(amount)), space))
O.reagents.remove_reagent("nutriment", min(O.reagents.get_reagent_amount("nutriment"), space))
else
O.reagents.trans_id_to(beaker, r_id, min(amount, space))
if (beaker.reagents.total_volume >= beaker.reagents.maximum_volume)
break
if(O.reagents.reagent_list.len == 0)
remove_object(O)
//Sheets
else if(istype(I, /obj/item/stack/sheet))
var/obj/item/stack/sheet/O = I
var/list/allowed = get_allowed_by_obj(O)
for(var/t in 1 to round(O.amount, 1))
for(var/r_id in allowed)
var/space = beaker.reagents.maximum_volume - beaker.reagents.total_volume
var/amount = allowed[r_id]
beaker.reagents.add_reagent(r_id,min(amount, space))
if (space < amount)
break
if(t == round(O.amount, 1))
remove_object(O)
break
//Plants
else if(istype(I, /obj/item/grown))
var/obj/item/grown/O = I
var/list/allowed = get_allowed_by_obj(O)
for (var/r_id in allowed)
var/space = beaker.reagents.maximum_volume - beaker.reagents.total_volume
var/amount = allowed[r_id]
if (amount == 0)
if (O.reagents != null && O.reagents.has_reagent(r_id))
beaker.reagents.add_reagent(r_id,min(O.reagents.get_reagent_amount(r_id), space))
else
beaker.reagents.add_reagent(r_id,min(amount, space))
if (beaker.reagents.total_volume >= beaker.reagents.maximum_volume)
break
remove_object(O)
else if(istype(I, /obj/item/slime_extract))
var/obj/item/slime_extract/O = I
var/space = beaker.reagents.maximum_volume - beaker.reagents.total_volume
if (O.reagents != null)
var/amount = O.reagents.total_volume
O.reagents.trans_to(beaker, min(amount, space))
if (O.Uses > 0)
beaker.reagents.add_reagent("slimejelly",min(20, space))
remove_object(O)
if(istype(I, /obj/item/reagent_containers))
var/obj/item/reagent_containers/O = I
var/amount = O.reagents.total_volume
O.reagents.trans_to(beaker, amount)
if(!O.reagents.total_volume)
remove_object(O)
else if(istype(I, /obj/item/toy/crayon))
var/obj/item/toy/crayon/O = I
for (var/r_id in O.reagent_contents)
var/space = beaker.reagents.maximum_volume - beaker.reagents.total_volume
if(!space)
break
beaker.reagents.add_reagent(r_id, min(O.reagent_contents[r_id], space))
remove_object(O)
if(I.grind_results)
grind_item(i)
/obj/machinery/reagentgrinder/proc/grind_item(obj/item/I) //Grind results can be found in respective object definitions
if(I.on_grind(src) == -1) //Call on_grind() to change amount as needed, and stop grinding the item if it returns -1
to_chat(usr, "<span class='danger'>[src] shorts out as it tries to grind up [I], and transfers it back to storage.</span>")
return
beaker.reagents.add_reagent_list(I.grind_results)
if(I.reagents)
I.reagents.trans_to(beaker, I.reagents.total_volume)
remove_object(I)
/obj/machinery/reagentgrinder/proc/mix(mob/user)
//For butter and other things that would change upon shaking or mixing
@@ -1,3 +1,4 @@
<<<<<<< HEAD
/obj/item/reagent_containers/pill
name = "pill"
desc = "A tablet or capsule."
@@ -152,3 +153,160 @@
icon_state = "pill9"
color = "#454545"
list_reagents = list("shadowmutationtoxin" = 1)
=======
/obj/item/reagent_containers/pill
name = "pill"
desc = "A tablet or capsule."
icon = 'icons/obj/chemical.dmi'
icon_state = "pill"
item_state = "pill"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
possible_transfer_amounts = list()
volume = 50
grind_results = list()
var/apply_type = INGEST
var/apply_method = "swallow"
var/roundstart = 0
var/self_delay = 0 //pills are instant, this is because patches inheret their aplication from pills
/obj/item/reagent_containers/pill/Initialize()
. = ..()
if(!icon_state)
icon_state = "pill[rand(1,20)]"
if(reagents.total_volume && roundstart)
name += " ([reagents.total_volume]u)"
/obj/item/reagent_containers/pill/attack_self(mob/user)
return
/obj/item/reagent_containers/pill/attack(mob/M, mob/user, def_zone)
if(!canconsume(M, user))
return 0
if(M == user)
M.visible_message("<span class='notice'>[user] attempts to [apply_method] [src].</span>")
if(self_delay)
if(!do_mob(user, M, self_delay))
return 0
to_chat(M, "<span class='notice'>You [apply_method] [src].</span>")
else
M.visible_message("<span class='danger'>[user] attempts to force [M] to [apply_method] [src].</span>", \
"<span class='userdanger'>[user] attempts to force [M] to [apply_method] [src].</span>")
if(!do_mob(user, M))
return 0
M.visible_message("<span class='danger'>[user] forces [M] to [apply_method] [src].</span>", \
"<span class='userdanger'>[user] forces [M] to [apply_method] [src].</span>")
add_logs(user, M, "fed", reagentlist(src))
if(reagents.total_volume)
reagents.reaction(M, apply_type)
reagents.trans_to(M, reagents.total_volume)
qdel(src)
return 1
/obj/item/reagent_containers/pill/afterattack(obj/target, mob/user , proximity)
if(!proximity)
return
if(target.is_open_container() != 0 && target.reagents)
if(!target.reagents.total_volume)
to_chat(user, "<span class='warning'>[target] is empty! There's nothing to dissolve [src] in.</span>")
return
to_chat(user, "<span class='notice'>You dissolve [src] in [target].</span>")
for(var/mob/O in viewers(2, user)) //viewers is necessary here because of the small radius
to_chat(O, "<span class='warning'>[user] slips something into [target]!</span>")
reagents.trans_to(target, reagents.total_volume)
qdel(src)
/obj/item/reagent_containers/pill/tox
name = "toxins pill"
desc = "Highly toxic."
icon_state = "pill5"
list_reagents = list("toxin" = 50)
roundstart = 1
/obj/item/reagent_containers/pill/cyanide
name = "cyanide pill"
desc = "Don't swallow this."
icon_state = "pill5"
list_reagents = list("cyanide" = 50)
roundstart = 1
/obj/item/reagent_containers/pill/adminordrazine
name = "adminordrazine pill"
desc = "It's magic. We don't have to explain it."
icon_state = "pill16"
list_reagents = list("adminordrazine" = 50)
roundstart = 1
/obj/item/reagent_containers/pill/morphine
name = "morphine pill"
desc = "Commonly used to treat insomnia."
icon_state = "pill8"
list_reagents = list("morphine" = 30)
roundstart = 1
/obj/item/reagent_containers/pill/stimulant
name = "stimulant pill"
desc = "Often taken by overworked employees, athletes, and the inebriated. You'll snap to attention immediately!"
icon_state = "pill19"
list_reagents = list("ephedrine" = 10, "antihol" = 10, "coffee" = 30)
roundstart = 1
/obj/item/reagent_containers/pill/salbutamol
name = "salbutamol pill"
desc = "Used to treat oxygen deprivation."
icon_state = "pill16"
list_reagents = list("salbutamol" = 30)
roundstart = 1
/obj/item/reagent_containers/pill/charcoal
name = "charcoal pill"
desc = "Neutralizes many common toxins."
icon_state = "pill17"
list_reagents = list("charcoal" = 10)
roundstart = 1
/obj/item/reagent_containers/pill/epinephrine
name = "epinephrine pill"
desc = "Used to stabilize patients."
icon_state = "pill5"
list_reagents = list("epinephrine" = 15)
roundstart = 1
/obj/item/reagent_containers/pill/mannitol
name = "mannitol pill"
desc = "Used to treat brain damage."
icon_state = "pill17"
list_reagents = list("mannitol" = 50)
roundstart = 1
/obj/item/reagent_containers/pill/mutadone
name = "mutadone pill"
desc = "Used to treat genetic damage."
icon_state = "pill20"
list_reagents = list("mutadone" = 50)
roundstart = 1
/obj/item/reagent_containers/pill/salicyclic
name = "salicylic acid pill"
desc = "Used to dull pain."
icon_state = "pill9"
list_reagents = list("sal_acid" = 24)
roundstart = 1
/obj/item/reagent_containers/pill/oxandrolone
name = "oxandrolone pill"
desc = "Used to stimulate burn healing."
icon_state = "pill11"
list_reagents = list("oxandrolone" = 24)
roundstart = 1
/obj/item/reagent_containers/pill/insulin
name = "insulin pill"
desc = "Handles hyperglycaemic coma."
icon_state = "pill18"
list_reagents = list("insulin" = 50)
roundstart = 1
/obj/item/reagent_containers/pill/shadowtoxin
name = "black pill"
desc = "I wouldn't eat this if I were you."
icon_state = "pill9"
color = "#454545"
list_reagents = list("shadowmutationtoxin" = 1)
>>>>>>> d447acd... All-In-One grinder results are now defined by type, not by huge lists (#33181)
@@ -12,6 +12,7 @@
throw_speed = 3
throw_range = 6
container_type = INJECTABLE_1
grind_results = list()
var/Uses = 1 // uses before it goes inert
var/qdel_timer = null // deletion timer, for delayed reactions
@@ -29,6 +30,10 @@
. = ..()
create_reagents(100)
/obj/item/slime_extract/on_grind()
if(Uses)
grind_results["slimejelly"] = 20
/obj/item/slime_extract/grey
name = "grey slime extract"
icon_state = "grey slime extract"