Skip to content

Commit

Permalink
Fixes/tweaks from testing bonfires and cooking.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Jan 18, 2024
1 parent e272246 commit f15bc9b
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 74 deletions.
16 changes: 12 additions & 4 deletions code/game/objects/items_drying.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
var/drying_threshold_temperature = 500
// If set to a type, drying this item will convert it to that type.
var/dried_type
// Set if colour should be passed to dried product.
var/dried_product_takes_color = TRUE

/obj/item/proc/is_dryable()
return drying_wetness > 0
Expand All @@ -20,17 +22,23 @@

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

if(!dried_type || !is_dryable())
return

if(drying_wetness > 0)
drying_wetness -= drying_power
if(drying_wetness > 0)
return

var/obj/item/thing = get_dried_product()
if(color)
if(!thing)
return

if(color && dried_product_takes_color)
thing.color = color
if(!silent && rack)
rack.visible_message(SPAN_NOTICE("The [src] is dry!"))
if(isturf(loc) && !silent)
visible_message(SPAN_NOTICE("\The [src] [gender == PLURAL ? "are" : "is"] dry!"))
if(thing != src)
qdel(src)
return thing
Expand Down
18 changes: 8 additions & 10 deletions code/game/objects/structures/wood_fire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -202,19 +202,12 @@
if(burning)

// Draw our actual fire icon.
var/fire_state
if(fuel_amount >= 10)
fire_state = "[base_icon_state]_intense"
else if(fuel_amount >= 5)
fire_state = "[base_icon_state]_hot"
else
fire_state = "[base_icon_state]_warm"
var/image/I = image(icon, fire_state)
var/image/I = image(icon, ((fuel_amount >= 5) ? "[base_icon_state]_hot" : "[base_icon_state]_warm"))
I.appearance_flags = RESET_COLOR | KEEP_APART
add_overlay(I)

// If we're capable of burning buckled mobs (usually via a stake),
// draw a second intense fire overlay and offset it to cover the mob.
// draw an intense fire overlay and offset it to cover the mob.
if(fire_is_burning_mobs())
I = image(icon, "[base_icon_state]_intense")
I.pixel_y = 13
Expand Down Expand Up @@ -386,4 +379,9 @@

/obj/structure/wood_fire/fireplace/stove/get_fuel_overlay(var/fuel_amount)
. = ..()
LAZYADD(., "[base_icon_state]_cover")
if(!.)
. = "[base_icon_state]_cover"
else if(islist(.))
. += "[base_icon_state]_cover"
else
. = list(., "[base_icon_state]_cover")
92 changes: 48 additions & 44 deletions code/modules/food/food/snacks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
desc = "yummy"
icon = 'icons/obj/food.dmi'
icon_state = null
center_of_mass = list("x"=16, "y"=16)
w_class = ITEMSIZE_SMALL
force = 0

var/bitesize = 1
var/bitecount = 0
var/trash = null
Expand All @@ -23,9 +27,18 @@
var/package = FALSE // If this has a wrapper on it. If true, it will print a message and ask you to remove it
var/package_trash // Packaged meals drop this trash type item when opened, if set
var/package_open_state// Packaged meals switch to this state when opened, if set
center_of_mass = list("x"=16, "y"=16)
w_class = ITEMSIZE_SMALL
force = 0

// Halfassed version of Crabs' cooking system on Cit, should
// be folded into that if it is ported to Polaris.

/// What object type the food cooks into.
var/backyard_grilling_product = /obj/item/reagent_containers/food/snacks/badrecipe
/// How many SSobj ticks it takes for the food to cook.
var/backyard_grilling_rawness = 30
/// The message shown when the food cooks.
var/backyard_grilling_announcement = "smokes and chars!"
/// The span class used for the message above. Burned food defaults to SPAN_DANGER.
var/backyard_grilling_span = "notice"

/obj/item/reagent_containers/food/snacks/Initialize()
. = ..()
Expand Down Expand Up @@ -57,47 +70,37 @@
return "almost dried"
return "dehydrated"

/obj/item/reagent_containers/food/snacks/dry_out(var/obj/rack, var/drying_power = 1, var/fire_exposed = FALSE, var/silent = FALSE)
/obj/item/reagent_containers/food/snacks/proc/get_backyard_grilling_text(var/obj/rack)
var/moistness = backyard_grilling_rawness / initial(backyard_grilling_rawness)
if(moistness > 0.65)
return "uncooked"
if(moistness > 0.35)
return "half-cooked"
if(moistness)
return "nearly cooked"
return "cooked"

