Skip to content

Commit

Permalink
you can now compost food and people
Browse files Browse the repository at this point in the history
  • Loading branch information
KoboldCommando committed Sep 20, 2023
1 parent 0f3c812 commit 53ae006
Showing 1 changed file with 38 additions and 6 deletions.
44 changes: 38 additions & 6 deletions monkestation/code/modules/hydroponics/machines/composter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
if(istype(attacking_item, /obj/item/seeds))
compost(attacking_item)

if(istype(attacking_item, /obj/item/food/grown))
if(istype(attacking_item, /obj/item/food))
compost(attacking_item)

if(istype(attacking_item, /obj/item/storage/bag)) // covers any kind of bag that has a compostible item
var/obj/item/storage/bag/bag = attacking_item
for(var/obj/item/food/grown/item in bag.contents)
for(var/obj/item/food/item in bag.contents)
if(bag.atom_storage.attempt_remove(item, src))
compost(item)

Expand All @@ -27,8 +27,35 @@
compost(item)
to_chat(user, span_info("You empty \the [bag] into \the [src]."))

/obj/machinery/gibber/attack_paw(mob/user, list/modifiers)
return attack_hand(user, modifiers)

/obj/machinery/composters/attack_hand(mob/living/user, list/modifiers)
. = ..()
if(user.pulling && isliving(user.pulling))
var/mob/living/L = user.pulling
if(!iscarbon(L))
to_chat(user, span_warning("This item is not suitable for [src]!"))
return
var/mob/living/carbon/C = L
if(C.buckled || C.has_buckled_mobs())
to_chat(user, span_warning("[C] is attached to something!"))
return

for(var/obj/item/I in C.held_items + C.get_equipped_items())
if(!HAS_TRAIT(I, TRAIT_NODROP))
to_chat(user, span_warning("Subject may not have abiotic items on!"))
return

user.visible_message(span_danger("[user] starts to put [C] into [src]!"))

add_fingerprint(user)

if(do_after(user, 80, target = src))
if(C && user.pulling == C && !C.buckled && !C.has_buckled_mobs() && !occupant)
user.visible_message(span_danger("[user] stuffs [C] into [src]!"))
compost(C)

if(biomatter < 40)
to_chat(user, span_notice("Not enough biomatter to produce Bio-Cube"))
return
Expand All @@ -53,9 +80,14 @@
if(istype(composter, /obj/item/seeds))
biomatter++
qdel(composter)
if(istype(composter, /obj/item/food/grown))
if(istype(composter, /obj/item/food))
biomatter += 4
qdel(composter)
if(istype(composter, /mob/living/carbon))
audible_message(span_hear("You hear a loud squelchy grinding sound."))
playsound(loc, 'sound/machines/juicer.ogg', 50, TRUE)
biomatter += 40
qdel(composter)
update_desc()
update_appearance()
flick("composter_animate", src)
Expand All @@ -67,12 +99,12 @@
for(var/obj/item/seeds/seed in src_location)
dropped.compost(seed)

/obj/item/food/grown/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params)
/obj/item/food/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params)
. = ..()
if(istype(over, /obj/machinery/composters))
var/obj/machinery/composters/dropped = over
for(var/obj/item/food/grown/grown in src_location)
dropped.compost(grown)
for(var/obj/item/food/food in src_location)
dropped.compost(food)


/obj/item/bio_cube
Expand Down

0 comments on commit 53ae006

Please sign in to comment.