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

Introduction of plantgrowth_tick and rework of the fast/slow_metabolism gene strains #18587

Merged

Conversation

M-Earthfire
Copy link
Contributor

@M-Earthfire M-Earthfire commented Apr 21, 2024

[Hydroponics][Code Quality][rework]

About the PR

This PR introduces var/datum/plantgrowth_tick. This is a holder for a multitude of information that is passed along procs of chemicals and gene strains that interact with the process of hydroponic trays.

Whenever a planttray needs to calculate tray-chemistry/water consumption/plant growth, it creates a plantgrowth_tick-datum. This will be stored in plantpot.current_tick. This datum get's passed into the plant-process procs of every chemical in the plants tray and every gene strain. These procs were changed to modify this datum only. If all changes are applied to the datum, plantgrowth_tick will be passed onto the new /plantpot/proc/HYPresolve_plantgrowth_tick-proc and applies all these changes onto the plantpot. Once these changes are applied, the old plantgrowth_tick is deleted and a fresh one will be created, waiting to be resolved/manipulated.

Since var/datum/plantgrowth_tick and HYPresolve_plantgrowth_tick are made to handle fractional changes, all procs that have a %-chance to modify a plant instead apply their average result directly.

Also, this PR makes plantpots now accept compost and holy water as water-substitutes. Man-eating plants now accept blood instead of water.

Last, but not least, this change enabled a rework of the slow/fast-metabolism trait. They will now affect almost every stat-change within HYPresolve_plantgrowth_tick. Fast metabolism increase water consumption/tray chemistry/plant growth by 50%, but increases the baseline-chem-consumption by 1/tick. Slow metabolism decrease water consumption/tray chemistry/plant growth by 25%, but decrease the baseline-chem-consumption by 0.5/tick.

Above this, this changes have some side-effects. If the plant requires water to grow, ammonia and other growth-modifying chems wont have any effect if the hydroponics tray has not sufficient water.

Why's this needed?

The /process()-proc of hydroponic trays had a good amount of hardcoded interactions, which were in dire need of a cleanup. Also, many chems and gene strains modified the plant directly, called procs of the plantpot or used unnecessary chance-rolls. Bundling all of these into a single datum enables to save on a lot of unecessary calls and cleaned up their respective code.

These changes enabled some more interesting interactions. As an example, fast/slow metabolism were changed to have a new niche within gene strains. Since fast metabolism was simply a worse rapid growth gene strain, changing them up diversifies the selection of gene strains a botanist can go for. With these changes, slow metabolism drastically reduces water consumption now (halving baseline-consumption while only bringing a 25% malus), while being a net negative gene strain, makes it interesting for lazy botanists who just want to use the mister and don't care for hand-filling trays.

Last but not least, the addition of water substitutes gives compost a new role within botany. People within the discord were noting a lack of use for the chemical and also a lack of water if they go for ammonia. With fast metabolism highly increasing water consumption, having compost as another alternative seems like a good idea.

Changelog

(u)Lord_Earthfire
(+)Chemicals in hydroponic trays now should show a lower varience.
(+)Plants accept compost and holy water as alternatives to water. Man-Eating plants accept blood as an alternative to water.
(+)Fast/slow metabolism gene strain now affect many processes around chems in trays or gene strains instead of just improving growth speed.

@keywordlabeler keywordlabeler bot added A-Hydroponics Deals with plants, hydro, etc. C-Code-Quality Cleans up code, refactors things to be more readable or intuitive C-Rework Reworks a feature labels Apr 21, 2024
@github-actions github-actions bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 21, 2024
@NibChocolateeny
Copy link
Contributor

it is good to have nutriants not make growth happen if water is not there - good chnage!

Does grow lamp/glow lotus efffect over-ride and make a plants grow with no water still?

@Studenterhue Studenterhue added the E-Add-To-Wiki A PR that will require changes to the wiki label Apr 29, 2024
@M-Earthfire
Copy link
Contributor Author

M-Earthfire commented May 1, 2024

it is good to have nutriants not make growth happen if water is not there - good chnage!

Does grow lamp/glow lotus efffect over-ride and make a plants grow with no water still?

Yeah, it still does. UV lamps work outside of the plantpot's code.

If i think about it, i could create a plantgrowth tick after the last one has resolved instead of the time i want to begin everything and store it in the plantpot. That way, things like UV lamps could access the plantgrowth_tick and affect it, so they will be resolved with the other changes as well.

M-Earthfire and others added 2 commits May 1, 2024 21:16
Co-authored-by: Tarmunora <48066662+Tarmunora@users.noreply.github.com>
@github-actions github-actions bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 5, 2024
@M-Earthfire
Copy link
Contributor Author

M-Earthfire commented May 5, 2024

Changed the code so the plantgrowth_tick that is resolved on the next process is created when the old one has been resolved or when a new plant is created. It is stored in current_tick in /obj/machinery/plantpot

This means the changes that happen to the plant the next time a plantgrowth_tick is resolved can now be accessed by other objects.

UV-lamps and light lotus have been changed to now access the next plantgrowth_tick. This means the effect of growth they will apply to plants now are affected by fast/slow metabolism and low-water content of the plantpot.

@M-Earthfire M-Earthfire requested a review from Tarmunora May 5, 2024 19:13
Copy link
Contributor

This PR has been inactive for two weeks, and has been automatically marked as stale. This means it is at risk of being auto closed in another week. Please address any outstanding review items and ensure your PR is finished. If you are auto-staled anyway, ask developers if your PR will be merged. Once you have done any of the previous actions then you should request a developer remove the stale label on your PR, to reset the stale timer. If you feel no developer will respond in that time, you may wish to close this PR youself, while you seek developer comment, as you will then be able to reopen the PR yourself.

@github-actions github-actions bot added the S-Stale An inactive PR that has had no updates in the past two weeks label May 20, 2024
@ZeWaka ZeWaka removed the S-Stale An inactive PR that has had no updates in the past two weeks label May 20, 2024
@goonstation-issuebot goonstation-issuebot added the S-Testmerged [Dev Only] Testmerged for extended testing (applied by bot) label May 20, 2024
@goonstation-issuebot goonstation-issuebot removed the S-Testmerged [Dev Only] Testmerged for extended testing (applied by bot) label May 21, 2024
@Tarmunora Tarmunora merged commit 3812933 into goonstation:master May 21, 2024
23 checks passed
github-actions bot pushed a commit that referenced this pull request May 21, 2024
@M-Earthfire M-Earthfire deleted the plant_growth_tick_introduction branch May 22, 2024 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Hydroponics Deals with plants, hydro, etc. C-Code-Quality Cleans up code, refactors things to be more readable or intuitive C-Rework Reworks a feature E-Add-To-Wiki A PR that will require changes to the wiki size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants