mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-21 20:13:45 +01:00
Merge pull request #12711 from SteelSlayer/chem-bag-to-grinder
Chemistry bag QoL improvement
This commit is contained in:
@@ -134,76 +134,88 @@
|
||||
icon_state = "juicer0"
|
||||
|
||||
/obj/machinery/reagentgrinder/attackby(obj/item/I, mob/user, params)
|
||||
if(default_unfasten_wrench(user, I))
|
||||
return
|
||||
if(default_unfasten_wrench(user, I))
|
||||
return
|
||||
|
||||
if(exchange_parts(user, I))
|
||||
return
|
||||
if(exchange_parts(user, I))
|
||||
return
|
||||
|
||||
if(anchored && !beaker)
|
||||
if(default_deconstruction_screwdriver(user, "juicer_open", "juicer0", I))
|
||||
return
|
||||
if(anchored && !beaker)
|
||||
if(default_deconstruction_screwdriver(user, "juicer_open", "juicer0", I))
|
||||
return
|
||||
|
||||
if(panel_open && istype(I, /obj/item/crowbar))
|
||||
default_deconstruction_crowbar(I)
|
||||
return
|
||||
if(panel_open && istype(I, /obj/item/crowbar))
|
||||
default_deconstruction_crowbar(I)
|
||||
return
|
||||
|
||||
if (istype(I, /obj/item/reagent_containers) && (I.container_type & OPENCONTAINER) )
|
||||
if(beaker)
|
||||
to_chat(user, "<span class='warning'>There's already a container inside.</span>")
|
||||
else if(panel_open)
|
||||
to_chat(user, "<span class='warning'>Close the maintenance panel first.</span>")
|
||||
else
|
||||
if(!user.drop_item())
|
||||
return 1
|
||||
beaker = I
|
||||
beaker.loc = src
|
||||
update_icon()
|
||||
src.updateUsrDialog()
|
||||
return 1 //no afterattack
|
||||
if(istype(I, /obj/item/reagent_containers) && (I.container_type & OPENCONTAINER) )
|
||||
if(beaker)
|
||||
to_chat(user, "<span class='warning'>There's already a container inside.</span>")
|
||||
else if(panel_open)
|
||||
to_chat(user, "<span class='warning'>Close the maintenance panel first.</span>")
|
||||
else
|
||||
if(!user.drop_item())
|
||||
return FALSE
|
||||
beaker = I
|
||||
beaker.loc = src
|
||||
update_icon()
|
||||
updateUsrDialog()
|
||||
return TRUE //no afterattack
|
||||
|
||||
if(is_type_in_list(I, dried_items))
|
||||
if(istype(I, /obj/item/reagent_containers/food/snacks/grown))
|
||||
var/obj/item/reagent_containers/food/snacks/grown/G = I
|
||||
if(!G.dry)
|
||||
to_chat(user, "<span class='warning'>You must dry that first!</span>")
|
||||
return 1
|
||||
if(is_type_in_list(I, dried_items))
|
||||
if(istype(I, /obj/item/reagent_containers/food/snacks/grown))
|
||||
var/obj/item/reagent_containers/food/snacks/grown/G = I
|
||||
if(!G.dry)
|
||||
to_chat(user, "<span class='warning'>You must dry that first!</span>")
|
||||
return FALSE
|
||||
|
||||
if(holdingitems && holdingitems.len >= limit)
|
||||
to_chat(usr, "The machine cannot hold anymore items.")
|
||||
return 1
|
||||
if(holdingitems && holdingitems.len >= limit)
|
||||
to_chat(usr, "The machine cannot hold anymore items.")
|
||||
return FALSE
|
||||
|
||||
//Fill machine with a bag!
|
||||
if(istype(I, /obj/item/storage/bag))
|
||||
var/obj/item/storage/bag/B = I
|
||||
for (var/obj/item/reagent_containers/food/snacks/grown/G in B.contents)
|
||||
B.remove_from_storage(G, src)
|
||||
holdingitems += G
|
||||
if(holdingitems && holdingitems.len >= limit) //Sanity checking so the blender doesn't overfill
|
||||
to_chat(user, "<span class='notice'>You fill the All-In-One grinder to the brim.</span>")
|
||||
break
|
||||
//Fill machine with a bag!
|
||||
if(istype(I, /obj/item/storage/bag))
|
||||
var/obj/item/storage/bag/B = I
|
||||
if(!B.contents.len)
|
||||
to_chat(user, "<span class='warning'>[B] is empty.</span>")
|
||||
return FALSE
|
||||
|
||||
if(!I.contents.len)
|
||||
to_chat(user, "<span class='notice'>You empty the plant bag into the All-In-One grinder.</span>")
|
||||
var/original_contents_len = B.contents.len
|
||||
|
||||
src.updateUsrDialog()
|
||||
return 1
|
||||
for(var/obj/item/G in B.contents)
|
||||
if(is_type_in_list(G, blend_items) || is_type_in_list(G, juice_items))
|
||||
B.remove_from_storage(G, src)
|
||||
holdingitems += G
|
||||
if(holdingitems && holdingitems.len >= limit) //Sanity checking so the blender doesn't overfill
|
||||
to_chat(user, "<span class='notice'>You fill the All-In-One grinder to the brim.</span>")
|
||||
break
|
||||
|
||||
if (!is_type_in_list(I, blend_items) && !is_type_in_list(I, juice_items))
|
||||
if(user.a_intent == INTENT_HARM)
|
||||
return ..()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Cannot refine into a reagent!</span>")
|
||||
return 1
|
||||
if(B.contents.len == original_contents_len)
|
||||
to_chat(user, "<span class='warning'>Nothing in [B] can be put into the All-In-One grinder.</span>")
|
||||
return FALSE
|
||||
else if(!B.contents.len)
|
||||
to_chat(user, "<span class='notice'>You empty all of [B]'s contents into the All-In-One grinder.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You empty some of [B]'s contents into the All-In-One grinder.</span>")
|
||||
|
||||
if(user.drop_item())
|
||||
I.loc = src
|
||||
holdingitems += I
|
||||
src.updateUsrDialog()
|
||||
return 0
|
||||
updateUsrDialog()
|
||||
return TRUE
|
||||
|
||||
if(!is_type_in_list(I, blend_items) && !is_type_in_list(I, juice_items))
|
||||
if(user.a_intent == INTENT_HARM)
|
||||
return ..()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Cannot refine into a reagent!</span>")
|
||||
return TRUE
|
||||
|
||||
if(user.drop_item())
|
||||
I.loc = src
|
||||
holdingitems += I
|
||||
src.updateUsrDialog()
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/reagentgrinder/attack_ai(mob/user)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/reagentgrinder/attack_hand(mob/user)
|
||||
user.set_machine(src)
|
||||
@@ -301,8 +313,8 @@
|
||||
/obj/machinery/reagentgrinder/proc/is_allowed(obj/item/reagent_containers/O)
|
||||
for (var/i in blend_items)
|
||||
if(istype(O, i))
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/reagentgrinder/proc/get_allowed_by_id(obj/item/O)
|
||||
for (var/i in blend_items)
|
||||
|
||||
Reference in New Issue
Block a user