Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chemical production rework #15634

Merged
merged 80 commits into from Sep 5, 2023
Merged

Chemical production rework #15634

merged 80 commits into from Sep 5, 2023

Conversation

TobleroneSwordfish
Copy link
Contributor

@TobleroneSwordfish TobleroneSwordfish commented Sep 1, 2023

[CHEMISTRY] [BALANCE] [INPUT WANTED]

About the PR

General Changes:

  • Chemicals are now mixed at the temperature of precursors. (Hot precursors will make a hot product chem!)

    • Some chemicals are endothermic or exothermic and add/remove heat on reaction.
  • Beakers, extinguishers and barrels will now shatter open completely when an explosive reaction happens inside them, spraying out shards of glass/metal that can embed.
    image

    • Watch out!
  • Reactions not inside inventories or puddles will display little animations on their container. Beakers will visually bubble, puff out flames, smoke, and more!

Chemistry Equipment

  • Beaker lids
    image

    • One-size fits all lids that go on any type of beaker, turning it into a closed container. Useful for some reactions.
  • Condensers
    image

    • Useful pieces of glassware that can contain reagents themselves.
    • Can be attached to beakers, barrels and even other condensers by clickdragging. Both the condenser and container must be within one tile range and not inside anything or any inventory to be connected, and are disconnected by being picked up or moved.
    • Any reagent mixed inside the condenser will be added to attached container. If the container is full, the product instead backflows into the condenser.
    • Allows you to seperate product from reactants without ending the reaction, or automatically mixing products into other containers.
  • Barrels
    image

    • Several quality of life adjustments for mixing bulk chemicals:
      • Barrels now have a glass window on the side, letting you peek in and see how Much Chemical you have stored in it.
      • On the other side, there's a funnel/spout. Clicking the barrel with an empty hand will toggle between spout/funnel mode, changing the behavior when you click with a container. Funnel = Pour into barrel. Spout = Pour from barrel.
      • Barrel lids are much more visible when off/on, since open/closed containers are a more important mechanic.
      • Barrels can now be click-drag attached to ChemMaster 3000s to connect them and allow the ChemMaster to make products from the barrel's contents.

