diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index a3dd3c8049..c6aa51deda 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -161,7 +161,7 @@ . = ..() if(A == beaker) beaker = null - cut_overlays() + update_icon() /obj/machinery/chem_dispenser/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index 06e33ddf9f..1ac62ba651 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -58,14 +58,14 @@ if(bottle) bottle.ex_act(severity, target) -/obj/machinery/chem_master/handle_atom_del(atom/A) - ..() +/obj/machinery/chem_master/Exited(atom/movable/A, atom/newloc) + . = ..() if(A == beaker) beaker = null - reagents.clear_reagents() update_icon() - else if(A == bottle) + if(A == bottle) bottle = null + update_icon() /obj/machinery/chem_master/update_icon() cut_overlays() @@ -103,6 +103,10 @@ updateUsrDialog() update_icon() else if(!condi && istype(I, /obj/item/storage/pill_bottle)) + . = TRUE // no afterattack + if(panel_open) + to_chat(user, "You can't use the [src.name] while its panel is opened!") + return if(!user.transferItemToLoc(I, src)) return replace_pillbottle(user, I) @@ -115,38 +119,37 @@ . = ..() if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return - replace_beaker(user) + if(beaker) + replace_beaker(user) + else if(bottle) + replace_pillbottle(user) return TRUE /obj/machinery/chem_master/proc/replace_beaker(mob/living/user, obj/item/reagent_containers/new_beaker) if(beaker) - beaker.forceMove(drop_location()) + var/obj/item/reagent_containers/B = beaker + B.forceMove(drop_location()) if(user && Adjacent(user) && !issiliconoradminghost(user)) - user.put_in_hands(beaker) + user.put_in_hands(B) if(new_beaker) beaker = new_beaker - else - beaker = null update_icon() - return TRUE /obj/machinery/chem_master/proc/replace_pillbottle(mob/living/user, obj/item/storage/pill_bottle/new_bottle) if(bottle) - bottle.forceMove(drop_location()) + var/obj/item/storage/pill_bottle/B = bottle + B.forceMove(drop_location()) if(user && Adjacent(user) && !issiliconoradminghost(user)) - user.put_in_hands(beaker) + user.put_in_hands(B) else - adjust_item_drop_location(bottle) + adjust_item_drop_location(B) if(new_bottle) bottle = new_bottle - else - bottle = null - update_icon() - return TRUE /obj/machinery/chem_master/on_deconstruction() - replace_beaker(usr) - replace_pillbottle(usr) + var/atom/A = drop_location() + beaker.forceMove(A) + bottle.forceMove(A) return ..() /obj/machinery/chem_master/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \ @@ -261,15 +264,16 @@ if(!name || !reagents.total_volume || !src || QDELETED(src) || !usr.canUseTopic(src, !issilicon(usr))) return var/obj/item/reagent_containers/pill/P - var/target_loc = bottle ? bottle : drop_location() + var/target_loc = drop_location() var/drop_threshold = INFINITY if(bottle) var/datum/component/storage/STRB = bottle.GetComponent(/datum/component/storage) if(STRB) drop_threshold = STRB.max_items - bottle.contents.len + target_loc = bottle for(var/i in 1 to amount) - if(i < drop_threshold) + if(i <= drop_threshold) P = new(target_loc) else P = new(drop_location())