Skip to content

Commit

Permalink
[MIRROR] ChemMaster 3000 printing speed based on servo tier (#2179)
Browse files Browse the repository at this point in the history
* ChemMaster 3000 printing speed based on servo tier (#82836)

## About The Pull Request

Reverts the maximum number of containers (pills/patches/etc.) the
ChemMaster 3000 can print back to 50. (Recently changed to 12.5 per tier
in tgstation/tgstation#82002) Instead, the servo
tier determines the speed the batch is printed at.


![image](https://github.com/tgstation/tgstation/assets/83487515/d58a2325-55ff-4087-b73b-9d08ebdf98e5)


![image](https://github.com/tgstation/tgstation/assets/83487515/5d078957-dbc4-483f-8e38-62a815370f66)

## Why It's Good For The Game

Refilling the buffer and pressing print for every 13 pills is pointless
busywork when there is already a delay now implemented per pill printed.

## Changelog

:cl: LT3
balance: ChemMaster can again print a maximum of 50 pills/patches per
run
balance: Higher tier servos increase ChemMaster printing speed
/:cl:

* ChemMaster 3000 printing speed based on servo tier

---------

Co-authored-by: lessthanthree <[email protected]>
  • Loading branch information
2 people authored and StealsThePRs committed Apr 25, 2024
1 parent 0cfd747 commit afe6745
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions code/modules/reagents/chemistry/machinery/chem_master.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define MAX_CONTAINER_PRINT_AMOUNT 50

/obj/machinery/chem_master
name = "ChemMaster 3000"
desc = "Used to separate chemicals and distribute them in a variety of forms."
Expand Down Expand Up @@ -26,8 +28,8 @@
var/printing_progress
/// Number of containers to be printed
var/printing_total
/// The amount of containers that can be printed in 1 cycle
var/printing_amount = 1
/// The time it takes to print a container
var/printing_speed = 0.75 SECONDS

/obj/machinery/chem_master/Initialize(mapload)
create_reagents(100)
Expand Down Expand Up @@ -76,7 +78,7 @@
/obj/machinery/chem_master/examine(mob/user)
. = ..()
if(in_range(user, src) || isobserver(user))
. += span_notice("The status display reads:<br>Reagent buffer capacity: <b>[reagents.maximum_volume]</b> units.<br>Number of containers printed per cycle <b>[printing_amount]</b>.")
. += span_notice("The status display reads:<br>Reagent buffer capacity: <b>[reagents.maximum_volume]</b> units.<br>Printing speed: <b>[0.75 SECONDS / printing_speed * 100]%</b>.")
if(!QDELETED(beaker))
. += span_notice("[beaker] of <b>[beaker.reagents.maximum_volume]u</b> capacity inserted")
. += span_notice("Right click with empty hand to remove beaker")
Expand Down Expand Up @@ -149,10 +151,11 @@
for(var/obj/item/reagent_containers/cup/beaker/beaker in component_parts)
reagents.maximum_volume += beaker.reagents.maximum_volume

printing_amount = 0
//Servo tier determines printing speed
printing_speed = 1 SECONDS
for(var/datum/stock_part/servo/servo in component_parts)
printing_amount += servo.tier * 12.5
printing_amount = min(50, ROUND_UP(printing_amount))
printing_speed -= servo.tier * 0.25 SECONDS
printing_speed = max(printing_speed, 0.25 SECONDS)

///Return a map of category->list of containers this machine can print
/obj/machinery/chem_master/proc/load_printable_containers()
Expand Down Expand Up @@ -266,6 +269,7 @@
/obj/machinery/chem_master/ui_static_data(mob/user)
var/list/data = list()

data["maxPrintable"] = MAX_CONTAINER_PRINT_AMOUNT
data["categories"] = list()
for(var/category in printable_containers)
//make the category
Expand Down Expand Up @@ -295,7 +299,6 @@
.["isPrinting"] = is_printing
.["printingProgress"] = printing_progress
.["printingTotal"] = printing_total
.["maxPrintable"] = printing_amount

//contents of source beaker
var/list/beaker_data = null
Expand Down Expand Up @@ -471,7 +474,7 @@
item_count = text2num(item_count)
if(isnull(item_count) || item_count <= 0)
return FALSE
item_count = min(item_count, printing_amount)
item_count = min(item_count, MAX_CONTAINER_PRINT_AMOUNT)
var/volume_in_each = round(reagents.total_volume / item_count, CHEMICAL_VOLUME_ROUNDING)

// Generate item name
Expand Down Expand Up @@ -535,7 +538,7 @@
//print more items
item_count --
if(item_count > 0)
addtimer(CALLBACK(src, PROC_REF(create_containers), user, item_count, item_name, volume_in_each), 0.75 SECONDS)
addtimer(CALLBACK(src, PROC_REF(create_containers), user, item_count, item_name, volume_in_each), printing_speed)
else
is_printing = FALSE
update_appearance(UPDATE_OVERLAYS)
Expand All @@ -550,3 +553,5 @@
if(!length(containers))
containers = list(CAT_CONDIMENTS = GLOB.reagent_containers[CAT_CONDIMENTS])
return containers

#undef MAX_CONTAINER_PRINT_AMOUNT

0 comments on commit afe6745

Please sign in to comment.