Skip to content

Commit

Permalink
Adding dried meat.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Jan 18, 2024
1 parent 1dc9de3 commit db7bf91
Show file tree
Hide file tree
Showing 14 changed files with 123 additions and 59 deletions.
52 changes: 45 additions & 7 deletions code/game/objects/items_drying.dm
Original file line number Diff line number Diff line change
@@ -1,26 +1,64 @@
// Stubs/vars for use with the drying rack.
/obj/item
var/drying_threshold_temperature = 500 // Kelvin, checked in fire_act()
var/dried_type // If set to a type, drying this item will convert it to that type.
// Reduced when exposed to high temperatures or put on a drying rack. When hitting zero, the item transitions to a dried state.
var/drying_wetness
// Temperature threshold for fire_act() to dry the object, in degrees Kelvin.
var/drying_threshold_temperature = 500
// If set to a type, drying this item will convert it to that type.
var/dried_type

/obj/item/proc/is_dryable()
return !isnull(dried_type)
return drying_wetness > 0

/obj/item/proc/get_dried_product()
return new dried_type(loc)

/obj/item/stack/get_dried_product()
if(ispath(dried_type, /obj/item/stack))
return new dried_type(loc, amount)
return ..()

// Returns null for no change, or an instance for a successful drying.
/obj/item/proc/dry_out(var/obj/rack, var/drying_power = 1)
if(dried_type)
. = new dried_type(loc)
/obj/item/proc/dry_out(var/obj/rack, var/drying_power = 1, var/fire_exposed = FALSE, var/silent = FALSE)

Check failure on line 22 in code/game/objects/items_drying.dm

View workflow job for this annotation

GitHub Actions / DreamChecker

an override of /obj/item/proc/dry_out is missing keyword args
if(!dried_type)
return
if(drying_wetness > 0)
drying_wetness -= drying_power
if(drying_wetness > 0)
return
var/obj/item/thing = get_dried_product()
if(color)
thing.color = color
if(!silent && rack)
rack.visible_message(SPAN_NOTICE("The [src] is dry!"))
if(thing != src)
qdel(src)
return thing

// Returns a string used in drying rack examine().
/obj/item/proc/get_dryness_text(var/obj/rack)
if(drying_wetness > 20)
return "wet"
if(drying_wetness > 10)
return "damp"
if(drying_wetness)
return "almost dry"
return "dry"

// Returns an icon_state used by drying rack update_icon().
/obj/item/proc/get_drying_overlay(var/obj/rack)
var/drying_state = get_drying_state(rack)
if(!drying_state || !color)
return drying_state
var/image/drying_overlay = image('icons/obj/drying_rack.dmi', drying_state)
drying_overlay.color = color
drying_overlay.appearance_flags |= KEEP_APART | RESET_COLOR
return drying_overlay

/obj/item/proc/get_drying_state(var/obj/rack)
return

/obj/item/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
..()
if(exposed_temperature >= drying_threshold_temperature)
dry_out()
dry_out(drying_power = rand(2, 4), fire_exposed = TRUE, silent = TRUE)
4 changes: 1 addition & 3 deletions code/game/objects/structures/bonfire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,8 @@
extinguish()
return
if(grill)
for(var/obj/item/reagent_containers/food/snacks/snack in loc)
snack.grill(src)
for(var/obj/item/thing in view(2, src))
thing.dry_out(src, rand(1,4))
thing.dry_out(src, 3 - get_dist(thing, src), (thing.loc == loc), silent = TRUE)
else
burn()

Expand Down
21 changes: 21 additions & 0 deletions code/modules/food/food/jerky.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// TODO
/obj/item/reagent_containers/food/snacks/fishjerky
name = "dried fish"

/obj/item/reagent_containers/food/snacks/fishjerky/get_drying_state()
return "fish_dried"

/obj/item/reagent_containers/food/snacks/meatjerky
name = "dried meat"

/obj/item/reagent_containers/food/snacks/meatjerky/get_drying_state()
return "meat_dried"

/obj/item/reagent_containers/food/snacks/meatjerky/cutlet/get_drying_state()
return "meat_dried_small"

/obj/item/reagent_containers/food/snacks/spiderjerky
name = "dried spider meat"

/obj/item/reagent_containers/food/snacks/spiderjerky/get_drying_state()
return "meat_dried"
39 changes: 21 additions & 18 deletions code/modules/food/food/snacks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@
/obj/item/reagent_containers/food/snacks/is_dryable()
return !dry

/obj/item/reagent_containers/food/snacks/dry_out(var/obj/rack, var/drying_power = 1)
/obj/item/reagent_containers/food/snacks/dry_out(var/obj/rack, var/drying_power = 1, var/fire_exposed = FALSE)

// If it's a direct fire, cook the food instead.
if(fire_exposed)
return grill(rack)

// Otherwise, try to dry it out.
if(!dried_type || dry)
return null
if(dried_type == type)
Expand All @@ -56,6 +62,7 @@
color = "#aaaaaa"
rack?.visible_message(SPAN_NOTICE("\The [src] is dry!"))
return src