Recipes:

  • Water Boiling

    • Water now boils gradually if under 200C (473.15K), removing more water per cycle the hotter it is.
    • If in open container: Vents steam out as steam clouds, removes heat proportional to water boiled. (2 Degrees K per unit, minimum 1)
    • If in closed container: Creates steam, which is now a unique reagent from water.
    • Steam condenses into water under 100C (373.15K), speed 10u. Steam also escapes open containers into the air.
  • Acetone And Phenol

    • Recipe is now Oil(1) + Fuel(3) + Chlorine(.1) = Acetone(2) + Phenol(2)
    • Non-instant reaction, speed 1u
  • Diethylamine

    • Recipe unchanged
    • Non-instant reaction, speed 1u
    • Endothermic, cools mixture, needs to be heated to keep reacting at 373.15K
    • Diethylamine combusts into a fireflash at 523.15K, so it shouldn't be heated too much.
  • Sulfuric Acid

    • Recipe is now Sulfur(1) + Oxygen(1) + Water(1)
    • Non-instant reaction, speed 3u
    • Highly exothermic, adds 10u of heat per cycle
    • If in open container: Offgasses sulfuric acid smoke based on how hot the reaction is. Cap of 15u per cycle. No smoke if reaction is under 293.15K.
      • Sulfuric acid takes 10u minimum to melt items, so open reactions don't instantly melt your beaker and ruin your life.
    • If in closed container: Mix more sulfuric acid based on heat, shatters (without projectile debris) if container is full and tries to react. Adds extra heat based on amount of extra heat used.
      • No extra product or shatter risk under 293.15K.
      • Extra product is 0.1 per unit of heat over 293.15K, capped to 10u per cycle.
      • Extra heat is 1 degree per unit of extra product + 10, for a max of 30 total heat added per cycle.
    • Remember that chem beakers in chem dispensers count as closed containers!
  • Hydrogen + Carbon Reaction

    • Hydrogen and carbon now react into nothing with each other, causing small physical shocks(randomly between 2 and 6 strength) as it reacts.
    • Non-instant, speed 2u
    • Inhibited by welding fuel
  • Oil

    • Recipe is now hydrogen(0) + carbon(0) + welding fuel(1) = oil(1)
    • Hydrogen and carbon are not used up in this reaction, but must be present.
    • Non-instant, speed 0.02u (but can be sped up with heat!)
    • Running out of welding fuel will also remove the hydrogen and carbon as they react with each other, but you can top the reaction off with fuel without ever adding hydrogen or carbon.
    • Heating above 303.15K speeds up the reaction based on how much heat is added.
      • The more heat added the faster you make oil, with diminishing returns.
      • However, you use more welding fuel exponentially with heat.
      • In short: colder mixes are very slow but efficient, hotter mixes require upkeep but give you much more oil per cycle.
    • You also must be careful not to heat the reaction so much it explodes the fuel.
    • Works well in condensers, as you can use the product without messing up the reactants.
  • Charcoal

    • Recipe is now carbon(1) + ash(1) = charcoal(1) at 513.15K
    • Non-instant, speed 5u
    • Endothermic, removes 5K heat. Requires constant heating or being mixed while burning (see under)
    • Charcoal also burns at 513.15, in an open container (or with oxygen in a closed container.)
      • Burning in a open container adds 5K heat per cycle and creates smoke clouds.
      • Burning in a closed container (uses up oxygen reagent) creates ash, which can be used to fuel more charcoal reactions.
  • Charcoal Steam Mixing

    • "Alternative" recipe that is more difficult to manage but gives much more product.
    • Recipe is carbon(1) + ash(1) + steam(4) = charcoal(5) at 513.15K
    • Non-instant, speed 10
    • More endothermic than regular mix, removes 10K heat per cycle. Requires more heating.
    • Requires careful reagent adding, as ash + heated water = potash.
    • Also must be mixed in a closed container (likely a barrel) since steam will escape any open container.
  • Silver Sulfadiazine

    • Recipe is now chlroine + ammonia + oxygen + silver + sulfur OR chlorine + ammonia + silver nitrate
    • Non-instant reaction, speed 1
    • Unique reaction type: only adds product when the reaction has stopped happening. Will use up all available reactants and then add product right at end.
    • Each cycle spent reacting adds more product to end of reaction.
      • Regular recipe (without silver nitrate) adds 5u to end per cycle
      • Using silver nitrate instead gives you double!
      • You may optionally add oil for a 1.5 multiplier to the mix. More value with nitrate mixing, but still additional product either way.
    • After 50 cycles of mixing, the reaction will sparkle instead of bubble and give you double what it would have. Stacks with silver nitrate and oil bonus for lots and lots of sulfadiazine.
    • After 70 cycles the reaction will make dark poofs instead of sparkles or bubbles, and will stop mixing any extra product. Finish the reaction before or during this!
  • Styptic Powder

    • Recipe unchanged, though the ratio of chemicals is more fluid now.
    • Non-instant reaction, speed 0.
    • Unique reaction type: Doesn't remove or add anything when it starts reacting, but after 30 cycles removes all reactants (independent of ratios) and adds the product, like a delayed instant reaction.
    • Each unit of reactant will add 1u of styptic powder to the finished product.
      • Aluminum, Oxygen and Hydrogen are capped at adding 20u each. So adding 21u of aluminum will only give you 20u of styptic powder for your trouble.
      • Sulfuric acid is uncapped in how much it can add, so any amount of it will mix 1:1 into styptic powder.
    • Physically shocking the reaction vessel will add 5u to the finished product, and create pink sparkles instead of bubbles. Can only be shocked once per cycle. Also plays a light bubbling sound.
      • Sensitive enough that walking with it in your bag will trigger this! Get some cardio.
  • Synthetic Flesh Pustule

    • Recipe: Blood + Synthflesh (Won't mix in your bloodstream)
    • Requires at least 10u of blood and 20u of styptic powder.
    • Not a chemical... but part of the synthflesh production. Creates a physical pustule item on reaction.
    • Doesn't add or remove reagents, but reacts instantly (like styptic powder) after 15 cycles. Mixes differently sized pustules based on the amount of chemicals put in.
      • Less than 40u of styptic powder OR at least 10u of carbon: Small pustule (using carbon lets you turn a big batch of styptic and blood into many small pustules for Fun)
      • Over 40u and less than 80u of styptic powder: Medium pustule
      • Over 80u of styptic powder: Large Pustule
    • Gross.
  • Pustules
    image

    • Small: Comes pre-loaded with 10u of synthflesh. Not a very efficient way to make synthflesh, but can uniquely be thrown at people to apply reagents. Like grody healing hand grenades.
    • Medium And Large: Comes loaded with excess blood from the initial reaction relating to additiona blood and styptic in the container. Can be fed blood or hemolymph or organs and will turn it into synthflesh over time.
      • Will occasionally become Angry. You can tell they're Angry because their heartbeat animation will be irregular, sometimes too fast and sometimes too slow.
      • Angry pustules can be placated by feeding them or smacking them with a sufficiently heavy object.
      • Picking up or holding an angry pustule is not advised.
    • All pustules can be plopped into a beaker/barrel to claim its synthflesh.
    • Medium pustules convert 30u per cycle and can hold a total volume of 100u. Each organ adds 20u synthflesh.
    • Large pustules hold 800u, only convert 5u per cycle but make twice as much synthflesh per unit of blood and four times the synthflesh (80u) per organ.
  • Photophosphide

    • New explosive reagent. Plasma(1) + Phosphorous(1) + Iron(1) + Diethylamine(1) = Photophosphide(1)
    • Instant reaction.
    • Vanishes if left in amounts of less than 1u, speed 3.
    • Explodes (potassium + water size, non-scaling with volume) on contact with any amount of light at all.
      • This includes: Flashlights, station lights, starlight, vending machine lights, PDA lights... any light will set it off.
    • When exploding, creates a white flash on the tile briefly before exploding 0.6 seconds later.
    • Is not hidden from light by bags or storage, will happily blow up in your inventory if you walk into light.
  • Cyanide

    • Now has some additional hazards. Oil(1) + Ammonia(2) + Oxygen(2)
    • Non-instant reaction, speed 5.
    • Will offgas 1u per cycle when reacting.
    • If kept in an open container, will slowly offgas 1u of cyanide as smoke into the air. 1u per 6 cycles.
    • If mixed with water, will offgas twice as often.
    • If mixed with sulfuric acid, will offgas 20u every cycle. Mixing sulfuric acid and cyanide is a bad idea!
    • In short, put a lid on this to keep it from spewing out cyanide smoke. Watch for dark green smoke instead of bubbles.
  • Pentetic Acid

    • New Recipe: photophosphide(1) + ammonia(3) + formaldehyde(1) + cyanide(1) = Pentetic Acid(8)
    • Instant still.
    • Gives you lots of product, but cyanide and photophosphide require specific storage.
      • Has to be mixed in complete darkness because of photophosphide, but can afterwards be taken anywhere.
  • Salbutamol and Salicylic Acid

    • Now combined into one recipe. But you can only mix one at a time. not both.
    • Recipe: Sodium(1) + Phenol(1) + Carbon(1) + Oxygen(1) = Product(4)
    • Non-instant reaction, speed 4
    • Heating to 373.15K will initiate a salicylic acid reaction.
    • Exposing to physical shock will intiate a salbutamol reaction.
      • Salicylic acid:
        • Endothermic, removes 3K heat per cycle.
        • Gives you 3u extra product per cycle if the heat of the reaction is at least 3K higher than it's been before for that reaction.
        • Should be reacted with enough heat to add bonus but not enough to cap out at the heat max, as then you won't be able to get bonus.
        • If physically shocked, flashbang effect + wastes lots of product and reactants. Must be delicate with it and not walk around with it, sensitive.
      • Salbutamol
        • Exothermic, adds 3K heat per cycle.
        • Gives you 1u extra product per cycle if for every 3 cycles consecutively physically shocked, with no cap.
        • Good to keep in your bag while running around.
        • If it reaches 373.15K: flashbang effect + wastes lots of product and reactants. If doing a longer reaction, should be pre-cooled or actively cooled during reaction.
  • Barium + Water

    • Recipe... unchanged.
    • Non-instant reaction, speed 1 (but has a 50% chance to speed up by 1 every cycle)
    • Explodes when the reaction ends, so when either water or barium (or both) run out.
    • Delayed explosive! Dangerous! Slightly unpredictable time to detonate! Makeshift beaker grenades?

Why's this needed?

A common complaint with chemistry is that while the chemicals themselves are interesting and varied, they are almost always produced with long chains of very simple "read it off the wiki" reactions. This PR aims to make the process of mixing chemicals (primarily medical chemicals) more interesting and challenging by introducing more complicated reactions and required conditions.
This is a pretty big shakeup, so feedback and iteration are definitely expected.

Changelog

(u)Flaborized and LeahTheTech
(*)The following chemicals have had their recipes changed: Acetone, phenol, diethylamine, sulfuric acid, oil, charcoal, silver sulfadiazine, styptic powder, synthflesh, cyanide, pentetic acid, salbutamol, salicylic acid.
(*)For full details of the new recipes please see this PR's description.
(*)New chemical: Photophosphide. Creates a small non-scaling explosion when it comes into contact with any form of light. Recipe: Plasma(1) + Phosphorous(1) + Iron(1) + Diethylamine(1)
(*)Added beaker lids which make beakers they are applied to act as closed containers.
(*)Added chemical condensers, can be click-drag attached to glassware to cause any reactions that occur in the condenser to output into the linked glassware.
(+)Chemicals will now retain the temperature of their precursor reagents.
(+)Reactions not inside inventories or puddles will display little animations on their container. Beakers will visually bubble, puff out flames, smoke, and more!
(+)Barrels now have more clear open/closed sprites, a gauge on the side, can be connected to ChemMasters, and can be clicked with an empty hand to toggle between filling the barrel or the beaker.
(+)Barium + water is now a delayed explosion that occurs when the reaction finishes.
(+)Sulfuric acid no longer melts items, so that production of it in an open container doesn't melt an entire set of lab equipment.

TobleroneSwordfish and others added 30 commits June 7, 2023 02:09
…oiling into steam and giving off heat if open reagent container
…erature of the reaction, new 'temperature change' variable that changes reagent holder temp by X on reaction
…y tick of gradual reactions, handle_reaction on beakers when put in/removed from chem dispensers
…ner items, can be applied in reactions to shatter beakers and other reagents that have can_shatter set to TRUE. also replaces smash() on reagent_containers/glass which did almost the same thing
…stead of having a var for whether things can or can't shatter
…lp with smoke from reaction instantly melting beaker its in
…tions work with condensers, sets var true on all appropriate reactions, slightly more forgiving sulfuric acid as well
… shatter_chemically(), adds effects for barrels and extinguishers shattering
…kinda), makes temperature_change use set_reagent_temp so it updates reactions, allows lids on condensers
…ys for barrels, more substantial lid/unlidded sprite differences
…instead of big else if list, also checks for my_atom having a loc and being an obj
…ur new ones, makes barium + water a delayed reaction that explodes at the end
@Flaborized
Copy link
Contributor

