Allows chemistry beaker swapping (#22915)

* Added Beaker Swapping

* Moving repeated code

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>

* Moving repeated code 2

* Updated text to be "inside" rather that "on top"

* proper grammar

* removes excitement for placing a beaker

---------

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
This commit is contained in:
Daniel Lenrd
2023-10-26 18:33:16 +09:00
committed by GitHub
parent 1bbe3c92b6
commit 0c383028b6
2 changed files with 14 additions and 11 deletions
@@ -237,10 +237,6 @@
if(isrobot(user))
return
if(beaker)
to_chat(user, "<span class='warning'>Something is already loaded into the machine.</span>")
return
if((istype(I, /obj/item/reagent_containers/glass) || istype(I, /obj/item/reagent_containers/food/drinks)) && user.a_intent != INTENT_HARM)
if(panel_open)
to_chat(user, "<span class='notice'>Close the maintenance panel first.</span>")
@@ -248,12 +244,18 @@
if(!user.drop_item())
to_chat(user, "<span class='warning'>[I] is stuck to you!</span>")
return
beaker = I
I.forceMove(src)
to_chat(user, "<span class='notice'>You set [I] on the machine.</span>")
if(beaker)
user.put_in_hands(beaker)
to_chat(user, "<span class='notice'>You swap [I] with [beaker].</span>")
else
to_chat(user, "<span class='notice'>You set [I] on the machine.</span>")
beaker = I
SStgui.update_uis(src) // update all UIs attached to src
update_icon(UPDATE_ICON_STATE)
return
return ..()
/obj/machinery/chem_dispenser/crowbar_act(mob/user, obj/item/I)
@@ -98,15 +98,16 @@
return TRUE
if((istype(I, /obj/item/reagent_containers/glass) || istype(I, /obj/item/reagent_containers/food/drinks/drinkingglass)) && user.a_intent != INTENT_HARM)
if(beaker)
to_chat(user, "<span class='warning'>A beaker is already loaded into the machine.</span>")
return
if(!user.drop_item())
to_chat(user, "<span class='warning'>[I] is stuck to you!</span>")
return
beaker = I
I.forceMove(src)
to_chat(user, "<span class='notice'>You add the beaker to the machine!</span>")
if(beaker)
user.put_in_hands(beaker)
to_chat(user, "<span class='notice'>You swap [I] with [beaker] inside.</span>")
else
to_chat(user, "<span class='notice'>You add [I] to the machine.</span>")
beaker = I
SStgui.update_uis(src)
update_icon()