// If it's a direct fire, cook the food instead.
if(fire_exposed)
return grill(rack)
/obj/item/reagent_containers/food/snacks/examine(mob/user)
. = ..()
if(backyard_grilling_rawness > 0 && backyard_grilling_rawness != initial(backyard_grilling_rawness))
. += "\The [src] is [get_backyard_grilling_text()]."

// Otherwise, try to dry it out.
if(!dried_type || dry)
return null
if(dried_type == type)
/obj/item/reagent_containers/food/snacks/get_dried_product()
if(dried_type == type && !dry)
dry = TRUE
name = "dried [name]"
color = "#aaaaaa"
if(rack && !silent)
rack.visible_message(SPAN_NOTICE("\The [src] is dry!"))
return src

return ..()

/obj/item/reagent_containers/food/snacks

// Halfassed version of Crabs' cooking system on Cit, should
// be folded into that if it is ported to Polaris.

/// How many SSobj ticks of cooking the food has experienced.
var/backyard_grilling_progress = 0
/// What object type the food cooks into.
var/backyard_grilling_product = /obj/item/reagent_containers/food/snacks/badrecipe
/// How many SSobj ticks it takes for the food to cook.
var/backyard_grilling_threshold = 10
/// The message shown when the food cooks.
var/backyard_grilling_announcement = "smokes and chars!"
/// The span class used for the message above. Burned food defaults to SPAN_DANGER.
var/backyard_grilling_span = "notice"
/obj/item/reagent_containers/food/snacks/dry_out(var/obj/rack, var/drying_power = 1, var/fire_exposed = FALSE, var/silent = FALSE)
return fire_exposed ? grill(rack) : ..()

/obj/item/reagent_containers/food/snacks/proc/grill(var/atom/heat_source)
if(!backyard_grilling_product || !backyard_grilling_threshold)
if(!backyard_grilling_product || backyard_grilling_rawness <= 0)
return null
backyard_grilling_progress++
if(backyard_grilling_progress >= backyard_grilling_threshold)
backyard_grilling_progress = 0
backyard_grilling_rawness--
if(backyard_grilling_rawness <= 0)
var/obj/item/food = new backyard_grilling_product
food.dropInto(loc)
if(backyard_grilling_announcement)
Expand Down Expand Up @@ -916,7 +919,8 @@
filling_color = "#FFDEFE"
center_of_mass = list("x"=17, "y"=13)
bitesize = 2
drying_wetness = 20
drying_wetness = 60

dried_type = /obj/item/reagent_containers/food/snacks/jerky/fish
backyard_grilling_product = /obj/item/reagent_containers/food/snacks/grilledfish
backyard_grilling_announcement = "steams gently."
Expand Down Expand Up @@ -1033,7 +1037,7 @@
bitesize = 6
backyard_grilling_product = /obj/item/reagent_containers/food/snacks/xenomeat/spidermeat/charred
backyard_grilling_announcement = "smokes as the poison burns away."
drying_wetness = 20
drying_wetness = 60
dried_type = /obj/item/reagent_containers/food/snacks/jerky/spider/poison

/obj/item/reagent_containers/food/snacks/xenomeat/spidermeat/add_venom()
Expand All @@ -1044,9 +1048,8 @@
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
drying_wetness = null
dried_type = null
backyard_grilling_product = /obj/item/reagent_containers/food/snacks/badrecipe
dried_product_takes_color = FALSE
dried_type = /obj/item/reagent_containers/food/snacks/jerky/spider

/obj/item/reagent_containers/food/snacks/xenomeat/spidermeat/charred/add_venom()
Expand Down Expand Up @@ -1094,9 +1097,9 @@

/obj/item/reagent_containers/food/snacks/donkpocket/grill(var/atom/heat_source)

backyard_grilling_progress++
if(backyard_grilling_progress >= backyard_grilling_threshold)
backyard_grilling_progress = 0
backyard_grilling_rawness--
if(backyard_grilling_rawness <= 0)
backyard_grilling_rawness = initial(backyard_grilling_rawness)

// We're already warm, so we burn.
if(warm)
Expand Down Expand Up @@ -1696,9 +1699,10 @@
center_of_mass = list("x"=16, "y"=12)
bitesize = 2
backyard_grilling_product = null
backyard_grilling_rawness = 10

