-
Notifications
You must be signed in to change notification settings - Fork 220
/
food_cooking.dm
69 lines (62 loc) · 2.42 KB
/
food_cooking.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/obj/item/chems/food
/// What object type the food cooks into.
var/backyard_grilling_product = /obj/item/chems/food/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"
/// The number of times this object and its ancestors have been grilled. Used for grown foods' roasted chems.
var/backyard_grilling_count = 0
/// Is this ingredient considered meat, fish, veg, etc
var/ingredient_flags = INGREDIENT_FLAG_PLAIN
/obj/item/chems/food/get_dried_product()
drop_plate(get_turf(loc))
if(dried_type == type && !dry)
dry = TRUE
name = "dried [name]"
color = "#aaaaaa"
return src
return ..()
/obj/item/chems/food/is_dryable()
return !dry
/obj/item/chems/food/get_dryness_text(var/obj/rack)
var/moistness = drying_wetness / get_max_drying_wetness()
if(moistness > 0.65)
return "fresh"
if(moistness > 0.35)
return "somewhat dried"
if(moistness)
return "almost dried"
return "dehydrated"
/obj/item/chems/food/dry_out(var/obj/rack, var/drying_power = 1, var/fire_exposed = FALSE, var/silent = FALSE)
return fire_exposed ? grill(rack) : ..()
/obj/item/chems/food/proc/get_grilled_product()
return new backyard_grilling_product(loc)
/obj/item/chems/food/proc/grill(var/atom/heat_source)
if(!backyard_grilling_product || backyard_grilling_rawness <= 0)
return null
backyard_grilling_rawness--
if(backyard_grilling_rawness <= 0)
var/obj/item/product = get_grilled_product()
product.dropInto(loc)
var/obj/item/chems/food/food = product
if(istype(food))
food.backyard_grilling_count = src.backyard_grilling_count + 1
if(backyard_grilling_announcement)
if(istype(product, /obj/item/chems/food/badrecipe))
product.visible_message(SPAN_DANGER("\The [src] [backyard_grilling_announcement]"))
else
product.visible_message("<span class='[backyard_grilling_span]'>\The [src] [backyard_grilling_announcement]</span>")
qdel(src)
return product
/obj/item/chems/food/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"