Just started playing around with it, very exciting!

I boiled 100u of steam in a closed container and ended up with 2 different kind of steams that eventually all reacts to one type, normal? image

Other bug(?) I got my arm eaten by a pustle, but it didn't show up as No Arm! in my UI for quite a long bit, like a minute. Led me to believe it didn't get eaten and I kept trying to "pet" the pustle :V

Fixed the steam boiling issue, yeah was a bug. Removal of Old steam boiling code was accidentally reverted in an upstream merge, but was easy to fix. Ty for report 👁️

@A4Brogan
Copy link
Contributor

A4Brogan commented Sep 5, 2023

I am conflicted on this.

On the "let's go!" side, a lot of folks enjoy the new gear and mechanics, and a part of me really likes the idea of seeing a tranquil lab setup amidst of the chaos of a shift.

Which is exactly why I have a lot of trepidation.

You see, a lot of our chems are based on real-world formulas. A lot of dangerous chems, ones that are not exactly meant to be attempted in the real world. A lot of them the reagents themselves I am pretty sure will have the feds giving you that twitchy look, and with how some of these three letter agencies have been acting as of late, I don't want them to start looking at my buds with those crazed eyes.

Secondly, real-world chemistry takes time. A lot more time than the usual round lasting on the non-rp servers. I have been around for quite a long time, and I have seen dozens of ways a round can go from "it's boring around here" to "oh God the escape shuttle can't get here fast enough". I fear the slower production time is gonna screw over medical far more than it usually does, which would make medical regulars frustrated.