/obj/item/reagent_containers/food/snacks/badrecipe/grill(var/atom/heat_source)
if(!backyard_grilling_progress) // Smoke on our first grill
if(backyard_grilling_rawness <= 0) // Smoke on our first grill
// Produce nasty smoke.
var/datum/effect_system/smoke_spread/bad/burntfood/smoke = new /datum/effect_system/smoke_spread/bad/burntfood
playsound(src, 'sound/effects/smoke.ogg', 20, 1)
Expand All @@ -1709,8 +1713,8 @@
var/obj/machinery/firealarm/FA = locate() in get_area(src)
if(FA)
FA.alarm()
backyard_grilling_progress++
if(backyard_grilling_progress >= backyard_grilling_threshold)
backyard_grilling_rawness--
if(backyard_grilling_rawness <= 0)
qdel(src)

/obj/item/reagent_containers/food/snacks/badrecipe/Initialize()
Expand Down Expand Up @@ -8184,6 +8188,6 @@
nutriment_desc = list("flaky grilled fish" = 5)

/obj/item/reagent_containers/food/snacks/grilledfish/sivian
desc = "A lightly grilled fish fillet. This one is blue; it's probably an illegally fished native species."
desc = "A lightly grilled fish fillet. This one is blue, so you can expect a visit from the Sif Department of Fisheries."
icon_state = "grilledsiffish"
nutriment_desc = list("flaky grilled fish" = 5, "a mild, musky aftertaste" = 1)
4 changes: 2 additions & 2 deletions code/modules/food/food/snacks/meat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
health = 180
filling_color = "#FF1C1C"
center_of_mass = list("x"=16, "y"=14)
drying_wetness = 20
drying_wetness = 60
dried_type = /obj/item/reagent_containers/food/snacks/jerky/meat

/obj/item/reagent_containers/food/snacks/meat/get_drying_state()
Expand Down Expand Up @@ -46,7 +46,7 @@
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."
drying_wetness = 10
drying_wetness = 30
dried_type = /obj/item/reagent_containers/food/snacks/jerky/cutlet

/obj/item/reagent_containers/food/snacks/rawcutlet/Initialize()
Expand Down
4 changes: 2 additions & 2 deletions code/modules/hydroponics/grown.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
slot_flags = SLOT_HOLSTER
drop_sound = 'sound/items/drop/herb.ogg'
pickup_sound = 'sound/items/pickup/herb.ogg'
drying_wetness = 20
drying_wetness = 45

var/plantname
var/datum/seed/seed
Expand Down Expand Up @@ -40,7 +40,7 @@
name = "[seed.seed_name]"
trash = seed.get_trash_type()
backyard_grilling_product = seed.backyard_grilling_product
backyard_grilling_threshold = seed.backyard_grilling_threshold
backyard_grilling_rawness = seed.backyard_grilling_rawness
backyard_grilling_announcement = seed.backyard_grilling_announcement

update_icon()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/hydroponics/seed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
var/force_layer

// Backyard grilling vars. Not passed through genetics.
var/backyard_grilling_threshold = 5
var/backyard_grilling_rawness = 20
var/backyard_grilling_product = /obj/item/reagent_containers/food/snacks/badrecipe
var/backyard_grilling_announcement = "smokes and chars!"

Expand Down
4 changes: 3 additions & 1 deletion code/modules/materials/materials/organic/wood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
destruction_desc = "splinters"
sheet_singular_name = "plank"
sheet_plural_name = "planks"
var/drying_rack_type = /obj/structure/drying_rack/wood

/datum/material/wood/generate_recipes()
..()
Expand All @@ -42,7 +43,7 @@
new /datum/stack_recipe("coilgun stock", /obj/item/coilgun_assembly, 5, pass_stack_color = TRUE, recycle_material = "[name]"),
new /datum/stack_recipe("crude fishing rod", /obj/item/material/fishing_rod/built, 8, time = 10 SECONDS, pass_stack_color = TRUE, recycle_material = "[name]"),
new /datum/stack_recipe("noticeboard", /obj/structure/noticeboard, 1, recycle_material = "[name]"),
new /datum/stack_recipe("drying rack", /obj/structure/drying_rack, 3, one_per_turf = TRUE, time = 20, on_floor = TRUE, supplied_material = "[name]"),
new /datum/stack_recipe("drying rack", drying_rack_type, 3, one_per_turf = TRUE, time = 20, on_floor = TRUE, supplied_material = "[name]"),
new /datum/stack_recipe("roofing tile", /obj/item/stack/tile/roofing, 3, 4, 20, recycle_material = "[name]"),
new /datum/stack_recipe("shovel", /obj/item/shovel/wood, 2, time = 10, on_floor = TRUE, supplied_material = "[name]")
)
Expand All @@ -52,6 +53,7 @@
stack_type = /obj/item/stack/material/fuel/wood/sif
icon_colour = "#0099cc" // Cyan-ish
stack_origin_tech = list(TECH_MATERIAL = 2, TECH_BIO = 2) // Alien wood would presumably be more interesting to the analyzer.
drying_rack_type = /obj/structure/drying_rack/sifwood

