mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 03:59:59 +01:00
## About The Pull Request The overall behaviour of everything should stay the same but the memory & speed of these components has been slightly improved and when you scale that across large plumbing factories you get a substantial improvement. Here's a list of the most noticeable changes along with many others that aren't worth mentioning - Removed vars `use_overlays`, `turn_connects`, `recipient_reagents_holder` - `active` var is now replaced with a proc which simply returns is the machine wrenched or not - `turn_connects` has been removed because all machines have their pipes rotate when the machine is rotated. This also removed all the static icon states ending with `-s` from the `dmi` file thus reducing that file size as well - `extend_pipe_to_edge` var is directly integrated into `cut_overlays()` because it's use cases were limited such for showers & sinks - Simplified `Initialize()` a lot. Removed params `start`, `turn_connects`, `custom_receiver`, `extend_pipe_to_edge`. We now only pass `bolt_layer` making that proc faster & less convoluted - Replaced `set_recipient_reagents_holder()` proc with `recipient_reagents_holder()` which returns the reagent holder for holding reagents instead of storing it in the component. This removes the need to hook a qdel signal on the holder & we don't need to keep track of it - Merged a ton of procs to reduce overhead & reduce file size - Plumbing ducts creating the network at mapload is faster without using recursion and the timer subsystem - Deconstructing plumbing ducts is faster in reconstructing the network without using recursion and the timer subsystem This makes managing plumbing code less convoluted & overall better for the foreseeable future. See the lines of code removed vs added and still preserves behaviour ## Changelog 🆑 qol: added examines & screentips for ducts & stack of ducts qol: you can wrench a stack of ducts on the ground to create a pipe refactor: plumbing code has been improved overall. Report bugs on github sprite: removed unused static(does not rotate with machine) icon states for plumbing connections /🆑 --------- Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
51 lines
1.8 KiB
Plaintext
51 lines
1.8 KiB
Plaintext
///it splits the reagents however you want. So you can "every 60 units, 45 goes left and 15 goes straight". The side direction is EAST, you can change this in the component
|
|
/obj/machinery/plumbing/splitter
|
|
name = "chemical splitter"
|
|
desc = "A chemical splitter for smart chemical factorization. Waits till a set of conditions is met and then stops all input and splits the buffer evenly or other in two ducts."
|
|
icon_state = "splitter"
|
|
buffer = 100
|
|
density = FALSE
|
|
|
|
///constantly switches between TRUE and FALSE. TRUE means the batch tick goes straight, FALSE means the next batch goes in the side duct.
|
|
var/turn_straight = TRUE
|
|
///how much we must transfer straight. note input can be as high as 10 reagents per process, usually
|
|
var/transfer_straight = 5
|
|
///how much we must transfer to the side
|
|
var/transfer_side = 5
|
|
//the maximum you can set the transfer to
|
|
var/max_transfer = 9
|
|
|
|
/obj/machinery/plumbing/splitter/Initialize(mapload, layer)
|
|
. = ..()
|
|
AddComponent(/datum/component/plumbing/splitter, layer)
|
|
|
|
/obj/machinery/plumbing/splitter/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "ChemSplitter", name)
|
|
ui.open()
|
|
|
|
/obj/machinery/plumbing/splitter/ui_data(mob/user)
|
|
var/list/data = list()
|
|
data["straight"] = transfer_straight
|
|
data["side"] = transfer_side
|
|
data["max_transfer"] = max_transfer
|
|
return data
|
|
|
|
/obj/machinery/plumbing/splitter/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
. = TRUE
|
|
switch(action)
|
|
if("set_amount")
|
|
var/direction = params["target"]
|
|
var/value = clamp(text2num(params["amount"]), 1, max_transfer)
|
|
switch(direction)
|
|
if("straight")
|
|
transfer_straight = value
|
|
if("side")
|
|
transfer_side = value
|
|
else
|
|
return FALSE
|