return ..()

/obj/item/reagent_containers/food/snacks
Expand All @@ -76,7 +83,7 @@

/obj/item/reagent_containers/food/snacks/proc/grill(var/atom/heat_source)
if(!backyard_grilling_product || !backyard_grilling_threshold)
return
return null
backyard_grilling_progress++
if(backyard_grilling_progress >= backyard_grilling_threshold)
backyard_grilling_progress = 0
Expand All @@ -88,6 +95,7 @@
else
food.visible_message("<span class='[backyard_grilling_span]'>\The [src] [backyard_grilling_announcement]</span>")
qdel(src)
return food

//Placeholder for effect that trigger on eating that aren't tied to reagents.
/obj/item/reagent_containers/food/snacks/proc/On_Consume(var/mob/M)
Expand Down Expand Up @@ -897,10 +905,13 @@
filling_color = "#FFDEFE"
center_of_mass = list("x"=17, "y"=13)
bitesize = 6

dried_type = /obj/item/reagent_containers/food/snacks/fishjerky
var/toxin_type = "carpotoxin"
var/toxin_amount = 3

/obj/item/reagent_containers/food/snacks/carpmeat/get_drying_state()
return "fish"

/obj/item/reagent_containers/food/snacks/carpmeat/Initialize()
. = ..()
reagents.add_reagent("seafood", 3)
Expand Down Expand Up @@ -987,6 +998,9 @@
center_of_mass = list("x"=16, "y"=10)
bitesize = 6

/obj/item/reagent_containers/food/snacks/xenomeat/get_drying_state()
return "spidermeat"

/obj/item/reagent_containers/food/snacks/xenomeat/proc/add_venom()
reagents.add_reagent("pacid",6)

Expand All @@ -1004,6 +1018,7 @@
bitesize = 6
backyard_grilling_product = /obj/item/reagent_containers/food/snacks/xenomeat/spidermeat/charred
backyard_grilling_announcement = "smokes as the poison burns away."
dried_type = /obj/item/reagent_containers/food/snacks/spiderjerky

/obj/item/reagent_containers/food/snacks/xenomeat/spidermeat/add_venom()
..()
Expand All @@ -1013,6 +1028,7 @@
name = "charred spider meat"
desc = "A slab of green meat with char lines. The poison has been burned out of it."
color = COLOR_LIGHT_RED
dried_type = null
backyard_grilling_product = /obj/item/reagent_containers/food/snacks/badrecipe

/obj/item/reagent_containers/food/snacks/xenomeat/spidermeat/charred/add_venom()
Expand Down Expand Up @@ -1070,11 +1086,12 @@
whoops.dropInto(loc)
visible_message(SPAN_DANGER("\The [src] chars and blackens!"))
qdel(src)
return
return whoops

// Otherwise we just warm up.
heat()
visible_message(SPAN_NOTICE("\The [src] steams gently!"))
return src

/obj/item/reagent_containers/food/snacks/donkpocket/proc/heat()
warm = 1
Expand Down Expand Up @@ -3833,20 +3850,6 @@
. = ..()
reagents.add_reagent("protein", 3)

/obj/item/reagent_containers/food/snacks/rawcutlet
name = "raw cutlet"
desc = "A thin piece of raw meat."
icon = 'icons/obj/food_ingredients.dmi'
icon_state = "rawcutlet"
bitesize = 1
center_of_mass = list("x"=17, "y"=20)
backyard_grilling_product = /obj/item/reagent_containers/food/snacks/cutlet
backyard_grilling_announcement = "sizzles as it is grilled through."

/obj/item/reagent_containers/food/snacks/rawcutlet/Initialize()
. = ..()
reagents.add_reagent("protein", 1)

/obj/item/reagent_containers/food/snacks/cutlet
name = "cutlet"
desc = "A tasty meat slice."
Expand Down
19 changes: 19 additions & 0 deletions code/modules/food/food/snacks/meat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
health = 180
filling_color = "#FF1C1C"
center_of_mass = list("x"=16, "y"=14)
dried_type = /obj/item/reagent_containers/food/snacks/meatjerky

/obj/item/reagent_containers/food/snacks/meat/get_drying_state()
return "meat"

/obj/item/reagent_containers/food/snacks/meat/Initialize()
. = ..()
Expand Down Expand Up @@ -32,6 +36,21 @@
else
..()

/obj/item/reagent_containers/food/snacks/rawcutlet
name = "raw cutlet"
desc = "A thin piece of raw meat."
icon = 'icons/obj/food_ingredients.dmi'
icon_state = "rawcutlet"
bitesize = 1
center_of_mass = list("x"=17, "y"=20)
backyard_grilling_product = /obj/item/reagent_containers/food/snacks/cutlet
backyard_grilling_announcement = "sizzles as it is grilled through."
dried_type = /obj/item/reagent_containers/food/snacks/meatjerky/cutlet

/obj/item/reagent_containers/food/snacks/rawcutlet/Initialize()
. = ..()
reagents.add_reagent("protein", 1)