/datum/material/wood/sif/generate_recipes()
..()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
no_variants = FALSE
max_amount = 20
stacktype = "wetleather"
drying_wetness = 30
drying_wetness = 120
dried_type = /obj/item/stack/material/leather

/obj/item/stack/wetleather/get_drying_state(var/obj/rack)
Expand Down
37 changes: 31 additions & 6 deletions code/modules/materials/sheets/organic/tanning/tanning_rack.dm
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
/obj/structure/drying_rack
name = "drying rack"
desc = "A rack used to stretch leather out and hold it taut during the tanning process."
desc = "A rack used to hold meat or vegetables for drying, or to stretch leather out and hold it taut during the tanning process."
icon = 'icons/obj/drying_rack.dmi'
icon_state = "rack"
var/dismantle_product = /obj/item/stack/material/steel
var/dismantle_amount = 3
var/obj/item/drying

/obj/structure/drying_rack/wood
icon_state = "rack_wooden"
dismantle_product = /obj/item/stack/material/fuel/wood

/obj/structure/drying_rack/sifwood
icon_state = "rack_wooden_sif"
dismantle_product = /obj/item/stack/material/fuel/wood/sif

/obj/structure/drying_rack/Initialize()
. = ..()
START_PROCESSING(SSobj, src) // SSObj fires ~every 2s , starting from wetness 30 takes ~1m
Expand Down Expand Up @@ -36,13 +46,28 @@
if(drying_state)
add_overlay(drying_state)

/obj/structure/drying_rack/attackby(var/obj/item/I, var/mob/user)
if(istype(I) && I.is_dryable() && !istype(I, /obj/item/stack/material/fuel))
if(user.unEquip(I))
I.forceMove(src)
drying = I
/obj/structure/drying_rack/attackby(var/obj/item/W, var/mob/user)

if(W.is_wrench())
playsound(src, W.usesound, 75, 1)
visible_message(SPAN_NOTICE("\The [user] begins dismantling \the [src]."))
if(do_after(user, 5 SECONDS * W.toolspeed))
visible_message(SPAN_NOTICE("\The [user] dismantles \the [src]."))
if(drying)
drying.dropInto(loc)
drying = null
if(dismantle_product && dismantle_amount)
new dismantle_product(loc, dismantle_amount)
qdel(src)
return TRUE

if(!drying && W.is_dryable() && !istype(W, /obj/item/stack/material/fuel))
if(user.unEquip(W))
W.forceMove(src)
drying = W
update_icon()
return TRUE

return ..()

/obj/structure/drying_rack/attack_hand(var/mob/user)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/materials/sheets/organic/wood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
drop_sound = 'sound/items/drop/wooden.ogg'
pickup_sound = 'sound/items/pickup/wooden.ogg'
no_variants = FALSE
drying_wetness = 50
drying_wetness = 120
dried_type = /obj/item/stack/material/fuel/wood/dried
bonfire_fuel_time = 3 MINUTES

Expand Down Expand Up @@ -57,7 +57,7 @@
description_info = "Use inhand to craft things, or use a sharp and edged object on this to convert it into two wooden planks."
drop_sound = 'sound/items/drop/wooden.ogg'
pickup_sound = 'sound/items/pickup/wooden.ogg'
drying_wetness = 80
drying_wetness = 180
dried_type = /obj/item/stack/material/fuel/log/dried
bonfire_fuel_time = 4 MINUTES
var/plank_type = /obj/item/stack/material/fuel/wood
Expand Down
Binary file modified icons/obj/drying_rack.dmi
Binary file not shown.
Binary file modified icons/obj/wood_fire.dmi
Binary file not shown.
Loading

0 comments on commit f15bc9b

Please sign in to comment.