/
customizables.dm
520 lines (447 loc) · 15.9 KB
/
customizables.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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
#define MAKE_CUSTOM_FOOD(snack_to_add, user, type) \
do {\
var/obj/item/reagent_containers/food/snacks/customizable/custom_snack = new type(get_turf(user));\
custom_snack.add_ingredient(snack_to_add, user); \
user.put_in_active_hand(custom_snack); \
qdel(src);\
} while(FALSE)
/obj/item/reagent_containers/food/snacks/breadslice/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/reagent_containers/food/snacks) && !(W.flags & NODROP))
MAKE_CUSTOM_FOOD(W, user, /obj/item/reagent_containers/food/snacks/customizable/sandwich)
else
..()
/obj/item/reagent_containers/food/snacks/bun/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/reagent_containers/food/snacks) && !(W.flags & NODROP))
MAKE_CUSTOM_FOOD(W, user, /obj/item/reagent_containers/food/snacks/customizable/burger)
/obj/item/reagent_containers/food/snacks/sliceable/flatdough/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/reagent_containers/food/snacks) && !(W.flags & NODROP))
MAKE_CUSTOM_FOOD(W, user, /obj/item/reagent_containers/food/snacks/customizable/pizza)
else
..()
/obj/item/reagent_containers/food/snacks/boiledspaghetti/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/reagent_containers/food/snacks) && !(W.flags & NODROP))
MAKE_CUSTOM_FOOD(W, user, /obj/item/reagent_containers/food/snacks/customizable/pasta)
else
..()
/obj/item/trash/plate/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/reagent_containers/food/snacks) && !(W.flags & NODROP))
MAKE_CUSTOM_FOOD(W, user, /obj/item/reagent_containers/food/snacks/customizable/fullycustom)
else
..()
#undef MAKE_CUSTOM_FOOD
/obj/item/trash/bowl
name = "bowl"
desc = "An empty bowl. Put some food in it to start making a soup."
icon = 'icons/obj/food/custom.dmi'
icon_state = "soup"
/obj/item/trash/bowl/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/reagent_containers/food/snacks) && !(I.flags & NODROP))
var/obj/item/reagent_containers/food/snacks/customizable/soup/S = new(get_turf(user))
S.attackby(I, user, params)
qdel(src)
else
..()
/obj/item/reagent_containers/food/snacks/customizable/sandwich
name = "sandwich"
desc = "A sandwich! A timeless classic."
icon_state = "breadslice"
baseicon = "sandwichcustom"
basename = "sandwich"
/obj/item/reagent_containers/food/snacks/customizable
name = "sandwich"
desc = "A sandwich! A timeless classic."
icon = 'icons/obj/food/custom.dmi'
icon_state = "sandwichcustom"
var/baseicon = "sandwichcustom"
var/basename = "sandwichcustom"
bitesize = 4
/// Do we have a top?
var/top = TRUE
/// The image of the top
var/image/top_image
var/snack_overlays = 1 //Do we stack?
// var/offsetstuff = 1 //Do we offset the overlays?
var/ingredient_limit = 40
var/fullycustom = 0
trash = /obj/item/trash/plate
var/list/ingredients = list()
list_reagents = list("nutriment" = 8)
/obj/item/reagent_containers/food/snacks/customizable/Initialize(mapload)
. = ..()
if(top)
top_image = new(icon, "[baseicon]_top")
add_overlay(top_image)
/obj/item/reagent_containers/food/snacks/customizable/pizza
name = "personal pizza"
desc = "A personalized pan pizza meant for only one person."
icon_state = "personal_pizza"
baseicon = "personal_pizza"
basename = "personal pizza"
snack_overlays = 0
top = 0
tastes = list("crust" = 1, "tomato" = 1, "cheese" = 1)
/obj/item/reagent_containers/food/snacks/customizable/pasta
name = "spaghetti"
desc = "Noodles. With stuff. Delicious."
icon_state = "pasta_bot"
baseicon = "pasta_bot"
basename = "pasta"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/cook/bread
name = "bread"
desc = "Tasty bread."
icon_state = "breadcustom"
baseicon = "breadcustom"
basename = "bread"
snack_overlays = 0
top = 0
tastes = list("bread" = 10)
/obj/item/reagent_containers/food/snacks/customizable/cook/pie
name = "pie"
desc = "Tasty pie."
icon_state = "piecustom"
baseicon = "piecustom"
basename = "pie"
snack_overlays = 0
top = 0
tastes = list("pie" = 1)
/obj/item/reagent_containers/food/snacks/customizable/cook/cake
name = "cake"
desc = "A popular band."
icon_state = "cakecustom"
baseicon = "cakecustom"
basename = "cake"
snack_overlays = 0
top = 0
tastes = list("cake" = 1)
/obj/item/reagent_containers/food/snacks/customizable/cook/jelly
name = "jelly"
desc = "Totally jelly."
icon_state = "jellycustom"
baseicon = "jellycustom"
basename = "jelly"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/cook/donkpocket
name = "donk pocket"
desc = "You wanna put a bangin-Oh nevermind."
icon_state = "donkcustom"
baseicon = "donkcustom"
basename = "donk pocket"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/cook/kebab
name = "kebab"
desc = "Kebab or Kabab?"
icon_state = "kababcustom"
baseicon = "kababcustom"
basename = "kebab"
snack_overlays = 0
top = 0
tastes = list("meat" = 3, "metal" = 1)
/obj/item/reagent_containers/food/snacks/customizable/cook/salad
name = "salad"
desc = "Very tasty."
icon_state = "saladcustom"
baseicon = "saladcustom"
basename = "salad"
snack_overlays = 0
top = 0
tastes = list("leaves" = 1)
/obj/item/reagent_containers/food/snacks/customizable/cook/waffles
name = "waffles"
desc = "Made with love."
icon_state = "wafflecustom"
baseicon = "wafflecustom"
basename = "waffles"
snack_overlays = 0
top = 0
tastes = list("waffles" = 1)
/obj/item/reagent_containers/food/snacks/customizable/candy/cookie
name = "cookie"
desc = "COOKIE!!1!"
icon_state = "cookiecustom"
baseicon = "cookiecustom"
basename = "cookie"
snack_overlays = 0
top = 0
tastes = list("cookie" = 1)
/obj/item/reagent_containers/food/snacks/customizable/candy/cotton
name = "flavored cotton candy"
desc = "Who can take a sunrise, sprinkle it with dew,"
icon_state = "cottoncandycustom"
baseicon = "cottoncandycustom"
basename = "flavored cotton candy"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/candy/gummybear
name = "flavored giant gummy bear"
desc = "Cover it in chocolate and a miracle or two,"
icon_state = "gummybearcustom"
baseicon = "gummybearcustom"
basename = "flavored giant gummy bear"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/candy/gummyworm
name = "flavored giant gummy worm"
desc = "The Candy Man can 'cause he mixes it with love,"
icon_state = "gummywormcustom"
baseicon = "gummywormcustom"
basename = "flavored giant gummy worm"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/candy/jellybean
name = "flavored giant jelly bean"
desc = "And makes the world taste good."
icon_state = "jellybeancustom"
baseicon = "jellybeancustom"
basename = "flavored giant jelly bean"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/candy/jawbreaker
name = "flavored jawbreaker"
desc = "Who can take a rainbow, Wrap it in a sigh,"
icon_state = "jawbreakercustom"
baseicon = "jawbreakercustom"
basename = "flavored jawbreaker"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/candy/candycane
name = "flavored candy cane"
desc = "Soak it in the sun and make strawberry-lemon pie,"
icon_state = "candycanecustom"
baseicon = "candycanecustom"
basename = "flavored candy cane"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/candy/gum
name = "flavored gum"
desc = "The Candy Man can 'cause he mixes it with love and makes the world taste good. And the world tastes good 'cause the Candy Man thinks it should..."
icon_state = "gumcustom"
baseicon = "gumcustom"
basename = "flavored gum"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/candy/donut
name = "filled donut"
desc = "Donut eat this!" // kill me
icon_state = "donutcustom"
baseicon = "donutcustom"
basename = "filled donut"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/candy/bar
name = "flavored chocolate bar"
desc = "Made in a factory downtown."
icon_state = "barcustom"
baseicon = "barcustom"
basename = "flavored chocolate bar"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/candy/sucker
name = "flavored sucker"
desc = "Suck suck suck."
icon_state = "suckercustom"
baseicon = "suckercustom"
basename = "flavored sucker"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/candy/cash
name = "flavored chocolate cash"
desc = "I got piles!"
icon_state = "cashcustom"
baseicon = "cashcustom"
basename = "flavored cash"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/candy/coin
name = "flavored chocolate coin"
desc = "Clink, clink, clink."
icon_state = "coincustom"
baseicon = "coincustom"
basename = "flavored coin"
snack_overlays = 0
top = 0
/obj/item/reagent_containers/food/snacks/customizable/fullycustom // In the event you fuckers find something I forgot to add a customizable food for.
name = "on a plate"
desc = "A unique dish."
icon_state = "fullycustom"
baseicon = "fullycustom"
basename = "on a plate"
snack_overlays = 0
top = 0
ingredient_limit = 20
fullycustom = 1
/obj/item/reagent_containers/food/snacks/customizable/soup
name = "soup"
desc = "A bowl with liquid and... stuff in it."
icon_state = "soup"
baseicon = "soup"
basename = "soup"
consume_sound = 'sound/items/drink.ogg'
snack_overlays = 0
trash = /obj/item/trash/bowl
top = 0
tastes = list("soup" = 1)
/obj/item/reagent_containers/food/snacks/customizable/burger
name = "burger bun"
desc = "A bun for a burger. Delicious."
icon_state = "burgercustom"
baseicon = "burgercustom"
basename = "burger"
tastes = list("bun" = 4)
/obj/item/reagent_containers/food/snacks/customizable/attackby(obj/item/I, mob/user, params)
if(!istype(I, /obj/item/reagent_containers/food/snacks))
to_chat(user, "<span class='warning'>[I] isn't exactly something that you would want to eat.</span>")
return
add_ingredient(I, user)
/**
* Tries to add one ingredient and it's ingredients, if any and applicable, to this snack
*
* Arguments:
* * snack - The ingredient that will be added
*/
/obj/item/reagent_containers/food/snacks/customizable/proc/add_ingredient(obj/item/reagent_containers/food/snacks/snack, mob/user)
if(length(ingredients) > ingredient_limit)
to_chat(user, "<span class='warning'>If you put anything else in or on [src] it's going to make a mess.</span>")
return
// Fully custom snacks don't add the ingredients. So no need to check
if(!fullycustom && istype(snack, /obj/item/reagent_containers/food/snacks/customizable))
var/obj/item/reagent_containers/food/snacks/customizable/origin = snack
if(length(ingredients) + length(origin.ingredients) > ingredient_limit)
to_chat(user, "<span class='warning'>Merging [snack] and [src] together is going to make a mess.</span>")
return
if(!user.unEquip(snack))
to_chat(user, "<span class='warning'>[snack] is stuck to your hand!</span>")
return
to_chat(user, "<span class='notice'>You add [snack] to [src].</span>")
snack.reagents.trans_to(src, snack.reagents.total_volume)
var/list/added_ingredients = list(snack)
// Only merge when it is not fullycustom. Else it looks weird
if(!fullycustom && istype(snack, /obj/item/reagent_containers/food/snacks/customizable))
var/obj/item/reagent_containers/food/snacks/customizable/origin = snack
added_ingredients += origin.ingredients
origin.ingredients.Cut()
origin.name = initial(origin.name) // Reset the name for the examine text
cooktype[basename] = TRUE
snack.forceMove(src)
add_ingredients(added_ingredients)
name = newname()
/**
* Adds a list of ingredients to the existing snack. Updates the overlays as well
*
* Arguments:
* * new_ingredients - The new ingredients to be added
*/
/obj/item/reagent_containers/food/snacks/customizable/proc/add_ingredients(list/new_ingredients)
cut_overlay(top_image) // Remove the top image so we can change it again
var/ingredient_num = length(ingredients)
ingredients += new_ingredients
for(var/obj/item/reagent_containers/food/snacks/food as anything in new_ingredients)
ingredient_num++
var/image/ingredient_image
if(!fullycustom)
ingredient_image = new(icon, "[baseicon]_filling")
if(!food.filling_color == "#FFFFFF")
ingredient_image.color = food.filling_color
else
ingredient_image.color = pick("#FF0000", "#0000FF", "#008000", "#FFFF00")
if(snack_overlays)
ingredient_image.pixel_x = rand(2) - 1
ingredient_image.pixel_y = ingredient_num * 2 + 1
else
ingredient_image = new(food.icon, food.icon_state)
ingredient_image.pixel_x = rand(2) - 1
ingredient_image.pixel_y = rand(2) - 1
add_overlay(food.overlays)
add_overlay(ingredient_image)
if(top_image)
top_image.pixel_x = rand(2) - 1
top_image.pixel_y = ingredient_num * 2 + 1
add_overlay(top_image)
/obj/item/reagent_containers/food/snacks/customizable/Destroy()
QDEL_LIST(ingredients)
qdel(top_image)
return ..()
/obj/item/reagent_containers/food/snacks/customizable/examine(mob/user)
. = ..()
if(LAZYLEN(ingredients))
var/whatsinside = pick(ingredients)
. += "<span class='notice'> You think you can see [whatsinside] in there.</span>"
/obj/item/reagent_containers/food/snacks/customizable/proc/newname()
var/unsorteditems[0]
var/sorteditems[0]
var/unsortedtypes[0]
var/sortedtypes[0]
var/endpart = ""
var/c = 0
var/ci = 0
var/ct = 0
var/seperator = ""
var/sendback = ""
var/list/levels = list("", "double", "triple", "quad", "huge")
for(var/obj/item/ing in ingredients)
if(istype(ing, /obj/item/shard))
continue
if(istype(ing, /obj/item/reagent_containers/food/snacks/customizable)) // split the ingredients into ones with basenames (sandwich, burger, etc) and ones without, keeping track of how many of each there are
var/obj/item/reagent_containers/food/snacks/customizable/gettype = ing
if(unsortedtypes[gettype.basename])
unsortedtypes[gettype.basename]++
if(unsortedtypes[gettype.basename] > ct)
ct = unsortedtypes[gettype.basename]
else
(unsortedtypes[gettype.basename]) = 1
if(unsortedtypes[gettype.basename] > ct)
ct = unsortedtypes[gettype.basename]
else
if(unsorteditems[ing.name])
unsorteditems[ing.name]++
if(unsorteditems[ing.name] > ci)
ci = unsorteditems[ing.name]
else
unsorteditems[ing.name] = 1
if(unsorteditems[ing.name] > ci)
ci = unsorteditems[ing.name]
sorteditems = sortlist(unsorteditems, ci) //order both types going from the lowest number to the highest number
sortedtypes = sortlist(unsortedtypes, ct)
for(var/ings in sorteditems) //add the non-basename items to the name, sorting out the , and the and
c++
if(c == sorteditems.len - 1)
seperator = " and "
else if(c == sorteditems.len)
seperator = " "
else
seperator = ", "
if(sorteditems[ings] > levels.len)
sorteditems[ings] = levels.len
if(sorteditems[ings] <= 1)
sendback +="[ings][seperator]"
else
sendback +="[levels[sorteditems[ings]]] [ings][seperator]"
for(var/ingtype in sortedtypes) // now add the types basenames, keeping the src one seperate so it can go on the end
if(sortedtypes[ingtype] > levels.len)
sortedtypes[ingtype] = levels.len
if(ingtype == basename)
if(sortedtypes[ingtype] < levels.len)
sortedtypes[ingtype]++
endpart = "[levels[sortedtypes[ingtype]]] decker [basename]"
continue
if(sortedtypes[ingtype] >= 2)
sendback += "[levels[sortedtypes[ingtype]]] decker [ingtype] "
else
sendback += "[ingtype] "
if(endpart)
sendback += endpart
else
sendback += basename
if(length(sendback) > 80)
sendback = "[pick(list("absurd","colossal","enormous","ridiculous","massive","oversized","cardiac-arresting","pipe-clogging","edible but sickening","sickening","gargantuan","mega","belly-burster","chest-burster"))] [basename]"
return sendback
/obj/item/reagent_containers/food/snacks/customizable/proc/sortlist(list/unsorted, highest)
var/sorted[0]
for(var/i = 1, i<= highest, i++)
for(var/it in unsorted)
if(unsorted[it] == i)
sorted[it] = i
return sorted