/obj/item/reagent_containers/food/snacks/meat/syntiflesh
name = "synthetic meat"
desc = "A synthetic slab of flesh."
Expand Down
2 changes: 1 addition & 1 deletion code/modules/food/kitchen/smartfridge/drying_rack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
return
var/do_update = FALSE
for(var/obj/item/thing in contents)
var/obj/item/product = thing.dry_out(src)
var/obj/item/product = thing.dry_out(src, silent = TRUE)
if(product)
product.dropInto(loc)
do_update = TRUE
Expand Down
3 changes: 3 additions & 0 deletions code/modules/hydroponics/grown.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
if(seed.get_trait(TRAIT_STINGS))
force = 1

/obj/item/reagent_containers/food/snacks/grown/get_drying_state(var/obj/rack)
return seed?.drying_state || "grown"

/obj/item/reagent_containers/food/snacks/grown/proc/update_desc()

if(!seed)
Expand Down
3 changes: 3 additions & 0 deletions code/modules/hydroponics/seed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
var/backyard_grilling_product = /obj/item/reagent_containers/food/snacks/badrecipe
var/backyard_grilling_announcement = "smokes and chars!"

// Used to show an icon when drying in a rack.
var/drying_state = "grown"

// Making the assumption anything in HYDRO-ponics is capable of processing water, and nutrients commonly associated with it, leaving us with the below to be tweaked.
var/list/beneficial_reagents // Reagents considered uniquely 'beneficial' by a plant.
var/list/mutagenic_reagents // Reagents considered uniquely 'mutagenic' by a plant.
Expand Down
30 changes: 4 additions & 26 deletions code/modules/materials/sheets/organic/tanning/leather_wet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,20 @@
no_variants = FALSE
max_amount = 20
stacktype = "wetleather"
var/wetness = 30 //Reduced when exposed to high temperautres

/obj/item/stack/wetleather/is_dryable()
return wetness > 0
drying_wetness = 30
dried_type = /obj/item/stack/material/leather

/obj/item/stack/wetleather/get_drying_state(var/obj/rack)
if(wetness)
return "leather_wet"
return "leather_dry"
return (drying_wetness > 0 ? "leather_wet" : "leather_dry")

/obj/item/stack/wetleather/examine(var/mob/user)
. = ..()
. += description_info
. += "\The [src] is [get_dryness_text()]."

/obj/item/stack/wetleather/get_dryness_text(var/obj/rack)
if(wetness > 20)
return "wet"
if(wetness > 10)
return "damp"
if(wetness)
return "almost dry"
return ..()

/obj/item/stack/wetleather/transfer_to(obj/item/stack/S, var/tamount=null, var/type_verified)
. = ..()
if(.) // If it transfers any, do a weighted average of the wetness
var/obj/item/stack/wetleather/W = S
var/oldamt = W.amount - .
W.wetness = round(((oldamt * W.wetness) + (. * wetness)) / W.amount)

/obj/item/stack/wetleather/dry_out(var/obj/rack, var/drying_power = 1)
if(wetness <= 0)
return null
wetness -= drying_power
if(wetness <= 0)
. = new /obj/item/stack/material/leather(loc, amount)
rack?.visible_message(SPAN_NOTICE("The [src] is dry!"))
qdel(src)
W.drying_wetness = round(((oldamt * W.drying_wetness) + (. * drying_wetness)) / W.amount)
6 changes: 3 additions & 3 deletions code/modules/materials/sheets/organic/tanning/tanning_rack.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/obj/structure/drying_rack
name = "drying rack"
desc = "A rack used to stretch leather out and hold it taut during the tanning process."
icon = 'icons/obj/kitchen.dmi'
icon_state = "spike"
icon = 'icons/obj/drying_rack.dmi'
icon_state = "rack"
var/obj/item/drying

/obj/structure/drying_rack/Initialize()
Expand Down Expand Up @@ -32,7 +32,7 @@

/obj/structure/drying_rack/update_icon()
cut_overlays()
var/drying_state = drying?.get_drying_state(src)
var/drying_state = drying?.get_drying_overlay(src)
if(drying_state)
add_overlay(drying_state)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/reagents/toxins.dm
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@
var/obj/item/stack/wetleather/wethide = new(O.loc, round(volume))
dryhide.use(round(volume))
if(!QDELETED(wethide) && wethide.get_amount())
wethide.dry_out(null, INFINITY) // dry it immediately
wethide.dry_out(drying_power = INFINITY, silent = TRUE) // dry it immediately
..()

/datum/reagent/toxin/plantbgone
Expand Down
Binary file added icons/obj/drying_rack.dmi
Binary file not shown.
Binary file modified icons/obj/kitchen.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions polaris.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1907,6 +1907,7 @@
#include "code\modules\food\food\cans.dm"
#include "code\modules\food\food\condiment.dm"
#include "code\modules\food\food\drinks.dm"
#include "code\modules\food\food\jerky.dm"
#include "code\modules\food\food\lunch.dm"
#include "code\modules\food\food\sandwich.dm"
#include "code\modules\food\food\snacks.dm"
Expand Down

0 comments on commit db7bf91

Please sign in to comment.