Third, and this is probably just the ASD talking, but I need to get it off my chest. I have already seen another game go from a fun little romp, to a game that sacrificed fun for the sake of realism, leaving it a tedious, frustrating mess that scares off new folk and frustrates those who stick with it. I do not want Goonstation going down the same path.

This is NOT a thumbs down. I would actually help you ram this right up the figurative ass of the RP servers in fact. The slower pace synergizes so well with the atmosphere of GoonRP that I would actually be disappointed if we didn't use this content there. Hell, I'd seriously consider becoming an RP regular leave my chaos hankering for another station. I just have some reservations that Id love to discuss and figure out how to render my worries moot.

@pali6
Copy link
Member

pali6 commented Sep 5, 2023

!merge_upstream

@TobleroneSwordfish TobleroneSwordfish removed the S-Merge-Conflict Applied and removed when a PR has or no longer has a merge conflict label Sep 5, 2023
@Flaborized
Copy link
Contributor

You see, a lot of our chems are based on real-world formulas. A lot of dangerous chems, ones that are not exactly meant to be attempted in the real world. A lot of them the reagents themselves I am pretty sure will have the feds giving you that twitchy look, and with how some of these three letter agencies have been acting as of late, I don't want them to start looking at my buds with those crazed eyes.

Mostly replying to this bit since I don't have a ton of interesting things to say on the pacing of the chem system (I think it's still pretty fast especially if you multitask) but I think it's important to note that the rework of these chems isn't really trying to go for more realism particularly. Some of the chems take realistic functions of how they behave (ie: sulfuric acid being exothermic) but also other aspects are completely made up because I thought they'd be fun (ie: sulfuric acid producing more and more smoke as it heats up). Real world chem is way, wayy too complex to try and accurately model in this game (at least for me), this is more like using real chemistry as vague references, which is basically what it's always been.

