[MIRROR] Adds some basic sanity to the plumbing bottler [MDB IGNORE] (#9480)

* Adds some basic sanity to the plumbing bottler (#62823)

* Adds some basic sanity to the plumbing bottler

* Update code/modules/plumbing/plumbers/bottler.dm

Co-authored-by: Emmanuel S. <emmanuelssr@ gmail.com>

* Update code/modules/plumbing/plumbers/bottler.dm

Co-authored-by: Emmanuel S. <emmanuelssr@ gmail.com>

Co-authored-by: Emmanuel S. <emmanuelssr@ gmail.com>

* Adds some basic sanity to the plumbing bottler

Co-authored-by: oranges <email@oranges.net.nz>
Co-authored-by: Emmanuel S. <emmanuelssr@ gmail.com>
This commit is contained in:
SkyratBot
2021-11-15 20:02:47 -05:00
committed by GitHub
co-authored by Emmanuel S. oranges
parent 636fb69ad3
commit 5e67f4098d
+17
View File
@@ -15,6 +15,8 @@
var/turf/inputspot = null
///where beakers that are already full will be sent
var/turf/badspot = null
///Does the plumbing machine have a correct tile setup
var/valid_output_configuration = FALSE
/obj/machinery/plumbing/bottler/Initialize(mapload, bolt, layer)
. = ..()
@@ -24,6 +26,8 @@
/obj/machinery/plumbing/bottler/examine(mob/user)
. = ..()
. += span_notice("A small screen indicates that it will fill for [wanted_amount]u.")
if(!valid_output_configuration)
. += span_warning("A flashing notification on the screen reads: \"Output location error!\"")
/obj/machinery/plumbing/bottler/can_be_rotated(mob/user, rotation_type)
if(anchored)
@@ -52,15 +56,28 @@
inputspot = get_step(get_turf(src), WEST)
badspot = get_step(get_turf(src), SOUTH)
//If by some miracle
if( ( !valid_output_configuration ) && ( goodspot != null && inputspot != null && badspot != null ) )
valid_output_configuration = TRUE
begin_processing()
///changing input ammount with a window
/obj/machinery/plumbing/bottler/interact(mob/user)
. = ..()
if(!valid_output_configuration)
to_chat(user, span_warning("A flashing notification on the screen reads: \"Output location error!\""))
return .
wanted_amount = clamp(round(input(user,"maximum is 100u","set ammount to fill with") as num|null, 1), 1, 100)
to_chat(user, span_notice(" The [src] will now fill for [wanted_amount]u."))
/obj/machinery/plumbing/bottler/process()
if(machine_stat & NOPOWER)
return
// Sanity check the result locations and stop processing if they don't exist
if(goodspot == null || badspot == null || inputspot == null)
valid_output_configuration = FALSE
return PROCESS_KILL
///see if machine has enough to fill
if(reagents.total_volume >= wanted_amount && anchored)
var/obj/AM = pick(inputspot.contents)///pick a reagent_container that could be used