Skip to content

Commit

Permalink
fix duplication bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsar-Salat committed Jun 24, 2024
1 parent 233fd19 commit 29a3dbe
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// Microwaving foods
///called on item when microwaved (): (obj/machinery/microwave/M)
#define COMSIG_ITEM_MICROWAVE_ACT "microwave_act"
#define COMPONENT_SUCCESFUL_MICROWAVE (1<<0)
///called on item when created through microwaving (): (obj/machinery/microwave/M, cooking_efficiency)
#define COMSIG_ITEM_MICROWAVE_COOKED "microwave_cooked"

Expand Down
7 changes: 3 additions & 4 deletions code/datums/components/food/edible.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ Behavior that's still missing from this component that original food items had t
src.bite_consumption = bite_consumption
src.food_flags = food_flags
src.foodtypes = foodtypes
src.initial_reagents = initial_reagents
src.tastes = tastes
src.eat_time = eat_time
src.eatverbs = string_list(eatverbs)
src.junkiness = junkiness
Expand Down Expand Up @@ -232,10 +230,9 @@ Behavior that's still missing from this component that original food items had t

if(!microwaved_type)
new /obj/item/reagent_containers/food/snacks/badrecipe(parent_turf)
qdel(src)
qdel(parent)
return


var/obj/item/result

result = new microwaved_type(parent_turf)
Expand All @@ -245,6 +242,8 @@ Behavior that's still missing from this component that original food items had t
SEND_SIGNAL(result, COMSIG_ITEM_MICROWAVE_COOKED, parent, efficiency)

SSblackbox.record_feedback("tally", "food_made", 1, result.type)
qdel(parent)
return COMPONENT_SUCCESFUL_MICROWAVE

///Corrects the reagents on the newly cooked food
/datum/component/edible/proc/on_microwave_cooked(datum/source, obj/item/source_item, cooking_efficiency = 1)
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,8 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
..()

/obj/item/proc/microwave_act(obj/machinery/microwave/M)
SEND_SIGNAL(src, COMSIG_ITEM_MICROWAVE_ACT, M)
if(SEND_SIGNAL(src, COMSIG_ITEM_MICROWAVE_ACT, M) & COMPONENT_SUCCESFUL_MICROWAVE)
return
if(istype(M) && M.dirty < 100)
M.dirty++

Expand Down
9 changes: 0 additions & 9 deletions code/modules/food_and_drinks/food/customizables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,6 @@
ingMax = 6
icon_state = "rod"

/obj/item/reagent_containers/food/snacks/customizable/pasta
name = "spaghetti"
desc = "Noodles. With stuff. Delicious."
ingredients_placement = INGREDIENTS_SCATTER
ingMax = 6
icon = 'icons/obj/food/pizzaspaghetti.dmi'
icon_state = "spaghettiboiled"
foodtype = GRAIN


/obj/item/reagent_containers/food/snacks/customizable/pie
name = "pie"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/organs/heart.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
update_appearance()
return 1

/obj/item/organ/heart/OnEatFrom(eater, feeder)
/obj/item/organ/heart/on_eat_from(eater, feeder)
. = ..()
beating = FALSE
update_appearance()
Expand Down
26 changes: 23 additions & 3 deletions code/modules/surgery/organs/organ_internal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@
/obj/item/organ/Initialize()
. = ..()
if(organ_flags & ORGAN_EDIBLE)
AddComponent(/datum/component/edible, food_reagents, null, RAW | MEAT | GORE, null, 10, null, null, null, COLOR_PINK, CALLBACK(src, PROC_REF(OnEatFrom)))
AddComponent(/datum/component/edible,\
initial_reagents = food_reagents,\
foodtypes = RAW | MEAT | GORE,\
volume = 10,\
filling_color = COLOR_PINK,\
pre_eat = CALLBACK(src, PROC_REF(pre_eat)),\
on_compost = CALLBACK(src, PROC_REF(pre_compost)),\
after_eat = CALLBACK(src, PROC_REF(on_eat_from)))

///When you take a bite you cant jam it in for surgery anymore.
/obj/item/organ/proc/Insert(mob/living/carbon/M, special = 0, drop_if_replaced = TRUE)
Expand Down Expand Up @@ -133,8 +140,21 @@
STOP_PROCESSING(SSobj, src)
return ..()

/obj/item/organ/proc/OnEatFrom(eater, feeder)
useable = FALSE //You can't use it anymore after eating it you spaztic
// Put any "can we eat this" checks for edible organs here
/obj/item/organ/proc/pre_eat(eater, feeder)
if(iscarbon(eater))
var/mob/living/carbon/target = eater
for(var/S in target.surgeries)
var/datum/surgery/surgery = S
if(surgery.location == zone)
return FALSE
return TRUE

/obj/item/organ/proc/pre_compost(user)
return TRUE

/obj/item/organ/proc/on_eat_from(eater, feeder)
useable = FALSE //You bit it, no more using it

/obj/item/organ/item_action_slot_check(slot,mob/user)
return //so we don't grant the organ's action to mobs who pick up the organ.
Expand Down

0 comments on commit 29a3dbe

Please sign in to comment.