/
condiment.dm
370 lines (324 loc) · 16.8 KB
/
condiment.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
///////////////////////////////////////////////Condiments
//Notes by Darem: The condiments food-subtype is for stuff you don't actually eat but you use to modify existing food. They all
// leave empty containers when used up and can be filled/re-filled with other items. Formatting for first section is identical
// to mixed-drinks code. If you want an object that starts pre-loaded, you need to make it in addition to the other code.
//Food items that aren't eaten normally and leave an empty container behind.
/obj/item/reagent_containers/food/condiment
name = "condiment bottle"
desc = "Just your average condiment bottle."
icon = 'icons/obj/food/containers.dmi'
icon_state = "emptycondiment"
inhand_icon_state = "beer" //Generic held-item sprite until unique ones are made.
lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi'
reagent_flags = OPENCONTAINER
obj_flags = UNIQUE_RENAME
possible_transfer_amounts = list(1, 5, 10, 15, 20, 25, 30, 50)
volume = 50
fill_icon_thresholds = list(0, 10, 25, 50, 75, 100)
/// Icon (icon_state) to be used when container becomes empty (no change if falsy)
var/icon_empty
/// Holder for original icon_state value if it was overwritten by icon_emty to change back to
var/icon_preempty
/obj/item/reagent_containers/food/condiment/update_icon_state()
. = ..()
if(reagents.reagent_list.len)
if(icon_preempty)
icon_state = icon_preempty
icon_preempty = null
return ..()
if(icon_empty && !icon_preempty)
icon_preempty = icon_state
icon_state = icon_empty
return ..()
/obj/item/reagent_containers/food/condiment/suicide_act(mob/living/carbon/user)
user.visible_message("<span class='suicide'>[user] is trying to eat the entire [src]! It looks like [user.p_they()] forgot how food works!</span>")
return OXYLOSS
/obj/item/reagent_containers/food/condiment/attack(mob/M, mob/user, def_zone)
if(!reagents || !reagents.total_volume)
to_chat(user, "<span class='warning'>None of [src] left, oh no!</span>")
return FALSE
if(!canconsume(M, user))
return FALSE
if(M == user)
user.visible_message("<span class='notice'>[user] swallows some of the contents of \the [src].</span>", \
"<span class='notice'>You swallow some of the contents of \the [src].</span>")
else
M.visible_message("<span class='warning'>[user] attempts to feed [M] from [src].</span>", \
"<span class='warning'>[user] attempts to feed you from [src].</span>")
if(!do_mob(user, M))
return
if(!reagents || !reagents.total_volume)
return // The condiment might be empty after the delay.
M.visible_message("<span class='warning'>[user] fed [M] from [src].</span>", \
"<span class='warning'>[user] fed you from [src].</span>")
log_combat(user, M, "fed", reagents.log_list())
reagents.trans_to(M, 10, transfered_by = user, methods = INGEST)
playsound(M.loc,'sound/items/drink.ogg', rand(10,50), TRUE)
return TRUE
/obj/item/reagent_containers/food/condiment/afterattack(obj/target, mob/user , proximity)
. = ..()
if(!proximity)
return
if(istype(target, /obj/structure/reagent_dispensers)) //A dispenser. Transfer FROM it TO us.
if(!target.reagents.total_volume)
to_chat(user, "<span class='warning'>[target] is empty!</span>")
return
if(reagents.total_volume >= reagents.maximum_volume)
to_chat(user, "<span class='warning'>[src] is full!</span>")
return
var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this, transfered_by = user)
to_chat(user, "<span class='notice'>You fill [src] with [trans] units of the contents of [target].</span>")
//Something like a glass or a food item. Player probably wants to transfer TO it.
else if(target.is_drainable() || IS_EDIBLE(target))
if(!reagents.total_volume)
to_chat(user, "<span class='warning'>[src] is empty!</span>")
return
if(target.reagents.total_volume >= target.reagents.maximum_volume)
to_chat(user, "<span class='warning'>you can't add anymore to [target]!</span>")
return
var/trans = src.reagents.trans_to(target, amount_per_transfer_from_this, transfered_by = user)
to_chat(user, "<span class='notice'>You transfer [trans] units of the condiment to [target].</span>")
/obj/item/reagent_containers/food/condiment/enzyme
name = "universal enzyme"
desc = "Used in cooking various dishes."
icon_state = "enzyme"
list_reagents = list(/datum/reagent/consumable/enzyme = 50)
fill_icon_thresholds = null
/obj/item/reagent_containers/food/condiment/enzyme/examine(mob/user)
. = ..()
var/datum/chemical_reaction/recipe = GLOB.chemical_reactions_list[/datum/chemical_reaction/food/cheesewheel]
var/milk_required = recipe.required_reagents[/datum/reagent/consumable/milk]
var/enzyme_required = recipe.required_catalysts[/datum/reagent/consumable/enzyme]
. += "<span class='notice'>[milk_required] milk, [enzyme_required] enzyme and you got cheese.</span>"
. += "<span class='warning'>Remember, the enzyme isn't used up, so return it to the bottle, dingus!</span>"
/obj/item/reagent_containers/food/condiment/sugar
name = "sugar sack"
desc = "Tasty spacey sugar!"
icon_state = "sugar"
inhand_icon_state = "carton"
lefthand_file = 'icons/mob/inhands/equipment/kitchen_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/kitchen_righthand.dmi'
list_reagents = list(/datum/reagent/consumable/sugar = 50)
fill_icon_thresholds = null
/obj/item/reagent_containers/food/condiment/sugar/examine(mob/user)
. = ..()
var/datum/chemical_reaction/recipe = GLOB.chemical_reactions_list[/datum/chemical_reaction/food/cakebatter]
var/flour_required = recipe.required_reagents[/datum/reagent/consumable/flour]
var/eggyolk_required = recipe.required_reagents[/datum/reagent/consumable/eggyolk]
var/sugar_required = recipe.required_reagents[/datum/reagent/consumable/sugar]
. += "<span class='notice'>[flour_required] flour, [eggyolk_required] egg yolk (or soy milk), [sugar_required] sugar makes cake dough. You can make pie dough from it.</span>"
/obj/item/reagent_containers/food/condiment/saltshaker //Separate from above since it's a small shaker rather then
name = "salt shaker" // a large one.
desc = "Salt. From space oceans, presumably."
icon_state = "saltshakersmall"
icon_empty = "emptyshaker"
inhand_icon_state = ""
possible_transfer_amounts = list(1,20) //for clown turning the lid off
amount_per_transfer_from_this = 1
volume = 20
list_reagents = list(/datum/reagent/consumable/salt = 20)
fill_icon_thresholds = null
/obj/item/reagent_containers/food/condiment/saltshaker/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] begins to swap forms with the salt shaker! It looks like [user.p_theyre()] trying to commit suicide!</span>")
var/newname = "[name]"
name = "[user.name]"
user.name = newname
user.real_name = newname
desc = "Salt. From dead crew, presumably."
return (TOXLOSS)
/obj/item/reagent_containers/food/condiment/saltshaker/afterattack(obj/target, mob/living/user, proximity)
. = ..()
if(!proximity)
return
if(isturf(target))
if(!reagents.has_reagent(/datum/reagent/consumable/salt, 2))
to_chat(user, "<span class='warning'>You don't have enough salt to make a pile!</span>")
return
user.visible_message("<span class='notice'>[user] shakes some salt onto [target].</span>", "<span class='notice'>You shake some salt onto [target].</span>")
reagents.remove_reagent(/datum/reagent/consumable/salt, 2)
new/obj/effect/decal/cleanable/food/salt(target)
return
/obj/item/reagent_containers/food/condiment/peppermill
name = "pepper mill"
desc = "Often used to flavor food or make people sneeze."
icon_state = "peppermillsmall"
icon_empty = "emptyshaker"
inhand_icon_state = ""
possible_transfer_amounts = list(1,20) //for clown turning the lid off
amount_per_transfer_from_this = 1
volume = 20
list_reagents = list(/datum/reagent/consumable/blackpepper = 20)
fill_icon_thresholds = null
/obj/item/reagent_containers/food/condiment/milk
name = "space milk"
desc = "It's milk. White and nutritious goodness!"
icon_state = "milk"
inhand_icon_state = "carton"
lefthand_file = 'icons/mob/inhands/equipment/kitchen_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/kitchen_righthand.dmi'
list_reagents = list(/datum/reagent/consumable/milk = 50)
fill_icon_thresholds = null
/obj/item/reagent_containers/food/condiment/milk/examine(mob/user)
. = ..()
var/datum/chemical_reaction/recipe = GLOB.chemical_reactions_list[/datum/chemical_reaction/food/cheesewheel]
var/milk_required = recipe.required_reagents[/datum/reagent/consumable/milk]
var/enzyme_required = recipe.required_catalysts[/datum/reagent/consumable/enzyme]
. += "<span class='notice'>[milk_required] milk, [enzyme_required] enzyme and you got cheese.</span>"
. += "<span class='warning'>Remember, the enzyme isn't used up, so return it to the bottle, dingus!</span>"
/obj/item/reagent_containers/food/condiment/flour
name = "flour sack"
desc = "A big bag of flour. Good for baking!"
icon_state = "flour"
inhand_icon_state = "carton"
lefthand_file = 'icons/mob/inhands/equipment/kitchen_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/kitchen_righthand.dmi'
list_reagents = list(/datum/reagent/consumable/flour = 30)
fill_icon_thresholds = null
/obj/item/reagent_containers/food/condiment/flour/examine(mob/user)
. = ..()
var/datum/chemical_reaction/recipe_dough = GLOB.chemical_reactions_list[/datum/chemical_reaction/food/dough]
var/datum/chemical_reaction/recipe_cakebatter = GLOB.chemical_reactions_list[/datum/chemical_reaction/food/cakebatter]
var/dough_flour_required = recipe_dough.required_reagents[/datum/reagent/consumable/flour]
var/dough_water_required = recipe_dough.required_reagents[/datum/reagent/water]
var/cakebatter_flour_required = recipe_cakebatter.required_reagents[/datum/reagent/consumable/flour]
var/cakebatter_eggyolk_required = recipe_cakebatter.required_reagents[/datum/reagent/consumable/eggyolk]
var/cakebatter_sugar_required = recipe_cakebatter.required_reagents[/datum/reagent/consumable/sugar]
. += "<b><i>You retreat inward and recall the teachings of... Making Dough...</i></b>"
. += "<span class='notice'>[dough_flour_required] flour, [dough_water_required] water makes normal dough. You can make flat dough from it.</span>"
. += "<span class='notice'>[cakebatter_flour_required] flour, [cakebatter_eggyolk_required] egg yolk (or soy milk), [cakebatter_sugar_required] sugar makes cake dough. You can make pie dough from it.</span>"
/obj/item/reagent_containers/food/condiment/soymilk
name = "soy milk"
desc = "It's soy milk. White and nutritious goodness!"
icon_state = "soymilk"
inhand_icon_state = "carton"
lefthand_file = 'icons/mob/inhands/equipment/kitchen_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/kitchen_righthand.dmi'
list_reagents = list(/datum/reagent/consumable/soymilk = 50)
fill_icon_thresholds = null
/obj/item/reagent_containers/food/condiment/rice
name = "rice sack"
desc = "A big bag of rice. Good for cooking!"
icon_state = "rice"
inhand_icon_state = "carton"
lefthand_file = 'icons/mob/inhands/equipment/kitchen_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/kitchen_righthand.dmi'
list_reagents = list(/datum/reagent/consumable/rice = 30)
fill_icon_thresholds = null
/obj/item/reagent_containers/food/condiment/bbqsauce
name = "bbq sauce"
desc = "Hand wipes not included."
icon_state = "bbqsauce"
list_reagents = list(/datum/reagent/consumable/bbqsauce = 50)
/obj/item/reagent_containers/food/condiment/soysauce
name = "soy sauce"
desc = "A salty soy-based flavoring."
icon_state = "soysauce"
list_reagents = list(/datum/reagent/consumable/soysauce = 50)
fill_icon_thresholds = null
/obj/item/reagent_containers/food/condiment/mayonnaise
name = "mayonnaise"
desc = "An oily condiment made from egg yolks."
icon_state = "mayonnaise"
list_reagents = list(/datum/reagent/consumable/mayonnaise = 50)
fill_icon_thresholds = null
/obj/item/reagent_containers/food/condiment/vinegar
name = "vinegar"
desc = "Perfect for chips, if you're feeling Space British."
icon_state = "vinegar"
list_reagents = list(/datum/reagent/consumable/vinegar = 50)
fill_icon_thresholds = null
/obj/item/reagent_containers/food/condiment/quality_oil
name = "quality oil"
desc = "For the fancy chef inside everyone."
icon_state = "oliveoil"
list_reagents = list(/datum/reagent/consumable/quality_oil = 50)
fill_icon_thresholds = null
//Food packs. To easily apply deadly toxi... delicious sauces to your food!
/obj/item/reagent_containers/food/condiment/pack
name = "condiment pack"
desc = "A small plastic pack with condiments to put on your food."
icon_state = "condi_empty"
volume = 10
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(10)
/**
* List of possible styles (list(<icon_state>, <name>, <desc>)) for condiment packs.
* Since all of them differs only in color should probably be replaced with usual reagentfillings instead
*/
var/list/possible_states = list(
/datum/reagent/consumable/ketchup = list("condi_ketchup", "Ketchup", "You feel more American already."),
/datum/reagent/consumable/capsaicin = list("condi_hotsauce", "Hotsauce", "You can almost TASTE the stomach ulcers now!"),
/datum/reagent/consumable/soysauce = list("condi_soysauce", "Soy Sauce", "A salty soy-based flavoring"),
/datum/reagent/consumable/frostoil = list("condi_frostoil", "Coldsauce", "Leaves the tongue numb in its passage"),
/datum/reagent/consumable/salt = list("condi_salt", "Salt Shaker", "Salt. From space oceans, presumably"),
/datum/reagent/consumable/blackpepper = list("condi_pepper", "Pepper Mill", "Often used to flavor food or make people sneeze"),
/datum/reagent/consumable/cornoil = list("condi_cornoil", "Corn Oil", "A delicious oil used in cooking. Made from corn"),
/datum/reagent/consumable/sugar = list("condi_sugar", "Sugar", "Tasty spacey sugar!"),
/datum/reagent/consumable/astrotame = list("condi_astrotame", "Astrotame", "The sweetness of a thousand sugars but none of the calories."),
/datum/reagent/consumable/bbqsauce = list("condi_bbq", "BBQ sauce", "Hand wipes not included."),
)
/// Can't use initial(name) for this. This stores the name set by condimasters.
var/originalname = "condiment"
/obj/item/reagent_containers/food/condiment/pack/create_reagents(max_vol, flags)
. = ..()
RegisterSignal(reagents, list(COMSIG_REAGENTS_NEW_REAGENT, COMSIG_REAGENTS_ADD_REAGENT, COMSIG_REAGENTS_REM_REAGENT), .proc/on_reagent_add, TRUE)
RegisterSignal(reagents, COMSIG_REAGENTS_DEL_REAGENT, .proc/on_reagent_del, TRUE)
/obj/item/reagent_containers/food/condiment/pack/update_icon()
SHOULD_CALL_PARENT(FALSE)
return
/obj/item/reagent_containers/food/condiment/pack/attack(mob/M, mob/user, def_zone) //Can't feed these to people directly.
return
/obj/item/reagent_containers/food/condiment/pack/afterattack(obj/target, mob/user , proximity)
if(!proximity)
return
//You can tear the bag open above food to put the condiments on it, obviously.
if(IS_EDIBLE(target))
if(!reagents.total_volume)
to_chat(user, "<span class='warning'>You tear open [src], but there's nothing in it.</span>")
qdel(src)
return
if(target.reagents.total_volume >= target.reagents.maximum_volume)
to_chat(user, "<span class='warning'>You tear open [src], but [target] is stacked so high that it just drips off!</span>" )
qdel(src)
return
else
to_chat(user, "<span class='notice'>You tear open [src] above [target] and the condiments drip onto it.</span>")
src.reagents.trans_to(target, amount_per_transfer_from_this, transfered_by = user)
qdel(src)
return
. = ..()
/// Handles reagents getting added to the condiment pack.
/obj/item/reagent_containers/food/condiment/pack/proc/on_reagent_add(datum/reagents/reagents)
SIGNAL_HANDLER
var/main_reagent = reagents.get_master_reagent_id()
if(main_reagent in possible_states)
var/list/temp_list = possible_states[main_reagent]
icon_state = temp_list[1]
desc = temp_list[3]
else
icon_state = "condi_mixed"
desc = "A small condiment pack. The label says it contains [originalname]"
/// Handles reagents getting removed from the condiment pack.
/obj/item/reagent_containers/food/condiment/pack/proc/on_reagent_del(datum/reagents/reagents)
SIGNAL_HANDLER
icon_state = "condi_empty"
desc = "A small condiment pack. It is empty."
//Ketchup
/obj/item/reagent_containers/food/condiment/pack/ketchup
name = "ketchup pack"
originalname = "ketchup"
list_reagents = list(/datum/reagent/consumable/ketchup = 10)
//Hot sauce
/obj/item/reagent_containers/food/condiment/pack/hotsauce
name = "hotsauce pack"
originalname = "hotsauce"
list_reagents = list(/datum/reagent/consumable/capsaicin = 10)
/obj/item/reagent_containers/food/condiment/pack/astrotame
name = "astrotame pack"
originalname = "astrotame"
list_reagents = list(/datum/reagent/consumable/astrotame = 5)
/obj/item/reagent_containers/food/condiment/pack/bbqsauce
name = "bbq sauce pack"
originalname = "bbq sauce"
list_reagents = list(/datum/reagent/consumable/bbqsauce = 10)