Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds "ants" reagent to foods that have spawned ants & makes fridges ant-safe #19049

Merged
merged 5 commits into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions code/modules/chemistry/tools/food_and_drink.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food)
var/from_emagged_oven = 0 //! Was this food created by an emagged oven? To prevent re-rolling of food in emagged ovens.
var/doants = TRUE //! Will ants spawn to eat this food if it's on the floor
var/tmp/made_ants = FALSE //! Has this food already spawned ants
var/ant_amnt = 5 //! How many ants are added to food / how much reagents removed?
var/sliceable = FALSE //! Can this food be sliced with a knife
var/slice_product = null //! Type to spawn when we slice this food
var/slice_amount = 1 //! How many slices to spawn after slicing
Expand All @@ -40,13 +41,15 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food)
owner.organHolder.stomach.eject(src)
qdel(src)

proc/on_table()
proc/ant_safe()
if (!isturf(src.loc))
return FALSE
if (locate(/obj/table) in src.loc) // locate is faster than typechecking each movable
return TRUE
if (locate(/obj/surgery_tray) in src.loc) // includes kitchen islands
return TRUE
if (locate(/obj/storage/secure/closet/fridge) in src.loc) // includes fridges
return TRUE
return FALSE

proc/get_food_color()
Expand Down Expand Up @@ -189,14 +192,17 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food/snacks)
..()

process()
if ((TIME - create_time >= 3 MINUTES) && (TIME - time_since_moved >= 1 MINUTE))
create_time = TIME
if (!src.disposed && isturf(src.loc) && !on_table())
if ((TIME - src.create_time >= 3 MINUTES) && (TIME - src.time_since_moved >= 1 MINUTE))
src.create_time = TIME
if (!src.disposed && isturf(src.loc) && !src.ant_safe())
if (prob(50))
made_ants = 1
src.made_ants = 1
processing_items -= src
if (!(locate(/obj/reagent_dispensers/cleanable/ants) in src.loc))
new/obj/reagent_dispensers/cleanable/ants(src.loc)
src.reagents.remove_any(src.ant_amnt)
src.reagents.add_reagent("ants", src.ant_amnt)
src.name = "[name_prefix("ant-covered", 1)][src.name][name_suffix(null, 1)]"


attackby(obj/item/W, mob/user)
Expand Down
Loading