Skip to content

Commit

Permalink
[Port] Chemmaster refactor (#1644)
Browse files Browse the repository at this point in the history
* ChemMaster and CondiMaster refactored, prints items over time (tgstation#75849)

![ZceBfkJaFG](https://github.com/tgstation/tgstation/assets/3625094/aedf6178-dad7-40b2-a7ea-18da6f56e9e8)

Chem master has been using some hard coded styles for containers, pills
and patches. Some people didn't bother to update styles, and they stayed
outdated.

Now it uses just a list of reagent containers instead, which makes it
easy to add new containers - just one line of code.

Also changed its sprite for better animations, emissive overlay, and to
display buffer reagents on the sprite itself.

Now it plays printing animation when you actually print containers and
servos have a purpose now - they increase the amount of containers
printed at once by up to 100% * part_tier. Pills and patches are always
printed at double amount.

And fixes tgstation#59734

Makes chem master easier to manage in code and easier to use in-game.

Printing delay is added for consistency with other fabrication machines
(like lathes), to give a purpose for the servo motor used in
construction, for visuals (to show the printing animation only when
something is being printed, and not just when you move stuff in and out
of buffer as before) and to prevent people from spamming the world with
unneeded objects with 0 second delay.

:cl:
qol: Chemmaster UI tweaked
fix: Fixed chem master showing wrong data during reagent analysis
fix: Fixed chem master not working with fermented drinks
image: Chemmaster resprited, now has an indicator for buffer reagents
refactor: Refactored chemmaster code, it now uses reagent containers
instead of styles
balance: Chemmaster now uses servos and has printing animation of 0.75
second duration. Outputs 1 container or up to 2 pills/patches per cycle
by default. Can be upgraded to output up to 4 and 8 with t4 servos.
/:cl:

* Condiments resprited (tgstation#75715)

![image](https://github.com/tgstation/tgstation/assets/3625094/021a6d6e-6f25-40e1-8c1a-6cebb25e7614)

Resprited many condiment containers.

And a tray (don't know why, it just was in the dmi)

Replaced the old condiment bottle from Condi Master with the one that
was used in Chem Master before the test tubes.

More in line with other 3/4 stuff

:cl:
image: Resprited many condiment containers
image: Added a sprite for cooking oil / corn oil container
image: Replaced old condiment bottles with the newer bottles in Condi
Master
/:cl:

* Test tubes and racks (tgstation#75179)

![image](https://user-images.githubusercontent.com/3625094/236466928-dd7beffb-ff26-4d78-a10b-7be29aae56f2.png)

Bottles have varied volumes - some of them hold 30, some 50, while
having the same sprite. And the size is comparable with small beaker, so
it was a bit weird that it can hold only 30 units. Now the default
bottle volume is 50, consistently.

Test tubes are the new 30u container that replaces bottles created in
chem master (but not condi master) and pandemic.

For better management of test tubes, this PR also adds a rack that can
be crafted from 1 wooden plank. The rack stores up to 10 test tubes and
can pick them up and drop quickly similar to how the pill bottle works
with pills.

![image](https://user-images.githubusercontent.com/3625094/236472298-df4932a4-4620-4a6b-87c0-67efc7317d02.png)

Consistent volume for the bottle sprite instead of some being 30, some
50.

Essential attribute for chemical lab, good company for Chem Separator.

:cl: MTandi, coiledlamb
add: Added test tubes and racks for them
balance: All 30u bottles now have 50u volume and chem master/pandemic
spawn tubes instead of bottles
/:cl:

* fix conflicts in chemical.dmi

* merging dmis is too hard

* vials

* removes a null reference error i made

* gives test tubes a crafting recipe (must be researched)

* factory ouput uses same pill/patch styles as chem master

* why were these sprites not added, i dont get dmi files

* remove extra newlines

* Porting some of tg#79059

* fixed merge conflict correctly

* context begone!

---------

Co-authored-by: Andrew <mt.forspam@gmail.com>
  • Loading branch information
AlbertNanotracen and MTandi committed Jun 24, 2024
1 parent d9abba9 commit 3a5bc5c
Show file tree
Hide file tree
Showing 64 changed files with 1,444 additions and 888 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2657,8 +2657,8 @@
/obj/structure/disposalpipe/segment,
/obj/effect/decal/cleanable/dirt,
/obj/machinery/firealarm/directional/east,
/obj/item/storage/box/vials,
/obj/item/storage/box/vials,
/obj/item/storage/box/tube,
/obj/item/storage/box/tube,
/obj/item/device/antibody_scanner,
/obj/item/device/antibody_scanner,
/obj/item/clothing/gloves/latex,
Expand Down
4 changes: 2 additions & 2 deletions _maps/map_files/BoxStation/BoxStation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -6123,7 +6123,7 @@
pixel_x = 4;
pixel_y = 4
},
/obj/item/storage/box/vials{
/obj/item/storage/box/tube{
pixel_y = 4;
pixel_x = -2
},
Expand Down Expand Up @@ -26185,7 +26185,7 @@
pixel_x = 4;
pixel_y = 4
},
/obj/item/storage/box/vials{
/obj/item/storage/box/tube{
pixel_y = 4;
pixel_x = -2
},
Expand Down
20 changes: 10 additions & 10 deletions _maps/map_files/Deltastation/DeltaStation2.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -52704,16 +52704,16 @@
/obj/item/reagent_containers/dropper,
/obj/item/reagent_containers/syringe/antiviral,
/obj/item/reagent_containers/syringe/antiviral,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/storage/box/monkeycubes/mousecubes,
/obj/item/storage/box/monkeycubes/mousecubes,
/obj/item/storage/box/monkeycubes/mousecubes,
Expand Down
4 changes: 2 additions & 2 deletions _maps/map_files/IceBoxStation/IceBoxStation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -49456,11 +49456,11 @@
/obj/item/device/antibody_scanner,
/obj/item/device/antibody_scanner,
/obj/item/device/antibody_scanner,
/obj/item/storage/box/vials{
/obj/item/storage/box/tube{
pixel_y = 10;
pixel_x = -10
},
/obj/item/storage/box/vials{
/obj/item/storage/box/tube{
pixel_y = 10;
pixel_x = -10
},
Expand Down
16 changes: 8 additions & 8 deletions _maps/map_files/MetaStation/MetaStation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -28524,14 +28524,14 @@
dir = 8
},
/obj/item/device/antibody_scanner,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/device/antibody_scanner,
/obj/item/device/antibody_scanner,
/obj/item/device/antibody_scanner,
Expand Down
16 changes: 8 additions & 8 deletions _maps/map_files/tramstation/tramstation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -6145,14 +6145,14 @@
/obj/effect/turf_decal/trimline/green/filled/line,
/obj/item/radio/intercom/directional/south,
/obj/structure/table/glass,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/clothing/glasses/science,
/obj/item/clothing/glasses/science,
/obj/item/clothing/glasses/hud/health,
Expand Down
6 changes: 3 additions & 3 deletions _maps/templates/holodeck_medicalsim.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,9 @@
/obj/effect/turf_decal/tile/yellow/anticorner/contrasted{
dir = 1
},
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/beaker/vial,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/tube,
/turf/open/floor/holofloor{
icon_state = "white"
},
Expand Down
20 changes: 8 additions & 12 deletions code/__DEFINES/reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,18 @@
#define SYNTHFLESH_UNHUSK_AMOUNT 100

//used by chem masters and pill presses
#define PILL_STYLE_COUNT 22 //Update this if you add more pill icons or you die
#define RANDOM_PILL_STYLE 22 //Dont change this one though

//used by chem masters and pill presses
//update this if you add more patch icons
#define PATCH_STYLE_LIST list("bandaid", "bandaid_brute", "bandaid_burn", "bandaid_both") //icon_state list
#define DEFAULT_PATCH_STYLE "bandaid"

// The categories of reagent packaging
#define CAT_CONDIMENTS "condiments"
#define CAT_TUBES "tubes"
#define CAT_PILLS "pills"
#define CAT_PATCHES "patches"
#define DEFAULT_PATCH_STYLE "bandaid_blank"
//used by chem master
#define CONDIMASTER_STYLE_AUTO "auto"
#define CONDIMASTER_STYLE_FALLBACK "_"

#define ALLERGIC_REMOVAL_SKIP "Allergy"

/// the default temperature at which chemicals are added to reagent holders at
#define DEFAULT_REAGENT_TEMPERATURE 300

//Used in holder.dm/equlibrium.dm to set values and volume limits
///stops floating point errors causing issues with checking reagent amounts
#define CHEMICAL_QUANTISATION_LEVEL 0.0001
Expand All @@ -70,9 +65,10 @@
#define CHEMICAL_NORMAL_PH 7.000
///The maximum temperature a reagent holder can attain
#define CHEMICAL_MAXIMUM_TEMPERATURE 99999

///The default purity of all non reacted reagents
#define REAGENT_STANDARD_PURITY 0.75
/// the default temperature at which chemicals are added to reagent holders at
#define DEFAULT_REAGENT_TEMPERATURE 300

//reagent bitflags, used for altering how they works
///allows on_mob_dead() if present in a dead body
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/devices/portable_chem_mixer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
atom_storage.set_holdable(list(
/obj/item/reagent_containers/cup/beaker,
/obj/item/reagent_containers/cup/bottle,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/cup/glass/waterbottle,
/obj/item/reagent_containers/condiment,
))
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/stacks/sheets/sheet_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ GLOBAL_LIST_INIT(wood_recipes, list ( \
new/datum/stack_recipe("bonfire", /obj/structure/bonfire, 10, time = 6 SECONDS, one_per_turf = TRUE, on_solid_ground = TRUE, category = CAT_TOOLS), \
new/datum/stack_recipe("easel", /obj/structure/easel, 5, time = 1 SECONDS, one_per_turf = TRUE, on_solid_ground = TRUE, category = CAT_ENTERTAINMENT), \
new/datum/stack_recipe("noticeboard", /obj/item/wallframe/noticeboard, 1, time = 1 SECONDS, one_per_turf = FALSE, on_solid_ground = FALSE, check_density = FALSE, category = CAT_FURNITURE), \
new/datum/stack_recipe("test tube rack", /obj/item/storage/test_tube_rack, 1, time = 1 SECONDS, check_density = FALSE, category = CAT_CHEMISTRY), \
null, \
new/datum/stack_recipe_list("pews", list(
new /datum/stack_recipe("pew (middle)", /obj/structure/chair/pew, 3, one_per_turf = TRUE, on_solid_ground = TRUE, category = CAT_FURNITURE),
Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/items/storage/bags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@
/obj/item/reagent_containers/cup/glass/waterbottle,
/obj/item/reagent_containers/cup/beaker,
/obj/item/reagent_containers/cup/bottle,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/medigel,
/obj/item/reagent_containers/pill,
/obj/item/reagent_containers/syringe,
Expand Down Expand Up @@ -477,6 +478,7 @@
/obj/item/reagent_containers/dropper,
/obj/item/reagent_containers/cup/beaker,
/obj/item/reagent_containers/cup/bottle,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/hypospray/medipen,
/obj/item/reagent_containers/syringe,
/obj/item/weapon/virusdish,//Monkestation Addition
Expand Down Expand Up @@ -508,6 +510,7 @@
/obj/item/reagent_containers/dropper,
/obj/item/reagent_containers/cup/beaker,
/obj/item/reagent_containers/cup/bottle,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/syringe,
/obj/item/slime_extract,
/obj/item/swab,
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/storage/belt.dm
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
/obj/item/reagent_containers/dropper,
/obj/item/reagent_containers/cup/beaker,
/obj/item/reagent_containers/cup/bottle,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/hypospray,
/obj/item/reagent_containers/medigel,
/obj/item/reagent_containers/pill,
Expand Down Expand Up @@ -850,6 +851,7 @@
/obj/item/plant_analyzer,
/obj/item/reagent_containers/cup/beaker,
/obj/item/reagent_containers/cup/bottle,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/spray/pestspray,
/obj/item/reagent_containers/spray/plantbgone,
/obj/item/secateurs,
Expand Down
29 changes: 29 additions & 0 deletions code/game/objects/items/storage/medkit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
/obj/item/reagent_containers/dropper,
/obj/item/reagent_containers/cup/beaker,
/obj/item/reagent_containers/cup/bottle,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/pill,
/obj/item/reagent_containers/syringe,
/obj/item/reagent_containers/medigel,
Expand Down Expand Up @@ -673,3 +674,31 @@
/obj/item/storage/organbox/preloaded/Initialize(mapload)
. = ..()
reagents.add_reagent(/datum/reagent/cryostylane, reagents.maximum_volume)

/obj/item/storage/test_tube_rack
name = "test tube rack"
desc = "A wooden rack for storing test tubes."
icon_state = "rack"
base_icon_state = "rack"
icon = 'icons/obj/medical/chemical.dmi'
inhand_icon_state = "contsolid"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
w_class = WEIGHT_CLASS_SMALL

/obj/item/storage/test_tube_rack/Initialize(mapload)
. = ..()
atom_storage.allow_quick_gather = TRUE
atom_storage.max_slots = 8
atom_storage.screen_max_columns = 4
atom_storage.screen_max_rows = 2
atom_storage.set_holdable(list(
/obj/item/reagent_containers/cup/tube,
))

/obj/item/storage/test_tube_rack/attack_self(mob/user)
emptyStorage()

/obj/item/storage/test_tube_rack/update_icon_state()
icon_state = "[base_icon_state][contents.len > 0 ? contents.len : null]"
return ..()
15 changes: 15 additions & 0 deletions code/modules/asset_cache/assets/chemmaster.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
///Icons for containers printed in ChemMaster
/datum/asset/spritesheet/chemmaster
name = "chemmaster"

/datum/asset/spritesheet/chemmaster/create_spritesheets()
var/list/ids = list()
for(var/category in GLOB.chem_master_containers)
for(var/obj/item/reagent_containers/container as anything in GLOB.chem_master_containers[category])
var/icon_file = initial(container.icon)
var/icon_state = initial(container.icon_state)
var/id = sanitize_css_class_name("[container]")
if(id in ids) // exclude duplicate containers
continue
ids += id
Insert(id, icon_file, icon_state)
22 changes: 12 additions & 10 deletions code/modules/asset_cache/assets/condiments.dm
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
/datum/asset/spritesheet/simple/condiments
name = "condiments"
assets = list(
CONDIMASTER_STYLE_FALLBACK = 'icons/ui_icons/condiments/emptycondiment.png',
"enzyme" = 'icons/ui_icons/condiments/enzyme.png',
CONDIMASTER_STYLE_FALLBACK = 'icons/ui_icons/condiments/bottle.png',
"flour" = 'icons/ui_icons/condiments/flour.png',
"mayonnaise" = 'icons/ui_icons/condiments/mayonnaise.png',
"milk" = 'icons/ui_icons/condiments/milk.png',
"blackpepper" = 'icons/ui_icons/condiments/peppermillsmall.png',
"rice" = 'icons/ui_icons/condiments/rice.png',
"sodiumchloride" = 'icons/ui_icons/condiments/saltshakersmall.png',
"soymilk" = 'icons/ui_icons/condiments/soymilk.png',
"soysauce" = 'icons/ui_icons/condiments/soysauce.png',
"sugar" = 'icons/ui_icons/condiments/sugar.png',
"ketchup" = 'icons/ui_icons/condiments/ketchup.png',
"milk" = 'icons/ui_icons/condiments/milk.png',
"enzyme" = 'icons/ui_icons/condiments/enzyme.png',
"capsaicin" = 'icons/ui_icons/condiments/hotsauce.png',
"frostoil" = 'icons/ui_icons/condiments/coldsauce.png',
"bbqsauce" = 'icons/ui_icons/condiments/bbqsauce.png',
"cornoil" = 'icons/ui_icons/condiments/oliveoil.png',
"soymilk" = 'icons/ui_icons/condiments/soymilk.png',
"soysauce" = 'icons/ui_icons/condiments/soysauce.png',
"ketchup" = 'icons/ui_icons/condiments/ketchup.png',
"mayonnaise" = 'icons/ui_icons/condiments/mayonnaise.png',
"oliveoil" = 'icons/ui_icons/condiments/oliveoil.png',
"cooking_oil" = 'icons/ui_icons/condiments/cookingoil.png',
"peanut_butter" = 'icons/ui_icons/condiments/peanutbutter.png',
"cherryjelly" = 'icons/ui_icons/condiments/cherryjelly.png',
"honey" = 'icons/ui_icons/condiments/honey.png',
"blackpepper" = 'icons/ui_icons/condiments/peppermillsmall.png',
"sodiumchloride" = 'icons/ui_icons/condiments/saltshakersmall.png',
)
8 changes: 0 additions & 8 deletions code/modules/asset_cache/assets/patches.dm

This file was deleted.

26 changes: 0 additions & 26 deletions code/modules/asset_cache/assets/pills.dm

This file was deleted.

2 changes: 2 additions & 0 deletions code/modules/clothing/suits/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/obj/item/plant_analyzer,
/obj/item/reagent_containers/cup/beaker,
/obj/item/reagent_containers/cup/bottle,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/spray/pestspray,
/obj/item/reagent_containers/spray/plantbgone,
/obj/item/secateurs,
Expand Down Expand Up @@ -267,6 +268,7 @@
/obj/item/reagent_containers/dropper,
/obj/item/reagent_containers/cup/beaker,
/obj/item/reagent_containers/cup/bottle,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/hypospray,
/obj/item/reagent_containers/syringe,
/obj/item/retractor,
Expand Down
1 change: 1 addition & 0 deletions code/modules/clothing/suits/labcoat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
/obj/item/reagent_containers/dropper,
/obj/item/reagent_containers/cup/beaker,
/obj/item/reagent_containers/cup/bottle,
/obj/item/reagent_containers/cup/tube,
/obj/item/reagent_containers/hypospray,
/obj/item/reagent_containers/pill,
/obj/item/reagent_containers/syringe,
Expand Down
Loading

0 comments on commit 3a5bc5c

Please sign in to comment.