Files
Bubberstation/code/__HELPERS/randoms.dm
SkyratBot 810fef5fde [MIRROR] This kills the deep fried foods holder. Refactors deep frying to just make the thing edible but still functional. [MDB IGNORE] (#17848)
* This kills the deep fried foods holder. Refactors deep frying to just make the thing edible but still functional. (#71551)

## About The Pull Request

Refactors deepfrying, removing the gross Deep Fried Foods Holder Object
and replacing it with the edible component.

Now, deep frying a food will simply make the item edible directly. This
means it's still functional and doesn't become a dead item.

This follows the same method that grilling uses when applying its
effects. Tweaks grilling a bit so they line up better. Also, silver
foods can make grilled items.

![image](https://user-images.githubusercontent.com/51863163/204105022-ee66889b-f843-4dc2-b0dc-5f1eb5ba19c3.png)

I swear this is unrelated to the other 2 fried foods related PRs. I
started this a few weeks ago.

## Why It's Good For The Game

Tangibly better code (doesn't have to copy a million vars! Less
abusable!) at the price of removing a soulful piece of code. Also means
that deep frying an item doesn't irreversibly make it unusable / dead.
This is sad, but... damn the holder object sucks.

Unfortunate side effect is that anything that overrides `attack` to not
send signal will *not* be edible when deepfried. Maybe this encourages
better signal use?

Either that or fried foods can override `pre_attack` to hook directly
into eating. I can do that as well.

## Changelog

🆑 Melbert
refactor: Refactored deep fried foods. Deep fried foods are still
""usable"" as their normal item, but are just edible.
qol: Silver Slime stuff can spawn grilled as well as fried.
/🆑

* This kills the deep fried foods holder. Refactors deep frying to just make the thing edible but still functional.

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
2022-12-01 01:11:20 +00:00

58 lines
1.9 KiB
Plaintext

///Get a random food item exluding the blocked ones
/proc/get_random_food()
var/static/list/allowed_food = list()
if(!LAZYLEN(allowed_food)) //it's static so we only ever do this once
var/list/blocked = list(
/obj/item/food/drug,
/obj/item/food/spaghetti,
/obj/item/food/bread,
/obj/item/food/breadslice,
/obj/item/food/cake,
/obj/item/food/cakeslice,
/obj/item/food/pie,
/obj/item/food/pieslice,
/obj/item/food/kebab,
/obj/item/food/pizza,
/obj/item/food/pizzaslice,
/obj/item/food/salad,
/obj/item/food/meat,
/obj/item/food/meat/slab,
/obj/item/food/soup,
/obj/item/food/grown,
/obj/item/food/grown/mushroom,
/obj/item/food/clothing,
/obj/item/food/meat/slab/human/mutant,
/obj/item/food/grown/ash_flora,
/obj/item/food/grown/nettle,
/obj/item/food/grown/shell
)
var/list/unfiltered_allowed_food = subtypesof(/obj/item/food) - blocked
for(var/obj/item/food/food as anything in unfiltered_allowed_food)
if(!initial(food.icon_state)) //food with no icon_state should probably not be spawned
continue
allowed_food.Add(food)
return pick(allowed_food)
///Gets a random drink excluding the blocked type
/proc/get_random_drink()
var/list/blocked = list(
/obj/item/reagent_containers/cup/soda_cans,
/obj/item/reagent_containers/cup/glass/bottle
)
return pick(subtypesof(/obj/item/reagent_containers/cup/glass) - blocked)
///Picks a string of symbols to display as the law number for hacked or ion laws
/proc/ion_num() //! is at the start to prevent us from changing say modes via get_message_mode()
return "![pick("!","@","#","$","%","^","&")][pick("!","@","#","$","%","^","&","*")][pick("!","@","#","$","%","^","&","*")][pick("!","@","#","$","%","^","&","*")]"
///Returns a string for a random nuke code
/proc/random_nukecode()
var/val = rand(0, 99999)
var/str = "[val]"
while(length(str) < 5)
str = "0" + str
. = str