Adds a Trimmed Down Version of Monkestation's Plant Infuser - #480
Open
ADepressedPyroshark wants to merge 13 commits into
Open
ADepressedPyroshark wants to merge 13 commits into
ADepressedPyroshark wants to merge 13 commits into
Conversation
XeonMations
requested changes
Sep 2, 2026
Comment on lines
+206
to
+261
| if(held_beaker.reagents && held_beaker.reagents.reagent_list.len > 0) | ||
| var/list/current_reagent_instances = held_beaker.reagents.reagent_list.Copy() | ||
|
|
||
| for (var/datum/reagent/reagent_instance in current_reagent_instances) | ||
| if(!reagent_instance) | ||
| continue | ||
|
|
||
| var/reagent_id_path = reagent_instance.type | ||
| if (!(reagent_instance.chemical_flags & REAGENT_CAN_BE_SYNTHESIZED)) | ||
| to_chat(usr, span_warning("[reagent_instance.name] cannot be infused into plants!")) | ||
| continue | ||
|
|
||
| var/volume = reagent_instance.volume | ||
| if (volume <= 0) | ||
| continue | ||
|
|
||
| if(volume >= 100) | ||
| var/random_rate = rand(3, 25) / 100 | ||
|
|
||
| var/datum/plant_gene/reagent/existing_gene = null | ||
| for(var/datum/plant_gene/gene_check in seed.genes) | ||
| if(istype(gene_check, /datum/plant_gene/reagent)) | ||
| var/datum/plant_gene/reagent/reagent_gene = gene_check | ||
| if(reagent_gene.reagent_id == reagent_id_path) | ||
| existing_gene = reagent_gene | ||
| break | ||
|
|
||
| if(existing_gene) | ||
| /// Add to existing gene's rate | ||
| to_chat(usr, span_notice("Increased [reagent_instance.name] rate in [seed] from [round(existing_gene.rate * 100)]% to [round(existing_gene.rate * 100) + round(random_rate * 100)]%.")) | ||
| existing_gene.rate += random_rate | ||
| else | ||
| /// Create a new gene with the random rate | ||
| var/datum/plant_gene/reagent/new_gene = new /datum/plant_gene/reagent(reagent_id_path, random_rate) | ||
| if(new_gene.can_add(seed)) | ||
| seed.genes += new_gene | ||
| to_chat(usr, span_notice("Successfully infused [reagent_instance.name] into [seed] with a rate of [round(new_gene.rate * 100)]%.")) | ||
| else | ||
| /// Skips adding the gene mutation if it failed to add | ||
| to_chat(usr, span_warning("Could not add new gene for [reagent_instance.name] to [seed].")) | ||
| qdel(new_gene) | ||
| continue | ||
|
|
||
| successful_reagents += reagent_instance | ||
| else | ||
| to_chat(usr, span_notice("Attempted to infuse [reagent_instance.name] into [seed], but it failed. Infusion requires a volume of 100 units.")) | ||
|
|
||
|
|
||
| seed.reagents_from_genes() | ||
| else | ||
| to_chat(usr, span_warning("The beaker is empty! Nothing to infuse.")) | ||
|
|
||
| if(held_beaker && held_beaker.reagents) | ||
| held_beaker.reagents.remove_all(held_beaker.reagents.total_volume) | ||
| successful_reagents = list() | ||
| potential_damage = 0 |
Collaborator
There was a problem hiding this comment.
Use early returns
Do not enclose a proc in an if-block when returning on a condition is more feasible
This is bad:
/datum/datum1/proc/proc1()
if (thing1)
if (!thing2)
if (thing3 == 30)
do stuff
This is good:
/datum/datum1/proc/proc1()
if (!thing1)
return
if (thing2)
return
if (thing3 != 30)
return
do stuff
This prevents nesting levels from getting deeper then they need to be.
…nodes.dm Co-authored-by: XeonMations <62395746+XeonMations@users.noreply.github.com>
Co-authored-by: XeonMations <62395746+XeonMations@users.noreply.github.com>
Absolucy
suggested changes
Sep 3, 2026
| @@ -0,0 +1,293 @@ | |||
| import { toFixed } from 'tgui-core/math'; | |||
Contributor
There was a problem hiding this comment.
would very much prefer this entire UI/file be converted to tsx
Comment on lines
+56
to
+61
| <img | ||
| src={`data:image/jpeg;base64,${node.image}`} | ||
| style={{ | ||
| verticalAlign: 'middle', | ||
| horizontalAlign: 'middle', | ||
| }} |
Contributor
There was a problem hiding this comment.
please use DmIcon and just pass the icon and icon_state in the ui data
Comment on lines
+16
to
+30
| export const TimeFormat = (props) => { | ||
| const { value } = props; | ||
|
|
||
| const seconds = toFixed(Math.floor((value / 10) % 60)).padStart(2, '0'); | ||
| const minutes = toFixed(Math.floor((value / (10 * 60)) % 60)).padStart( | ||
| 2, | ||
| '0', | ||
| ); | ||
| const hours = toFixed(Math.floor((value / (10 * 60 * 60)) % 24)).padStart( | ||
| 2, | ||
| '0', | ||
| ); | ||
| const formattedValue = `${hours}:${minutes}:${seconds}`; | ||
| return formattedValue; | ||
| }; |
Contributor
There was a problem hiding this comment.
the formatTime function already exists
import { formatTime } from 'tgui-core/format';
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
About The Pull Request
This pr adds Monkestation's Plant Infuser, but a trimmed down version with JUST the chemical adding part of it. No infinite stats, no mutations locked behind it, No stats based mutation or biocubes, just the infuser.
How it works is that you insert a seed, and 100u of a reagent you want (assuming it has the Synthesizable Tag) and add it into the machine. It'll infuse and give that a range between 3% and 25%. Adding more of a reagent that a plant already produces will increase the rate that plant produces said chemical.
The infusion will also damage the seed a bit, where if you reach 100 points of damage the seed will be deleted. Don't get too greedy!
You can print the board from the Service lathe, science and engi circuit printers, and also the ancient circuit printers!
Why it's Good for the Game
Gives botany more freedom and the ability to do interesting plant chemistry and gimmicks. Make the ultimate Plant Slop in your pumpkins!
Proof of Testing
Screenshots/Videos
Changelog
🆑
add: Adds the Plant Chemical Infuser, a fancy machine that can make plants produce an inputted chemical! Research it from science today!
/:cl: