Skip to content

Commit

Permalink
boxes into seed extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
doganesi committed May 24, 2024
1 parent c291891 commit fd42c40
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions code/game/machinery/seed_extractor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,43 @@

/obj/structure/machinery/seed_extractor/attackby(obj/item/O as obj, mob/user as mob)

// Plant bag and other storage containers.
if(istype(O,/obj/item/storage))
var/obj/item/storage/container = O
if(container.contents.len > 0)
to_chat(user, SPAN_NOTICE("You start dumping the contents of [container] into [src]."))
if(!do_after(user, 1.5 SECONDS, INTERRUPT_ALL, BUSY_ICON_GENERIC))
return
for(var/obj/item/item in container)
if(!istype(item, /obj/item/reagent_container/food/snacks/grown) && !istype(item, /obj/item/grown))
to_chat(user, SPAN_WARNING("Cannot get seeds from [item]."))
break
else
if(user.temp_drop_inv_item(item))
var/datum/seed/new_seed_type
if(istype(item, /obj/item/grown))
var/obj/item/grown/F = item
new_seed_type = GLOB.seed_types[F.plantname]
else
var/obj/item/reagent_container/food/snacks/grown/F = item
new_seed_type = GLOB.seed_types[F.plantname]

if(new_seed_type)
to_chat(user, SPAN_NOTICE("You extract some seeds from [item]."))
var/produce = rand(1,4)
for(var/i = 0;i<=produce;i++)
var/obj/item/seeds/seeds = new (get_turf(src))
seeds.seed_type = new_seed_type.name
seeds.update_seed()
else
to_chat(user, "[item] doesn't seem to have any usable seeds inside it.")
qdel(item)

playsound(user.loc, "rustle", 15, 1, 6)
else
to_chat(user, SPAN_NOTICE("[container] is empty."))


// Fruits and vegetables.
if(istype(O, /obj/item/reagent_container/food/snacks/grown) || istype(O, /obj/item/grown))
if(user.temp_drop_inv_item(O))
Expand Down

0 comments on commit fd42c40

Please sign in to comment.