Bugfix Collection (#11371)

This commit is contained in:
MarinaGryphon
2021-03-04 21:19:10 +01:00
committed by GitHub
parent 8c3ae999ef
commit 2a0ab65e64
20 changed files with 186 additions and 137 deletions
+7 -4
View File
@@ -330,6 +330,12 @@
/obj/item/stack/material/glass = list(/decl/reagent/silicate),
/obj/item/stack/material/glass/phoronglass = list(/decl/reagent/platinum, /decl/reagent/silicate, /decl/reagent/silicate, /decl/reagent/silicate), //5 platinum, 15 silicate,
)
var/list/beaker_types = list( // also can't be ground
/obj/item/reagent_containers/glass,
/obj/item/reagent_containers/food/drinks/drinkingglass,
/obj/item/reagent_containers/food/drinks/shaker,
/obj/item/reagent_containers/cooking_container
)
/obj/machinery/reagentgrinder/Initialize()
. = ..()
@@ -340,10 +346,7 @@
return
/obj/machinery/reagentgrinder/attackby(var/obj/item/O as obj, var/mob/user as mob)
if (istype(O,/obj/item/reagent_containers/glass) || \
istype(O,/obj/item/reagent_containers/food/drinks/drinkingglass) || \
istype(O,/obj/item/reagent_containers/food/drinks/shaker))
if (is_type_in_list(O, beaker_types))
if (beaker)
return 1
else
@@ -139,13 +139,11 @@
var/removing = (4 * removed)
var/datum/reagents/ingested = M.get_ingested_reagents()
for(var/_R in ingested.reagent_volumes)
var/decl/reagent/R = decls_repository.get_decl(_R)
if((remove_generic && istype(R, /decl/reagent/toxin)) || (_R in remove_toxins))
ingested.remove_reagent(R.type, removing)
if((remove_generic && ispath(_R, /decl/reagent/toxin)) || (_R in remove_toxins))
ingested.remove_reagent(_R, removing)
return
for(var/_R in M.reagents.reagent_volumes)
var/decl/reagent/R = decls_repository.get_decl(_R)
if((remove_generic && istype(R, /decl/reagent/toxin)) || (_R in remove_toxins))
if((remove_generic && ispath(_R, /decl/reagent/toxin)) || (_R in remove_toxins))
M.reagents.remove_reagent(_R, removing)
return
@@ -605,10 +603,9 @@
var/datum/reagents/ingested = M.get_ingested_reagents()
if(ingested)
for(var/_R in ingested.reagent_volumes)
var/decl/reagent/R = decls_repository.get_decl(_R)
if(istype(R, /decl/reagent/alcohol))
if(ispath(_R, /decl/reagent/alcohol))
var/amount = min(P, REAGENT_VOLUME(ingested, _R))
ingested.remove_reagent(R.type, amount)
ingested.remove_reagent(_R, amount)
P -= amount
if (P <= 0)
return
@@ -617,8 +614,7 @@
//as a treatment option if someone was dumb enough to do this
if(M.bloodstr)
for(var/_R in M.bloodstr.reagent_volumes)
var/decl/reagent/R = decls_repository.get_decl(_R)
if(istype(R, /decl/reagent/alcohol))
if(ispath(_R, /decl/reagent/alcohol))
var/amount = min(P, REAGENT_VOLUME(M.bloodstr, _R))
M.bloodstr.remove_reagent(_R, amount)
P -= amount
@@ -79,12 +79,17 @@
qdel(src)
/obj/item/reagent_containers/attackby(var/obj/item/W, var/mob/user)
if(istype(W, /obj/item/reagent_containers/food/snacks))
var/obj/item/reagent_containers/food/snacks/dipped = W
dipped.attempt_apply_coating(src, user)
return
if(!(W.flags & NOBLUDGEON) && (user.a_intent == I_HURT) && fragile && (W.force > fragile))
if(do_after(user, 10))
if(!QDELETED(src))
visible_message(SPAN_WARNING("[user] smashes [src] with \a [W]!"))
user.do_attack_animation(src)
shatter(W, user)
return
..()
/obj/item/reagent_containers/attack(mob/M, mob/user, def_zone)
@@ -11,7 +11,7 @@
var/slices_num
var/dried_type = null
var/dry = 0
var/decl/reagent/nutriment/coating/coating = null
var/coating = null // coating typepath, NOT decl
var/icon/flat_icon = null //Used to cache a flat icon generated from dipping in batter. This is used again to make the cooked-batter-overlay
var/do_coating_prefix = TRUE
//If 0, we wont do "battered thing" or similar prefixes. Mainly for recipes that include batter but have a special name
@@ -142,7 +142,8 @@
else
to_chat(user, SPAN_NOTICE("You know the item as [initial(name)], but a little piece of propped-up paper indicates it's \a [name]."))
if (coating)
to_chat(user, SPAN_NOTICE("It's coated in [coating.name]!"))
var/decl/reagent/coating_reagent = decls_repository.get_decl(coating)
to_chat(user, SPAN_NOTICE("It's coated in [coating_reagent.name]!"))
if (bitecount==0)
return
else if (bitecount==1)
@@ -256,28 +257,35 @@
return ..()
//Code for dipping food in batter
/obj/item/reagent_containers/food/snacks/afterattack(obj/O as obj, mob/user as mob, proximity)
if(O.is_open_container() && !(istype(O, /obj/item/reagent_containers/food)) && proximity)
for (var/r in O.reagents.reagent_volumes)
var/decl/reagent/R = r
if (istype(R, /decl/reagent/nutriment/coating))
if (apply_coating(O.reagents, R, user))
return TRUE
return ..()
/**
* Perform checks, then apply any applicable coatings.
*
* @param dip /obj The object to attempt to dip src into.
* @param user /mob The mob attempting to dip src into dip.
*
* @return TRUE if coating applied, FALSE otherwise
*/
/obj/item/reagent_containers/food/snacks/proc/attempt_apply_coating(obj/dip, mob/user)
if(!dip.is_open_container() || istype(dip, /obj/item/reagent_containers/food) || !Adjacent(user))
return
for (var/reagent_type in dip.reagents?.reagent_volumes)
if(!ispath(reagent_type, /decl/reagent/nutriment/coating))
continue
return apply_coating(dip.reagents, reagent_type, user)
//This proc handles drawing coatings out of a container when this food is dipped into it
/obj/item/reagent_containers/food/snacks/proc/apply_coating(var/datum/reagents/holder, var/decl/reagent/nutriment/coating/C, var/mob/user)
/obj/item/reagent_containers/food/snacks/proc/apply_coating(var/datum/reagents/holder, var/applied_coating, var/mob/user)
if (coating)
to_chat(user, "The [src] is already coated in [coating.name]!")
var/decl/reagent/coating_reagent = decls_repository.get_decl(coating)
to_chat(user, "[src] is already coated in [coating_reagent.name]!")
return FALSE
var/decl/reagent/nutriment/coating/applied_coating_reagent = decls_repository.get_decl(applied_coating)
//Calculate the reagents of the coating needed
var/req = 0
for (var/r in reagents.reagent_volumes)
var/decl/reagent/R = r
if (istype(R, /decl/reagent/nutriment))
if (ispath(r, /decl/reagent/nutriment))
req += reagents.reagent_volumes[r] * 0.2
else
req += reagents.reagent_volumes[r] * 0.1
@@ -288,8 +296,8 @@
//the food has no reagents left, it's probably getting deleted soon
return FALSE
if (holder.reagent_volumes[C.type] < req)
to_chat(user, SPAN_WARNING("There's not enough [C.name] to coat the [src]!"))
if (holder.reagent_volumes[applied_coating] < req)
to_chat(user, SPAN_WARNING("There's not enough [applied_coating_reagent.name] to coat [src]!"))
return FALSE
//First make sure there's space for our batter
@@ -300,10 +308,10 @@
//Suck the coating out of the holder
holder.trans_to_holder(reagents, req)
if (!REAGENT_VOLUME(reagents, C.type))
if (!REAGENT_VOLUME(reagents, applied_coating))
return
coating = C
coating = applied_coating
//Now we have to do the witchcraft with masking images
//var/icon/I = new /icon(icon, icon_state)
@@ -312,7 +320,7 @@
var/icon/I = flat_icon
color = "#FFFFFF" //Some fruits use the color var. Reset this so it doesnt tint the batter
I.Blend(new /icon('icons/obj/food_custom.dmi', rgb(255,255,255)),ICON_ADD)
I.Blend(new /icon('icons/obj/food_custom.dmi', coating.icon_raw),ICON_MULTIPLY)
I.Blend(new /icon('icons/obj/food_custom.dmi', applied_coating_reagent.icon_raw),ICON_MULTIPLY)
var/image/J = image(I)
J.alpha = 200
J.blend_mode = BLEND_OVERLAY
@@ -320,13 +328,14 @@
add_overlay(J)
if (user)
user.visible_message(SPAN_NOTICE("[user] dips [src] into \the [coating.name]"), SPAN_NOTICE("You dip [src] into \the [coating.name]"))
user.visible_message(SPAN_NOTICE("[user] dips [src] into \the [applied_coating_reagent.name]"), SPAN_NOTICE("You dip [src] into \the [applied_coating_reagent.name]"))
return TRUE
//Called by cooking machines. This is mainly intended to set properties on the food that differ between raw/cooked
/obj/item/reagent_containers/food/snacks/proc/cook()
if (coating)
var/decl/reagent/nutriment/coating/our_coating = decls_repository.get_decl(coating)
var/list/temp = overlays.Copy()
for (var/i in temp)
if (istype(i, /image))
@@ -343,22 +352,20 @@
var/icon/I = flat_icon
color = "#FFFFFF" //Some fruits use the color var
I.Blend(new /icon('icons/obj/food_custom.dmi', rgb(255,255,255)),ICON_ADD)
I.Blend(new /icon('icons/obj/food_custom.dmi', coating.icon_cooked),ICON_MULTIPLY)
I.Blend(new /icon('icons/obj/food_custom.dmi', our_coating.icon_cooked),ICON_MULTIPLY)
var/image/J = image(I)
J.alpha = 200
J.tag = "coating"
add_overlay(J)
if (do_coating_prefix == 1)
name = "[coating.coated_adj] [name]"
name = "[our_coating.coated_adj] [name]"
for (var/r in reagents.reagent_volumes)
var/decl/reagent/R = r
if (istype(R, /decl/reagent/nutriment/coating))
var/decl/reagent/nutriment/coating/C = R
if (ispath(r, /decl/reagent/nutriment/coating))
var/decl/reagent/nutriment/coating/C = decls_repository.get_decl(r)
LAZYINITLIST(reagents.reagent_data)
LAZYINITLIST(reagents.reagent_data[r])
reagents.reagent_data[r]["cooked"] = TRUE
LAZYSET(reagents.reagent_data[r], "cooked", TRUE)
C.name = C.cooked_name
// A proc for setting various flavors of the same type of food instead of creating new foods with the only difference being a flavor
@@ -938,25 +945,19 @@
do_coating_prefix = 0
bitesize = 2
reagents_to_add = list(/decl/reagent/nutriment/protein = 6, /decl/reagent/nutriment/coating/batter = 1.7, /decl/reagent/nutriment/triglyceride/oil = 1.5)
/obj/item/reagent_containers/food/snacks/sausage/battered/Initialize()
. = ..()
coating = decls_repository.get_decl(/decl/reagent/nutriment/coating/batter)
coating = /decl/reagent/nutriment/coating/batter
/obj/item/reagent_containers/food/snacks/jalapeno_poppers
name = "jalapeno popper"
desc = "A battered, deep-fried chilli pepper"
desc = "A battered, deep-fried chili pepper"
icon_state = "popper"
filling_color = "#00AA00"
do_coating_prefix = 0
reagents_to_add = list(/decl/reagent/nutriment = 2, /decl/reagent/nutriment/coating/batter = 2, /decl/reagent/nutriment/triglyceride/oil = 2)
reagent_data = list(/decl/reagent/nutriment = list("chilli pepper" = 2))
reagent_data = list(/decl/reagent/nutriment = list("chili pepper" = 2))
bitesize = 1
/obj/item/reagent_containers/food/snacks/jalapeno_poppers/Initialize()
. = ..()
coating = decls_repository.get_decl(/decl/reagent/nutriment/coating/batter)
coating = /decl/reagent/nutriment/coating/batter
/obj/item/reagent_containers/food/snacks/donkpocket
name = "Donk-pocket"
@@ -2313,7 +2314,7 @@
filling_color = "#702708"
center_of_mass = list("x"=15, "y"=9)
reagents_to_add = list(/decl/reagent/nutriment = 3, /decl/reagent/nutriment/protein = 3, /decl/reagent/capsaicin = 3, /decl/reagent/drink/tomatojuice = 2, /decl/reagent/hyperzine = 5)
reagent_data = list(/decl/reagent/nutriment = list("chilli peppers" = 3))
reagent_data = list(/decl/reagent/nutriment = list("chili peppers" = 3))
bitesize = 5
/obj/item/reagent_containers/food/snacks/stew/bear
@@ -2380,7 +2381,7 @@
filling_color = "#EDDD00"
center_of_mass = list("x"=18, "y"=14)
reagents_to_add = list(/decl/reagent/nutriment = 8, /decl/reagent/nutriment/protein = 2, /decl/reagent/capsaicin = 2)
reagent_data = list(/decl/reagent/nutriment = list("fresh fries" = 4, "cheese" = 2, "chilli peppers" = 2))
reagent_data = list(/decl/reagent/nutriment = list("fresh fries" = 4, "cheese" = 2, "chili peppers" = 2))
bitesize = 4
/obj/item/reagent_containers/food/snacks/friedmushroom
@@ -3200,7 +3201,7 @@
/obj/item/reagent_containers/food/snacks/sliceable/pizza/crunch/Initialize()
. = ..()
coating = decls_repository.get_decl(/decl/reagent/nutriment/coating/batter)
coating = /decl/reagent/nutriment/coating/batter
/obj/item/reagent_containers/food/snacks/pizzacrunchslice
name = "pizza crunch"
@@ -3211,10 +3212,7 @@
center_of_mass = list("x"=18, "y"=13)
reagents_to_add = list(/decl/reagent/nutriment = 5, /decl/reagent/nutriment/coating/batter = 2, /decl/reagent/nutriment/triglyceride/oil = 1)
reagent_data = list(/decl/reagent/nutriment = list("pizza crust" = 5))
/obj/item/reagent_containers/food/snacks/sliceable/pizza/crunch/Initialize()
. = ..()
coating = decls_repository.get_decl(/decl/reagent/nutriment/coating/batter)
coating = /decl/reagent/nutriment/coating/batter
/obj/item/pizzabox
name = "pizza box"
@@ -3463,7 +3461,7 @@
reagents_to_add = list(/decl/reagent/nutriment = 3)
reagent_data = list(/decl/reagent/nutriment = list("uncooked dough" = 3))
filling_color = "#EDE0AF"
/obj/item/reagent_containers/food/snacks/doughslice
name = "dough slice"
desc = "A building block of an impressive dish."
@@ -3516,7 +3514,7 @@
if ("rodent")
result = new /obj/item/reagent_containers/food/snacks/burger/mouse(src)
to_chat(user, "You make a ratburger!")
else if(istype(W,/obj/item/reagent_containers/food/snacks))
var/obj/item/reagent_containers/food/snacks/csandwich/roll/R = new(get_turf(src))
R.attackby(W,user)
@@ -3647,7 +3645,7 @@
reagents_to_add = list(/decl/reagent/nutriment = 3)
reagent_data = list(/decl/reagent/nutriment = list("uncooked potatos" = 3))
filling_color = "#EDF291"
/obj/item/reagent_containers/food/snacks/liquidfood
name = "LiquidFood ration"
desc = "A prepackaged grey slurry of all the essential nutrients for a spacefarer on the go. Should this be crunchy? Now with artificial flavoring!"
@@ -4056,7 +4054,7 @@
reagents_to_add = list(/decl/reagent/nutriment = 2)
reagent_data = list(/decl/reagent/nutriment = list("nacho chips" = 1))
filling_color = "#EDF291"
/obj/item/reagent_containers/food/snacks/chip/on_consume(mob/M as mob)
if(reagents && reagents.total_volume)
@@ -4224,7 +4222,7 @@
reagents_to_add = list(/decl/reagent/nutriment = 20)
reagent_data = list(/decl/reagent/nutriment = list("salsa" = 20))
filling_color = "#FF4D36"
/obj/item/reagent_containers/food/snacks/dip/guac
name = "guac dip"
desc = "A recreation of the ancient Sol 'Guacamole' dip using tofu, limes, and spices. This recreation obviously leaves out mole meat."
@@ -4474,7 +4472,7 @@
reagents_to_add = list(/decl/reagent/nutriment = 8)
reagent_data = list(/decl/reagent/nutriment = list("cheese toast" = 8))
filling_color = "#FFF97D"
/obj/item/reagent_containers/food/snacks/bacon_and_eggs
name = "bacon and eggs"
desc = "A piece of bacon and two fried eggs."