mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-14 09:35:30 +01:00
21b4095dfd
Upstream 04/17/2026 fixes https://github.com/Bubberstation/Bubberstation/issues/5549 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com> Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com> Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com> Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com> Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com> Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com> Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com> Co-authored-by: loganuk <fakeemail123@aol.com> Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com> Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com> Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com> Co-authored-by: Lucy <lucy@absolucy.moe> Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com> Co-authored-by: Isratosh <Isratosh@hotmail.com> Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com> Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com> Co-authored-by: Alexander V. <volas@ya.ru> Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com> Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com> Co-authored-by: Tim <timothymtorres@gmail.com> Co-authored-by: Iamgoofball <iamgoofball@gmail.com> Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com> Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com> Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com> Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com> Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com> Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com> Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com> Co-authored-by: Josh <josh.adam.powell@gmail.com> Co-authored-by: Josh Powell <josh.powell@softwire.com> Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com> Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com> Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com> Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
103 lines
4.0 KiB
Plaintext
103 lines
4.0 KiB
Plaintext
/obj/machinery/plumbing/bottler
|
|
name = "chemical bottler"
|
|
desc = "Puts reagents into containers, like bottles and beakers in the tile facing the green light spot, they will exit on the red light spot if successfully filled."
|
|
icon_state = "bottler"
|
|
reagents = /datum/reagents
|
|
layer = ABOVE_ALL_MOB_LAYER
|
|
plane = ABOVE_GAME_PLANE
|
|
reagent_flags = /obj/machinery/plumbing::reagent_flags | DRAINABLE
|
|
buffer = 100
|
|
|
|
///how much do we fill
|
|
var/wanted_amount = 10
|
|
///where things are sent
|
|
var/turf/goodspot = null
|
|
///where things are taken
|
|
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, layer)
|
|
. = ..()
|
|
AddComponent(/datum/component/plumbing/simple_demand, layer, distinct_reagent_cap = 3)
|
|
setDir(dir)
|
|
|
|
/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!\"")
|
|
|
|
///changes the tile array
|
|
/obj/machinery/plumbing/bottler/setDir(newdir)
|
|
. = ..()
|
|
var/turf/target_turf = get_turf(src)
|
|
switch(dir)
|
|
if(NORTH)
|
|
goodspot = get_step(target_turf, NORTH)
|
|
inputspot = get_step(target_turf, SOUTH)
|
|
badspot = get_step(target_turf, EAST)
|
|
if(SOUTH)
|
|
goodspot = get_step(target_turf, SOUTH)
|
|
inputspot = get_step(target_turf, NORTH)
|
|
badspot = get_step(target_turf, WEST)
|
|
if(WEST)
|
|
goodspot = get_step(target_turf, WEST)
|
|
inputspot = get_step(target_turf, EAST)
|
|
badspot = get_step(target_turf, NORTH)
|
|
if(EAST)
|
|
goodspot = get_step(target_turf, EAST)
|
|
inputspot = get_step(target_turf, WEST)
|
|
badspot = get_step(target_turf, 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 .
|
|
var/new_amount = tgui_input_number(user, "Set Amount to Fill", "Desired Amount", max_value = reagents.maximum_volume, round_value = TRUE)
|
|
if(!new_amount || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH))
|
|
return .
|
|
wanted_amount = new_amount
|
|
to_chat(user, span_notice(" The [src] will now fill for [wanted_amount]u."))
|
|
|
|
/obj/machinery/plumbing/bottler/process(seconds_per_tick)
|
|
if(!is_operational)
|
|
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, is anchored down and has any inputspot objects to pick from
|
|
if(reagents.total_volume >= wanted_amount && anchored && length(inputspot.contents))
|
|
use_energy(active_power_usage * seconds_per_tick)
|
|
var/obj/AM = pick(inputspot.contents)///pick a reagent_container that could be used
|
|
//allowed containers
|
|
var/static/list/allowed_containers = list(
|
|
/obj/item/reagent_containers/cup,
|
|
/obj/item/ammo_casing/shotgun/dart,
|
|
)
|
|
if(is_type_in_list(AM, allowed_containers))
|
|
var/obj/item/B = AM
|
|
///see if it would overflow else inject
|
|
if((B.reagents.total_volume + wanted_amount) <= B.reagents.maximum_volume)
|
|
reagents.trans_to(B, wanted_amount)
|
|
B.forceMove(goodspot)
|
|
return
|
|
///glass was full so we move it away
|
|
AM.forceMove(badspot)
|
|
else if(istype(AM, /obj/item/slime_extract)) ///slime extracts need inject
|
|
AM.forceMove(goodspot)
|
|
reagents.trans_to(AM, wanted_amount, methods = INJECT)
|
|
else if(istype(AM, /obj/item/slimecross/industrial)) ///no need to move slimecross industrial things
|
|
reagents.trans_to(AM, wanted_amount, methods = INJECT)
|