There's not a lot of particular plans to make the systems more realistic just for the sake of it, like I don't really wanna add pH for instance, even though that's pretty vital to think about in Real chemistry. Similarly, we don't have any plans to put actually realistic depictions of illegal chemical production in the game, so don't worry about that. :shelterfrog: See: the single new chem added in this PR (photophosphide) isn't real, and basically makes no sense to exist in reality. It's Space Plasma Magic!

@TobleroneSwordfish
Copy link
Contributor Author

Alright, I think this is okay to merge, most of the obvious bugs have been ironed out and the concept seems to be working well on live.

@TobleroneSwordfish TobleroneSwordfish merged commit b4e84c3 into master Sep 5, 2023
2 checks passed
@TobleroneSwordfish TobleroneSwordfish deleted the chemistry-recipes branch September 5, 2023 16:57
github-actions bot pushed a commit that referenced this pull request Sep 5, 2023
@MintyPhresh
Copy link
Contributor

Most of these recipes still don't react to completion if it dips below the reaction temperature at any point.

@M-Earthfire
Copy link
Contributor

Most of these recipes still don't react to completion if it dips below the reaction temperature at any point.

Like with graphene, that is intended, isn't it?

@MintyPhresh
Copy link
Contributor

Don't think so? I'd be surprised if the graphene interaction was intended

@TDHooligan
Copy link
Contributor

it's an unintended side effect of things not being able to react below 1 unit (which is in turn to stop floats and foams causing weird reactions iirc)
however you could probably have active reactions override this to finish to completion, and any reactants left over below the CHEM_EPSILON just get deleted

@A4Brogan
Copy link
Contributor

A4Brogan commented Sep 6, 2023

Thanks for hearing me out, and reassuring me by pointing out that there is enough obfuscation with certain chems. Really keeps my mind at ease. Time to relearn chemistry!

@TobleroneSwordfish
Copy link
Contributor Author

@MintyPhresh I'm not quite sure what you're trying to say? The reactions restart fine when they go back over the temperature threshold, and small amounts of reagents not triggering the reaction is intended (for example when you're trickling oil into a reaction beaker from a condenser it shouldn't react every tick)

@MintyPhresh
Copy link
Contributor

I'll try and reproduce the issue and make a bug report; I recall I was using the heater appliance in chemistry to make a 100u beaker full of diethylamine. Heat was set to somewhere above the flash point of diethylamine but it was at around 400K for the last 10u of the reaction... Again, I'll get more detailed information later tonight

@MintyPhresh
Copy link
Contributor

Sorry for getting back to this so late. 50u of ammonia and ethanol at default temperature in a chem heater set to 500 will leave 0.5 of each leftover if left alone, even though it's well above the reaction temperature during the last 50u and doesn't dip back down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Chemistry Deals with the chemistry system in some way C-Balance Balance changes, buffs and nerfs E-Input-Wanted Input and feedback are wanted. Also posts a discussion thread on the forums. S-Testmerged [Dev Only] Testmerged for extended testing (applied by bot) size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet