Skip to content

Commit

Permalink
[MIRROR] Refactored ghetto chem separator (#2791)
Browse files Browse the repository at this point in the history
* Refactored ghetto chem separator (#83275)

## About The Pull Request

This completely reworks how ghetto chem separator works & brings more
depth & immersion to it. To understand the new system let's compare it
with the current one

**Old System** 
1. You insert a beaker containing the reagents you want to separate.
2. You use a lighter/whatever to light a flame, Flame has _magic &
unrealistic_ properties such as
    - It will never heat the beaker above 100k
    - It doesn't burn oxygen or use fuel source to sustain it
- Distillation rate is a constant 5u/s. It doesn't increase as the
solution boils hotter
 
3. The apparatus sorts the reagents alphabetically? & transfers the 1st
reagent from sorted list to the target beaker. It does not care if each
individual reagent has their boiling points & how to separate them based
on that etc. It's just bland overall

**New System**
1. You insert a beaker containing the reagents you want to separate,
just lke the old system
2. You use a lighter/whatever to light a flame just like the old system,
however flame behaves in a more realistic fashion as follows
- It will heat the beaker all the way to 1000k if you let it run long
enough
- It now burns oxygen & uses a fuel source(a secondary beaker which you
must insert containing flamable reagents like oil, welding fuel etc).
When oxygen is the fuel source no O2 gas is required
    - Distillation rate starts at 2u/s & increases with rising temps
- Intensity of the flame depends on the quality of reagents used as
fuel, Oil has best flammable quality & will heat the beaker faster,
other reagents mixed in various proportions can produce better quality
flames which you can understand by examining the aparatus
    - The flame intensity can be adjusted via the burner knob setting
3. Each reagent now has their _boiling computed_ computed from their
mass allowing for realistic interactions, like having to control the
temp's just right to separate your required reagent
4. Temps automatically cooldown and you can install a condenser to
Facilitate faster cooling

Here's the demo video explaining everything


https://github.com/tgstation/tgstation/assets/110812394/ba591859-3fff-4d06-90f8-024c7266f830

## Changelog
:cl:
refactor: ghetto chem separator has been reworked from scratch. See PR
83275 for details
qol: adds examines & screentips for ghetto chem separator
/:cl:

* Refactored ghetto chem separator

---------

Co-authored-by: SyncIt21 <[email protected]>
Co-authored-by: NovaBot13 <[email protected]>
  • Loading branch information
3 people authored and StealsThePRs committed Jun 1, 2024
1 parent e5c22db commit 8886db8
Show file tree
Hide file tree
Showing 5 changed files with 713 additions and 357 deletions.
14 changes: 14 additions & 0 deletions code/datums/components/crafting/chemistry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,20 @@
)
category = CAT_CHEMISTRY


/datum/crafting_recipe/chem_separator
name = "chemical separator"
result = /obj/structure/chem_separator
tool_behaviors = list(TOOL_WELDER)
time = 5 SECONDS
reqs = list(
/obj/item/stack/sheet/mineral/wood = 1,
/obj/item/stack/sheet/glass = 1,
/obj/item/burner = 1,
/obj/item/thermometer = 1,
)
category = CAT_CHEMISTRY

/datum/crafting_recipe/improvised_chem_heater
name = "Improvised chem heater"
result = /obj/machinery/space_heater/improvised_chem_heater
Expand Down
16 changes: 16 additions & 0 deletions code/modules/reagents/chemistry/colors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,19 @@
mixcolor = BlendRGB(R.color, mixcolor, vol_temp/vol_counter)

return mixcolor

/proc/reagent_threshold_overlay(datum/reagents/reagents, fill_icon, fill_prefix, list/fill_icon_thresholds)
RETURN_TYPE(/mutable_appearance)

var/threshold = null
for(var/i in 1 to fill_icon_thresholds.len)
if(ROUND_UP(100 * reagents.total_volume / reagents.maximum_volume) >= fill_icon_thresholds[i])
threshold = i

if(threshold)
var/fill_name = "[fill_prefix][fill_icon_thresholds[threshold]]"
var/mutable_appearance/filling = mutable_appearance(fill_icon, fill_name)
filling.color = mix_color_from_reagents(reagents.reagent_list)
return filling

return null
14 changes: 4 additions & 10 deletions code/modules/reagents/chemistry/machinery/chem_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

/obj/machinery/chem_master/update_appearance(updates)
. = ..()
if(panel_open || (machine_stat & (NOPOWER|BROKEN)))
if(panel_open || !is_operational)
set_light(0)
else
set_light(1, 1, "#fffb00")
Expand All @@ -112,7 +112,7 @@
. += mutable_appearance(icon, base_icon_state + "_overlay_extruder")

// Screen overlay
if(!panel_open && !(machine_stat & (NOPOWER | BROKEN)))
if(!panel_open && is_operational)
var/screen_overlay = base_icon_state + "_overlay_screen"
if(is_printing)
screen_overlay += "_active"
Expand All @@ -123,15 +123,9 @@

// Buffer reagents overlay
if(reagents.total_volume)
var/threshold = null
var/static/list/fill_icon_thresholds = list(10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
for(var/i in 1 to fill_icon_thresholds.len)
if(ROUND_UP(100 * (reagents.total_volume / reagents.maximum_volume)) >= fill_icon_thresholds[i])
threshold = i
if(threshold)
var/fill_name = "chemmaster[fill_icon_thresholds[threshold]]"
var/mutable_appearance/filling = mutable_appearance('icons/obj/medical/reagent_fillings.dmi', fill_name)
filling.color = mix_color_from_reagents(reagents.reagent_list)
var/mutable_appearance/filling = reagent_threshold_overlay(reagents, 'icons/obj/medical/reagent_fillings.dmi', "chemmaster", fill_icon_thresholds)
if(!isnull(filling))
. += filling

/obj/machinery/chem_master/Exited(atom/movable/gone, direction)
Expand Down
Loading

0 comments on commit 8886db8

Please sign in to comment.