From dc629eb29e19e6a8a04940cce572a3158b4ac2b6 Mon Sep 17 00:00:00 2001
From: CRUNCH <143041327+Fordoxia@users.noreply.github.com>
Date: Tue, 19 Aug 2025 07:53:49 +0100
Subject: [PATCH] Migrates `obj/item/food` to the new Attack Chain (#29860)
* Creation
* Update food_base.dm
* FUCKING IF SPACE
* plants
* more plant
* Update tomato.dm
* Update root.dm
---
.../food_and_drinks/food/customizables.dm | 54 +++++-----
.../food_and_drinks/food/foods/ingredients.dm | 79 +++++++++------
.../food_and_drinks/food/foods/junkfood.dm | 6 +-
.../food_and_drinks/food/foods/meat.dm | 99 ++++++++++---------
.../food_and_drinks/food/foods/side_dishes.dm | 13 ++-
code/modules/food_and_drinks/food_base.dm | 85 ++++++++--------
code/modules/hydroponics/grown.dm | 52 ++++++----
code/modules/hydroponics/grown/cereals.dm | 12 ++-
code/modules/hydroponics/grown/citrus.dm | 11 ++-
.../modules/hydroponics/grown/grass_carpet.dm | 6 +-
code/modules/hydroponics/grown/herbals.dm | 12 ++-
code/modules/hydroponics/grown/misc_seeds.dm | 11 ++-
code/modules/hydroponics/grown/mushrooms.dm | 31 ++++--
code/modules/hydroponics/grown/nymph.dm | 8 +-
code/modules/hydroponics/grown/potato.dm | 21 ++--
code/modules/hydroponics/grown/pumpkin.dm | 16 +--
code/modules/hydroponics/grown/root.dm | 21 ++--
code/modules/hydroponics/grown/tomato.dm | 23 +++--
18 files changed, 332 insertions(+), 228 deletions(-)
diff --git a/code/modules/food_and_drinks/food/customizables.dm b/code/modules/food_and_drinks/food/customizables.dm
index 89285c0bb01..0c2b072b031 100644
--- a/code/modules/food_and_drinks/food/customizables.dm
+++ b/code/modules/food_and_drinks/food/customizables.dm
@@ -6,32 +6,31 @@ do {\
qdel(src);\
} while(FALSE)
-/obj/item/food/sliced/bread/attackby__legacy__attackchain(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/food) && !(W.flags & NODROP))
- MAKE_CUSTOM_FOOD(W, user, /obj/item/food/customizable/sandwich)
- return
+/obj/item/food/sliced/bread/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(istype(used, /obj/item/food) && !(used.flags & NODROP))
+ MAKE_CUSTOM_FOOD(used, user, /obj/item/food/customizable/sandwich)
+ return ITEM_INTERACT_COMPLETE
..()
-/obj/item/food/bun/attackby__legacy__attackchain(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/food) && !(W.flags & NODROP))
- MAKE_CUSTOM_FOOD(W, user, /obj/item/food/customizable/burger)
- return
+/obj/item/food/bun/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(istype(used, /obj/item/food) && !(used.flags & NODROP))
+ MAKE_CUSTOM_FOOD(used, user, /obj/item/food/customizable/burger)
+ return ITEM_INTERACT_COMPLETE
..()
-/obj/item/food/sliceable/flatdough/attackby__legacy__attackchain(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/food) && !(W.flags & NODROP))
- MAKE_CUSTOM_FOOD(W, user, /obj/item/food/customizable/pizza)
- return
+/obj/item/food/sliceable/flatdough/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+
+ if(istype(used, /obj/item/food) && !(used.flags & NODROP))
+ MAKE_CUSTOM_FOOD(used, user, /obj/item/food/customizable/pizza)
+ return ITEM_INTERACT_COMPLETE
..()
-
-/obj/item/food/boiledspaghetti/attackby__legacy__attackchain(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/food) && !(W.flags & NODROP))
- MAKE_CUSTOM_FOOD(W, user, /obj/item/food/customizable/pasta)
- return
+/obj/item/food/boiledspaghetti/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(istype(used, /obj/item/food) && !(used.flags & NODROP))
+ MAKE_CUSTOM_FOOD(used, user, /obj/item/food/customizable/pasta)
+ return ITEM_INTERACT_COMPLETE
..()
-
/obj/item/trash/plate/attackby__legacy__attackchain(obj/item/W, mob/user, params)
if(istype(W, /obj/item/food) && !(W.flags & NODROP))
MAKE_CUSTOM_FOOD(W, user, /obj/item/food/customizable/fullycustom)
@@ -49,7 +48,7 @@ do {\
/obj/item/trash/bowl/attackby__legacy__attackchain(obj/item/I, mob/user, params)
if(istype(I, /obj/item/food) && !(I.flags & NODROP))
var/obj/item/food/customizable/soup/S = new(get_turf(user))
- S.attackby__legacy__attackchain(I, user, params)
+ S.item_interaction(I, user, params)
qdel(src)
else
..()
@@ -322,17 +321,16 @@ do {\
tastes = list("bun" = 4)
-/obj/item/food/customizable/attackby__legacy__attackchain(obj/item/I, mob/user, params)
- ..()
+/obj/item/food/customizable/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(istype(used, /obj/item/kitchen/utensil) || is_pen(used))
+ return ..()
- if(istype(I, /obj/item/kitchen/utensil) || is_pen(I))
- return
+ if(!istype(used, /obj/item/food))
+ to_chat(user, "[used] isn't exactly something that you would want to eat.")
+ return ITEM_INTERACT_COMPLETE
- if(!istype(I, /obj/item/food))
- to_chat(user, "[I] isn't exactly something that you would want to eat.")
- return
-
- add_ingredient(I, user)
+ add_ingredient(used, user)
+ return ITEM_INTERACT_COMPLETE
/**
* Tries to add one ingredient and it's ingredients, if any and applicable, to this snack
diff --git a/code/modules/food_and_drinks/food/foods/ingredients.dm b/code/modules/food_and_drinks/food/foods/ingredients.dm
index af302b5f5cc..8e4f4a053da 100644
--- a/code/modules/food_and_drinks/food/foods/ingredients.dm
+++ b/code/modules/food_and_drinks/food/foods/ingredients.dm
@@ -189,16 +189,17 @@
tastes = list("dough" = 1)
// Dough + rolling pin = flat dough
-/obj/item/food/dough/attackby__legacy__attackchain(obj/item/I, mob/user, params)
- if(istype(I, /obj/item/kitchen/rollingpin))
- if(isturf(loc))
- new /obj/item/food/sliceable/flatdough(loc)
- to_chat(user, "You flatten [src].")
- qdel(src)
- else
- to_chat(user, "You need to put [src] on a surface to roll it out!")
+/obj/item/food/dough/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(!istype(used, /obj/item/kitchen/rollingpin))
+ return NONE
+
+ if(isturf(loc))
+ new /obj/item/food/sliceable/flatdough(loc)
+ to_chat(user, "You flatten [src].")
+ qdel(src)
else
- ..()
+ to_chat(user, "You need to put [src] on a surface to roll it out!")
+ return ITEM_INTERACT_COMPLETE
// slicable into 3xdoughslices
/obj/item/food/sliceable/flatdough
@@ -244,23 +245,34 @@
icon_state = "cookiedough"
// Dough + rolling pin = flat cookie dough // Flat dough + circular cutter = unbaked cookies
-/obj/item/food/cookiedough/attackby__legacy__attackchain(obj/item/I, mob/user, params)
- if(istype(I, /obj/item/kitchen/rollingpin) && !flat)
+/obj/item/food/cookiedough/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(istype(used, /obj/item/kitchen/rollingpin))
+ if(flat)
+ to_chat(user, "[src] doesn't need to be flattened any further!")
+ return ITEM_INTERACT_COMPLETE
+
if(isturf(loc))
to_chat(user, "You flatten [src].")
flat = TRUE
update_appearance(UPDATE_NAME|UPDATE_ICON_STATE)
else
- to_chat(user, "You need to put [src] on a surface to roll it out!")
- else if(istype(I, /obj/item/kitchen/cutter) && flat)
+ to_chat(user, "You need to put [src] on a surface to roll it out!")
+ return ITEM_INTERACT_COMPLETE
+
+ if(istype(used, /obj/item/kitchen/cutter))
+ if(!flat)
+ to_chat(user, "[src] needs to be flattened first!")
+ return ITEM_INTERACT_COMPLETE
+
if(isturf(loc))
new /obj/item/food/rawcookies(loc)
to_chat(user, "You cut [src] into cookies.")
qdel(src)
else
- to_chat(user, "You need to put [src] on a surface to cut it out!")
- else
- return ..()
+ to_chat(user, "You need to put [src] on a surface to cut it out!")
+ return ITEM_INTERACT_COMPLETE
+
+ return NONE
/obj/item/food/rawcookies
@@ -270,17 +282,19 @@
icon_state = "unbaked_cookies"
list_reagents = list("nutriment" = 5, "sugar" = 5)
-/obj/item/food/rawcookies/attackby__legacy__attackchain(obj/item/I, mob/user, params)
- if(istype(I, /obj/item/food/choc_pile))
+/obj/item/food/rawcookies/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(istype(used, /obj/item/food/choc_pile))
if(isturf(loc))
new /obj/item/food/rawcookies/chocochips(loc)
- to_chat(user, "You sprinkle [I] all over the cookies.")
+ to_chat(user, "You sprinkle [used] all over the cookies.")
qdel(src)
- qdel(I)
+ qdel(used)
else
- to_chat(user, "You need to put [src] on a surface to add this")
- else
- return ..()
+ to_chat(user, "You need to put [src] on a surface to add [used]!")
+ return ITEM_INTERACT_COMPLETE
+
+ return NONE
+
/obj/item/food/rawcookies/chocochips
desc = "Ready for oven! They have little pieces of chocolate all over them"
@@ -302,16 +316,17 @@
goal_difficulty = FOOD_GOAL_EASY
///Chocolate crumbles/pile
-/obj/item/food/chocolatebar/attackby__legacy__attackchain(obj/item/I, mob/user, params)
- if(istype(I, /obj/item/kitchen/knife))
- if(isturf(loc))
- new /obj/item/food/choc_pile(loc)
- to_chat(user, "You cut [src] into little crumbles.")
- qdel(src)
- else
- to_chat(user, "You need to put [src] on a surface to cut it out!")
+/obj/item/food/chocolatebar/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(!istype(used, /obj/item/kitchen/knife))
+ return NONE
+
+ if(isturf(loc))
+ new /obj/item/food/choc_pile(loc)
+ to_chat(user, "You cut [src] into little crumbles.")
+ qdel(src)
else
- return ..()
+ to_chat(user, "You need to put [src] on a surface to cut it out!")
+ return ITEM_INTERACT_COMPLETE
/// for reagent chocolate being spilled on turfs
diff --git a/code/modules/food_and_drinks/food/foods/junkfood.dm b/code/modules/food_and_drinks/food/foods/junkfood.dm
index 4a31ee24b66..5b55d6bc33c 100644
--- a/code/modules/food_and_drinks/food/foods/junkfood.dm
+++ b/code/modules/food_and_drinks/food/foods/junkfood.dm
@@ -111,7 +111,10 @@
list_reagents = list("nutriment" = 2, "sugar" = 10)
tastes = list("sweetness" = 3, "liquorice" = 2)
-/obj/item/food/twimsts/attack_self__legacy__attackchain(mob/user)
+/obj/item/food/twimsts/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
var/obj/item/restraints/handcuffs/twimsts/L = new /obj/item/restraints/handcuffs/twimsts
L.create_reagents(100)
reagents.copy_to(L, reagents.total_volume)
@@ -120,6 +123,7 @@
user.drop_item_to_ground(trash_item)
user.put_in_hands(L)
qdel(src)
+ return ITEM_INTERACT_COMPLETE
/obj/item/food/deluxe_chocolate_bar
name = "Deluxe Chocolate-bar"
diff --git a/code/modules/food_and_drinks/food/foods/meat.dm b/code/modules/food_and_drinks/food/foods/meat.dm
index ff88f8dc3a9..e51708c4cb3 100644
--- a/code/modules/food_and_drinks/food/foods/meat.dm
+++ b/code/modules/food_and_drinks/food/foods/meat.dm
@@ -15,18 +15,19 @@
ingredient_name = "slab of meat"
ingredient_name_plural = "slabs of meat"
-/obj/item/food/meat/attackby__legacy__attackchain(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/kitchen/knife) || istype(W, /obj/item/scalpel))
- new /obj/item/food/rawcutlet(src)
- new /obj/item/food/rawcutlet(src)
- new /obj/item/food/rawcutlet(src)
- user.visible_message( \
- "[user] cuts [src] with [W]!", \
- "You cut [src] with [W]!" \
- )
- qdel(src)
- else
- ..()
+/obj/item/food/meat/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(!istype(used, /obj/item/kitchen/knife) && !istype(used, /obj/item/scalpel))
+ return NONE
+
+ new /obj/item/food/rawcutlet(src)
+ new /obj/item/food/rawcutlet(src)
+ new /obj/item/food/rawcutlet(src)
+ user.visible_message(
+ "[user] cuts [src] with [used]!",
+ "You cut [src] with [used]!"
+ )
+ qdel(src)
+ return ITEM_INTERACT_COMPLETE
/obj/item/food/meat/syntiflesh
name = "synthetic meat"
@@ -97,21 +98,22 @@
bitesize = 1
list_reagents = list("protein" = 1)
-/obj/item/food/rawcutlet/attackby__legacy__attackchain(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/kitchen/knife) || istype(W, /obj/item/scalpel))
- user.visible_message( \
- "[user] cuts the raw cutlet with [W]!", \
- "You cut the raw cutlet with [W]!" \
- )
- var/obj/item/food/raw_bacon/bacon = new(get_turf(src))
- if(ishuman(loc))
- var/mob/living/carbon/human/H = loc
- qdel(src)
- H.put_in_hands(bacon)
- else
- qdel(src)
+/obj/item/food/rawcutlet/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(!istype(used, /obj/item/kitchen/knife) && !istype(used, /obj/item/scalpel))
+ return NONE
- return ..()
+ user.visible_message(
+ "[user] cuts the raw cutlet with [used]!",
+ "You cut the raw cutlet with [used]!"
+ )
+ var/obj/item/food/raw_bacon/bacon = new(get_turf(src))
+ if(ishuman(loc))
+ var/mob/living/carbon/human/H = loc
+ qdel(src)
+ H.put_in_hands(bacon)
+ else
+ qdel(src)
+ return ITEM_INTERACT_COMPLETE
//////////////////////////
// Monster Meat //
@@ -270,7 +272,10 @@
. = ..()
. += "Use it in hand to shape it into a raw meatball."
-/obj/item/food/meat/patty_raw/attack_self__legacy__attackchain(mob/user)
+/obj/item/food/meat/patty_raw/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
user.visible_message(
"[user] shapes [src] into a raw meatball.",
"You shape [src] into a raw meatball."
@@ -280,7 +285,7 @@
user.drop_item()
qdel(src)
user.put_in_hands(M)
- return 1
+ return ITEM_INTERACT_COMPLETE
/obj/item/food/ground_meat
name = "ground meat"
@@ -296,7 +301,10 @@
. += "Use it in hand to shape it into a raw meatball."
. += "Use it in hand again to flatten it into a raw patty."
-/obj/item/food/ground_meat/attack_self__legacy__attackchain(mob/living/user)
+/obj/item/food/ground_meat/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
user.visible_message(
"[user] shapes [src] into a ball.",
"You shape [src] into a ball of raw ground meat."
@@ -306,7 +314,7 @@
user.drop_item()
qdel(src)
user.put_in_hands(M)
- return TRUE
+ return ITEM_INTERACT_COMPLETE
/obj/item/food/meat/raw_meatball
name = "raw meatball"
@@ -320,7 +328,10 @@
. = ..()
. += "Use it in hand to flatten it into a raw patty."
-/obj/item/food/meat/raw_meatball/attack_self__legacy__attackchain(mob/user)
+/obj/item/food/meat/raw_meatball/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
user.visible_message(
"[user] flattens [src] into a patty.",
"You flatten [src] into a raw patty."
@@ -330,7 +341,7 @@
user.drop_item()
qdel(src)
user.put_in_hands(M)
- return TRUE
+ return ITEM_INTERACT_COMPLETE
/obj/item/food/meatball
name = "meatball"
@@ -505,20 +516,20 @@
reagents.reaction(hit_atom, REAGENT_TOUCH)
qdel(src)
-/obj/item/food/egg/attackby__legacy__attackchain(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/toy/crayon))
- var/obj/item/toy/crayon/C = W
- var/clr = C.dye_color
+/obj/item/food/egg/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(!istype(used, /obj/item/toy/crayon))
+ return NONE
- if(!(clr in list("blue","green","mime","orange","purple","rainbow","red","yellow")))
- to_chat(usr, "The egg refuses to take on this color!")
- return
+ var/obj/item/toy/crayon/C = used
+ var/clr = C.dye_color
+ if(!(clr in list("red", "orange", "yellow", "green", "blue", "purple", "rainbow", "mime")))
+ to_chat(usr, "The egg refuses to take on this color!")
+ return ITEM_INTERACT_COMPLETE
- to_chat(usr, "You color \the [src] [clr]")
- icon_state = "egg-[clr]"
- item_color = clr
- else
- ..()
+ to_chat(usr, "You color \the [src] [clr]")
+ icon_state = "egg-[clr]"
+ item_color = clr
+ return ITEM_INTERACT_COMPLETE
/obj/item/food/egg/blue
icon_state = "egg-blue"
diff --git a/code/modules/food_and_drinks/food/foods/side_dishes.dm b/code/modules/food_and_drinks/food/foods/side_dishes.dm
index a0232062623..609c60b1185 100644
--- a/code/modules/food_and_drinks/food/foods/side_dishes.dm
+++ b/code/modules/food_and_drinks/food/foods/side_dishes.dm
@@ -117,16 +117,19 @@
tastes = list("rice" = 1)
goal_difficulty = FOOD_GOAL_NORMAL
-/obj/item/food/boiledrice/attackby__legacy__attackchain(obj/item/I, mob/user, params)
- if(!istype(I, /obj/item/stack/seaweed))
- return ..()
- var/obj/item/stack/seaweed/S = I
+/obj/item/food/boiledrice/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(!istype(used, /obj/item/stack/seaweed))
+ return NONE
+
+ var/obj/item/stack/seaweed/S = used
if(!S.use(1))
- return ..()
+ return ITEM_INTERACT_COMPLETE
+
var/obj/item/food/onigiri/O = new(get_turf(user))
reagents.trans_to(O, reagents.total_volume)
qdel(src)
user.put_in_active_hand(O)
+ return ITEM_INTERACT_COMPLETE
/obj/item/food/roastparsnip
name = "roast parsnip"
diff --git a/code/modules/food_and_drinks/food_base.dm b/code/modules/food_and_drinks/food_base.dm
index 1d087303cbc..1d656a550b1 100644
--- a/code/modules/food_and_drinks/food_base.dm
+++ b/code/modules/food_and_drinks/food_base.dm
@@ -13,6 +13,7 @@
resistance_flags = FLAMMABLE
container_type = INJECTABLE
w_class = WEIGHT_CLASS_TINY
+ new_attack_chain = TRUE
var/filling_color = "#FFFFFF" //Used by sandwiches.
var/junkiness = 0 //for junk food. used to lower human satiety.
var/bitesize = 2
@@ -171,51 +172,47 @@
/obj/item/food/proc/Post_Consume(mob/living/M)
return
-/obj/item/food/attack_self__legacy__attackchain(mob/user)
- return
-
-/obj/item/food/attack__legacy__attackchain(mob/M, mob/user, def_zone)
+/obj/item/food/interact_with_atom(atom/target, mob/living/user, list/modifiers)
if(user.a_intent == INTENT_HARM && force)
- return ..()
+ return NONE
+
if(reagents && !reagents.total_volume) // Shouldn't be needed but it checks to see if it has anything left in it.
to_chat(user, "None of [src] left, oh no!")
qdel(src)
- return FALSE
+ return ITEM_INTERACT_COMPLETE
- if(iscarbon(M))
- var/mob/living/carbon/C = M
+ if(iscarbon(target))
+ var/mob/living/carbon/C = target
if(C.eat(src, user))
bitecount++
On_Consume(C, user)
- return TRUE
- return FALSE
+ return ITEM_INTERACT_COMPLETE
-/obj/item/food/attackby__legacy__attackchain(obj/item/W, mob/user, params)
- if(is_pen(W))
- rename_interactive(user, W, use_prefix = FALSE, prompt = "What would you like to name this dish?")
- return
- if(isstorage(W))
- ..() // -> item/attackby(, params)
+ return NONE
- else if(istype(W,/obj/item/kitchen/utensil))
+/obj/item/food/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(is_pen(used))
+ rename_interactive(user, used, use_prefix = FALSE, prompt = "What would you like to name this dish?")
+ return ITEM_INTERACT_COMPLETE
- var/obj/item/kitchen/utensil/U = W
+ if(isstorage(used))
+ return NONE
+ if(istype(used, /obj/item/kitchen/utensil))
+ var/obj/item/kitchen/utensil/U = used
if(length(U.contents) >= U.max_contents)
to_chat(user, "You cannot fit anything else on your [U].")
- return
+ return ITEM_INTERACT_COMPLETE
- user.visible_message( \
- "[user] scoops up some [name] with [U]!", \
- "You scoop up some [name] with [U]!" \
+ user.visible_message(
+ "[user] scoops up some [name] with [U]!",
+ "You scoop up some [name] with [U]!"
)
-
bitecount++
U.overlays.Cut()
var/image/I = new(U.icon, "loadedfood")
I.color = filling_color
U.overlays += I
-
var/obj/item/food/collected = new type
collected.name = name
collected.loc = U
@@ -233,9 +230,9 @@
TrashItem = trash
TrashItem.forceMove(loc)
qdel(src)
- return TRUE
- else
- return ..()
+ return ITEM_INTERACT_COMPLETE
+
+ return NONE
/obj/item/food/proc/generate_trash(atom/location)
if(trash)
@@ -331,32 +328,38 @@
add_fingerprint(user)
I.forceMove(src)
-/obj/item/food/sliceable/attackby__legacy__attackchain(obj/item/I, mob/user, params)
+/obj/item/food/sliceable/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if((slices_num <= 0 || !slices_num) || !slice_path)
- return FALSE
+ return ITEM_INTERACT_COMPLETE
+
+ if(!used.sharp)
+ return NONE
var/inaccurate = TRUE
- if(I.sharp)
- if(istype(I, /obj/item/kitchen/knife) || istype(I, /obj/item/scalpel))
- inaccurate = FALSE
- else
- return ..()
+ if(istype(used, /obj/item/kitchen/knife) || istype(used, /obj/item/scalpel))
+ inaccurate = FALSE
+
if(!isturf(loc) || !(locate(/obj/structure/table) in loc) && \
!(locate(/obj/machinery/optable) in loc) && !(locate(/obj/item/storage/bag/tray) in loc))
to_chat(user, "You cannot slice [src] here! You need a table or at least a tray to do it.")
- return TRUE
- var/slices_lost = 0
+ return ITEM_INTERACT_COMPLETE
+
var/initial_volume = 0 // the total some of reagents this food had initially
for(var/ingredient in list_reagents)
initial_volume += list_reagents[ingredient]
// we want to account for how much has been eaten already, reduce slices by how is left vs. how much food we started with
slices_num = clamp(slices_num * (reagents.total_volume / initial_volume), 1, slices_num)
+ var/slices_lost
if(!inaccurate)
- user.visible_message("[user] slices [src]!",
- "You slice [src]!")
+ user.visible_message(
+ "[user] slices [src] with [used].",
+ "You slice [src] with [used]."
+ )
else
- user.visible_message("[user] crudely slices [src] with [I]!",
- "You crudely slice [src] with your [I]!")
+ user.visible_message(
+ "[user] crudely slices [src] with [used], destroying some in the process!",
+ "You crudely slice [src] with [used], destroying some in the process!"
+ )
slices_lost = rand(1, min(1, round(slices_num / 2)))
var/reagents_per_slice = reagents.total_volume/slices_num
for(var/i in 1 to (slices_num - slices_lost))
@@ -364,7 +367,7 @@
reagents.trans_to(slice,reagents_per_slice)
slice.scatter_atom()
qdel(src)
- return ..()
+ return ITEM_INTERACT_COMPLETE
/obj/item/food/badrecipe
name = "burned mess"
diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm
index 1519b9e0a5c..ff0db90fee9 100644
--- a/code/modules/hydroponics/grown.dm
+++ b/code/modules/hydroponics/grown.dm
@@ -67,23 +67,28 @@
if(T.examine_line)
. += T.examine_line
-/obj/item/food/grown/attackby__legacy__attackchain(obj/item/O, mob/user, params)
- ..()
+/obj/item/food/grown/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(slices_num && slice_path)
var/inaccurate = TRUE
- if(O.sharp)
- if(istype(O, /obj/item/kitchen/knife) || istype(O, /obj/item/scalpel))
+ if(used.sharp)
+ if(istype(used, /obj/item/kitchen/knife) || istype(used, /obj/item/scalpel))
inaccurate = FALSE
if(!isturf(loc) || !(locate(/obj/structure/table) in loc) && !(locate(/obj/machinery/optable) in loc) && !(locate(/obj/item/storage/bag/tray) in loc))
to_chat(user, "You cannot slice [src] here! You need a table or at least a tray to do it.")
- return TRUE
+ return ITEM_INTERACT_COMPLETE
var/slices_lost = 0
if(!inaccurate)
- user.visible_message("[user] slices [src] with [O]!", "You slice [src]!")
+ user.visible_message(
+ "[user] slices [src] with [used].",
+ "You slice [src] with [used]."
+ )
else
- user.visible_message("[user] crudely slices [src] with [O]!", "You crudely slice [src] with your [O]!")
+ user.visible_message(
+ "[user] crudely slices [src] with [used], destroying some in the process!",
+ "You crudely slice [src] with [used], destroying some in the process!"
+ )
slices_lost = rand(1, min(1, round(slices_num / 2)))
var/reagents_per_slice = reagents.total_volume/slices_num
@@ -92,21 +97,27 @@
reagents.trans_to(slice, reagents_per_slice)
slice.scatter_atom()
qdel(src)
- return ..()
+ return ITEM_INTERACT_COMPLETE
- if(istype(O, /obj/item/plant_analyzer))
+ if(istype(used, /obj/item/plant_analyzer))
send_plant_details(user)
- else
- if(seed)
- for(var/datum/plant_gene/trait/T in seed.genes)
- T.on_attackby(src, O, user)
+ return ITEM_INTERACT_COMPLETE
+
+ if(seed)
+ for(var/datum/plant_gene/trait/T in seed.genes)
+ T.on_attackby(src, used, user)
+ return ITEM_INTERACT_COMPLETE
+
+ return NONE
// Various gene procs
-/obj/item/food/grown/attack_self__legacy__attackchain(mob/user)
+/obj/item/food/grown/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
if(seed && seed.get_gene(/datum/plant_gene/trait/squash))
squash(user)
- ..()
/obj/item/food/grown/throw_impact(atom/hit_atom)
if(!..()) //was it caught by a mob?
@@ -171,15 +182,20 @@
return ..()
// For item-containing growns such as eggy or gatfruit
-/obj/item/food/grown/shell/attack_self__legacy__attackchain(mob/user)
+/obj/item/food/grown/shell/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
if(!do_after(user, 1.5 SECONDS, target = user))
- return
+ return ITEM_INTERACT_COMPLETE
+
user.unequip(src)
if(trash)
var/obj/item/T = generate_trash()
user.put_in_hands(T)
- to_chat(user, "You open [src]\'s shell, revealing \a [T].")
+ to_chat(user, "You deshell [src], revealing \a [T].")
qdel(src)
+ return ITEM_INTERACT_COMPLETE
// Diona Nymphs can eat these as well as weeds to gain nutrition.
/obj/item/food/grown/attack_animal(mob/living/simple_animal/M)
diff --git a/code/modules/hydroponics/grown/cereals.dm b/code/modules/hydroponics/grown/cereals.dm
index 87f882bfe87..5124b2e195b 100644
--- a/code/modules/hydroponics/grown/cereals.dm
+++ b/code/modules/hydroponics/grown/cereals.dm
@@ -89,11 +89,17 @@
tastes = list("meatwheat" = 1)
can_distill = FALSE
-/obj/item/food/grown/meatwheat/attack_self__legacy__attackchain(mob/living/user)
- user.visible_message("[user] crushes [src] into meat.", "You crush [src] into something that resembles meat.")
+/obj/item/food/grown/meatwheat/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
+ user.visible_message(
+ "[user] crushes [src] into meat.",
+ "You crush [src] into something that resembles meat."
+ )
playsound(user, 'sound/effects/blobattack.ogg', 50, 1)
var/obj/item/food/meat/meatwheat/M = new(get_turf(user))
user.drop_item()
qdel(src)
user.put_in_hands(M)
- return 1
+ return ITEM_INTERACT_COMPLETE
diff --git a/code/modules/hydroponics/grown/citrus.dm b/code/modules/hydroponics/grown/citrus.dm
index d7a8009bf5b..6ba3c838879 100644
--- a/code/modules/hydroponics/grown/citrus.dm
+++ b/code/modules/hydroponics/grown/citrus.dm
@@ -111,9 +111,15 @@
tastes = list("burning lemon" = 1)
wine_flavor = "fire"
-/obj/item/food/grown/firelemon/attack_self__legacy__attackchain(mob/living/user)
+/obj/item/food/grown/firelemon/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
var/area/A = get_area(user)
- user.visible_message("[user] primes [src]!", "You prime [src]!")
+ user.visible_message(
+ "[user] primes [src]!",
+ "You prime [src]!"
+ )
investigate_log("[key_name(user)] primed a combustible lemon for detonation at [A] [COORD(user)].", INVESTIGATE_BOMB)
add_attack_logs(user, src, "primed a combustible lemon for detonation", ATKLOG_FEW)
log_game("[key_name(user)] primed a combustible lemon for detonation at [A] [COORD(user)].")
@@ -123,6 +129,7 @@
icon_state = "firelemon_active"
playsound(loc, 'sound/weapons/armbomb.ogg', 75, TRUE, -3)
addtimer(CALLBACK(src, PROC_REF(prime)), rand(10, 60))
+ return ITEM_INTERACT_COMPLETE
/obj/item/food/grown/firelemon/burn()
prime()
diff --git a/code/modules/hydroponics/grown/grass_carpet.dm b/code/modules/hydroponics/grown/grass_carpet.dm
index b28e0555d14..922627212c5 100644
--- a/code/modules/hydroponics/grown/grass_carpet.dm
+++ b/code/modules/hydroponics/grown/grass_carpet.dm
@@ -30,7 +30,10 @@
tastes = list("grass" = 1)
wine_power = 0.15
-/obj/item/food/grown/grass/attack_self__legacy__attackchain(mob/user)
+/obj/item/food/grown/grass/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
to_chat(user, "You prepare the astroturf.")
var/grassAmt = 1 + round(seed.potency * tile_coefficient) // The grass we're holding
for(var/obj/item/food/grown/grass/G in user.loc) // The grass on the floor
@@ -40,6 +43,7 @@
qdel(G)
new stacktype(user.drop_location(), grassAmt)
qdel(src)
+ return ITEM_INTERACT_COMPLETE
// Carpet
/obj/item/seeds/grass/carpet
diff --git a/code/modules/hydroponics/grown/herbals.dm b/code/modules/hydroponics/grown/herbals.dm
index d1d0421cf8e..c8e030a6ea7 100644
--- a/code/modules/hydroponics/grown/herbals.dm
+++ b/code/modules/hydroponics/grown/herbals.dm
@@ -20,12 +20,16 @@
tastes = list("comfrey" = 1)
bitesize_mod = 2
-/obj/item/food/grown/comfrey/attack_self__legacy__attackchain(mob/user)
+/obj/item/food/grown/comfrey/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
var/obj/item/stack/medical/bruise_pack/comfrey/C = new(get_turf(user))
C.heal_brute = seed.potency
to_chat(user, "You mash [src] into a poultice.")
user.drop_item()
qdel(src)
+ return ITEM_INTERACT_COMPLETE
/obj/item/seeds/aloe
name = "pack of aloe seeds"
@@ -47,12 +51,16 @@
tastes = list("aloe" = 1)
bitesize_mod = 2
-/obj/item/food/grown/aloe/attack_self__legacy__attackchain(mob/user)
+/obj/item/food/grown/aloe/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
var/obj/item/stack/medical/ointment/aloe/A = new(get_turf(user))
A.heal_burn = seed.potency
to_chat(user, "You mash [src] into a poultice.")
user.drop_item()
qdel(src)
+ return ITEM_INTERACT_COMPLETE
// mint
/obj/item/seeds/mint
diff --git a/code/modules/hydroponics/grown/misc_seeds.dm b/code/modules/hydroponics/grown/misc_seeds.dm
index 1ccca14a80c..0eba7eedf64 100644
--- a/code/modules/hydroponics/grown/misc_seeds.dm
+++ b/code/modules/hydroponics/grown/misc_seeds.dm
@@ -191,15 +191,22 @@
max_integrity = 40
wine_power = 0.8
-/obj/item/food/grown/cherry_bomb/attack_self__legacy__attackchain(mob/living/user)
+/obj/item/food/grown/cherry_bomb/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
var/area/A = get_area(user)
- user.visible_message("[user] plucks the stem from [src]!", "You pluck the stem from [src], which begins to hiss loudly!")
+ user.visible_message(
+ "[user] plucks the stem from [src]!",
+ "You pluck the stem from [src], which begins to hiss loudly!"
+ )
message_admins("[user] ([user.key ? user.key : "no key"]) primed a cherry bomb for detonation at [A] ([user.x], [user.y], [user.z]) (JMP)")
log_game("[user] ([user.key ? user.key : "no key"]) primed a cherry bomb for detonation at [A] ([user.x],[user.y],[user.z]).")
if(iscarbon(user))
var/mob/living/carbon/C = user
C.throw_mode_on()
prime()
+ return ITEM_INTERACT_COMPLETE
/obj/item/food/grown/cherry_bomb/deconstruct(disassembled = TRUE)
if(!disassembled)
diff --git a/code/modules/hydroponics/grown/mushrooms.dm b/code/modules/hydroponics/grown/mushrooms.dm
index a934d4ed217..9d3d77973d4 100644
--- a/code/modules/hydroponics/grown/mushrooms.dm
+++ b/code/modules/hydroponics/grown/mushrooms.dm
@@ -173,9 +173,14 @@
tastes = list("walking mushroom" = 1, "motion" = 1)
can_distill = FALSE
-/obj/item/food/grown/mushroom/walkingmushroom/attack_self__legacy__attackchain(mob/user)
+/obj/item/food/grown/mushroom/walkingmushroom/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
if(isspaceturf(user.loc))
- return
+ to_chat(user, "You need a solid floor to plant [src] on!")
+ return ITEM_INTERACT_COMPLETE
+
var/mob/living/simple_animal/hostile/mushroom/M = new /mob/living/simple_animal/hostile/mushroom(user.loc)
M.maxHealth += round(seed.endurance / 4)
M.melee_damage_lower += round(seed.potency / 20)
@@ -245,12 +250,18 @@
tastes = list("warmth" = 1, "light" = 1, "glowshroom" = 1)
wine_power = 0.5
-/obj/item/food/grown/mushroom/glowshroom/attack_self__legacy__attackchain(mob/user)
+/obj/item/food/grown/mushroom/glowshroom/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
if(isspaceturf(user.loc))
- return FALSE
+ to_chat(user, "You need a solid floor or wall to plant [src] on!")
+ return ITEM_INTERACT_COMPLETE
+
if(!isturf(user.loc))
- to_chat(user, "You need more space to plant [src].")
- return FALSE
+ to_chat(user, "You need more space to plant [src]!")
+ return ITEM_INTERACT_COMPLETE
+
var/count = 0
var/maxcount = 1
for(var/tempdir in GLOB.cardinal)
@@ -260,13 +271,13 @@
for(var/obj/structure/glowshroom/G in user.loc)
count++
if(count >= maxcount)
- to_chat(user, "There are too many shrooms here to plant [src].")
- return FALSE
+ to_chat(user, "There are too many shrooms here to plant [src]!")
+ return ITEM_INTERACT_COMPLETE
+
new effect_path(user.loc, seed)
to_chat(user, "You plant [src].")
qdel(src)
- return TRUE
-
+ return ITEM_INTERACT_COMPLETE
// Glowcap
/obj/item/seeds/glowshroom/glowcap
diff --git a/code/modules/hydroponics/grown/nymph.dm b/code/modules/hydroponics/grown/nymph.dm
index 674ac06110c..eff1b44270a 100644
--- a/code/modules/hydroponics/grown/nymph.dm
+++ b/code/modules/hydroponics/grown/nymph.dm
@@ -19,8 +19,12 @@
icon_state = "mushy"
bitesize_mod = 2
-/obj/item/food/grown/nymph_pod/attack_self__legacy__attackchain(mob/user)
+/obj/item/food/grown/nymph_pod/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
+
new /mob/living/simple_animal/diona(get_turf(user))
- to_chat(user, "You crack open [src] letting the nymph out.")
+ to_chat(user, "You crack open [src], letting the nymph out.")
user.drop_item()
qdel(src)
+ return ITEM_INTERACT_COMPLETE
diff --git a/code/modules/hydroponics/grown/potato.dm b/code/modules/hydroponics/grown/potato.dm
index 9fc0c7e05d1..c830477fd79 100644
--- a/code/modules/hydroponics/grown/potato.dm
+++ b/code/modules/hydroponics/grown/potato.dm
@@ -35,18 +35,17 @@
tastes = list("potato" = 1)
distill_reagent = "sbiten"
+/obj/item/food/grown/potato/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(!used.sharp)
+ return NONE
-/obj/item/food/grown/potato/attackby__legacy__attackchain(obj/item/W, mob/user, params)
- if(W.sharp)
- to_chat(user, "You cut the potato into wedges with [W].")
- var/obj/item/food/grown/potato/wedges/Wedges = new /obj/item/food/grown/potato/wedges
- if(!remove_item_from_storage(user))
- user.unequip(src)
- user.put_in_hands(Wedges)
- qdel(src)
- else
- return ..()
-
+ to_chat(user, "You cut the potato into wedges with [used].")
+ var/obj/item/food/grown/potato/wedges/W = new /obj/item/food/grown/potato/wedges
+ if(!remove_item_from_storage(user))
+ user.unequip(src)
+ user.put_in_hands(W)
+ qdel(src)
+ return ITEM_INTERACT_COMPLETE
// Sweet Potato
/obj/item/seeds/potato/sweet
diff --git a/code/modules/hydroponics/grown/pumpkin.dm b/code/modules/hydroponics/grown/pumpkin.dm
index 20fa91d92d3..74b175b11b9 100644
--- a/code/modules/hydroponics/grown/pumpkin.dm
+++ b/code/modules/hydroponics/grown/pumpkin.dm
@@ -28,14 +28,14 @@
wine_power = 0.2
var/carved_type = /obj/item/clothing/head/hardhat/pumpkinhead
-/obj/item/food/grown/pumpkin/attackby__legacy__attackchain(obj/item/W as obj, mob/user as mob, params)
- if(W.sharp)
- user.show_message("You carve a face into [src]!", 1)
- new carved_type(user.loc)
- qdel(src)
- return
- else
- return ..()
+/obj/item/food/grown/pumpkin/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(!used.sharp)
+ return NONE
+
+ to_chat(user, "You carve a face into [src] with [used].")
+ new carved_type(user.loc)
+ qdel(src)
+ return ITEM_INTERACT_COMPLETE
// Blumpkin
/obj/item/seeds/pumpkin/blumpkin
diff --git a/code/modules/hydroponics/grown/root.dm b/code/modules/hydroponics/grown/root.dm
index 660726e6895..2ff7e5f65a9 100644
--- a/code/modules/hydroponics/grown/root.dm
+++ b/code/modules/hydroponics/grown/root.dm
@@ -29,16 +29,17 @@
desc = "Slices of neatly cut carrot."
icon_state = "carrot_wedges"
-/obj/item/food/grown/carrot/attackby__legacy__attackchain(obj/item/I, mob/user, params)
- if(I.sharp)
- to_chat(user, "You sharpen the carrot into a shiv with [I].")
- var/obj/item/kitchen/knife/shiv/carrot/Shiv = new ()
- if(!remove_item_from_storage(user))
- user.unequip(src)
- user.put_in_hands(Shiv)
- qdel(src)
- else
- return ..()
+/obj/item/food/grown/carrot/item_interaction(mob/living/user, obj/item/used, list/modifiers)
+ if(!used.sharp)
+ return NONE
+
+ to_chat(user, "You sharpen [src] into a shiv with [used].")
+ var/obj/item/kitchen/knife/shiv/carrot/shiv = new ()
+ if(!remove_item_from_storage(user))
+ user.unequip(src)
+ user.put_in_hands(shiv)
+ qdel(src)
+ return ITEM_INTERACT_COMPLETE
// Parsnip
diff --git a/code/modules/hydroponics/grown/tomato.dm b/code/modules/hydroponics/grown/tomato.dm
index b825b50cc8e..cce3edc5f9a 100644
--- a/code/modules/hydroponics/grown/tomato.dm
+++ b/code/modules/hydroponics/grown/tomato.dm
@@ -128,16 +128,21 @@
origin_tech = "biotech=4;combat=5"
distill_reagent = "demonsblood"
-/obj/item/food/grown/tomato/killer/attack__legacy__attackchain(mob/M, mob/user, def_zone)
- if(awakening)
- to_chat(user, "The tomato is twitching and shaking, preventing you from eating it.")
- return
- ..()
+/obj/item/food/grown/tomato/killer/interact_with_atom(atom/target, mob/living/user, list/modifiers)
+ if(!awakening)
+ return ..()
+
+ to_chat(user, "The tomato is squirming and shaking too much to do anything with it!")
+ return ITEM_INTERACT_COMPLETE
+
+/obj/item/food/grown/tomato/killer/activate_self(mob/user)
+ if(..())
+ return ITEM_INTERACT_COMPLETE
-/obj/item/food/grown/tomato/killer/attack_self__legacy__attackchain(mob/user)
if(awakening || isspaceturf(user.loc))
- return
- to_chat(user, "You begin to awaken the Killer Tomato...")
+ return ITEM_INTERACT_COMPLETE
+
+ to_chat(user, "You begin to awaken [src]...")
awakening = 1
spawn(30)
@@ -155,3 +160,5 @@
message_admins("[key_name_admin(user)] released a killer tomato at [ADMIN_COORDJMP(T)]")
log_game("[key_name(user)] released a killer tomato at [COORD(T)]")
qdel(src)
+ return ITEM_INTERACT_COMPLETE
+