Skip to content

Adds a Trimmed Down Version of Monkestation's Plant Infuser - #480

Open
ADepressedPyroshark wants to merge 13 commits into
Monkestation:masterfrom
ADepressedPyroshark:plant-infuser
Open

ADepressedPyroshark wants to merge 13 commits into
Monkestation:masterfrom
ADepressedPyroshark:plant-infuser

Conversation

@ADepressedPyroshark

@ADepressedPyroshark ADepressedPyroshark commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

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 SYrzfUiTfZ MwiUheFJdD a6q5iEQNP4 BVpXvYJCXw KHydhsU2NG

Changelog

🆑
add: Adds the Plant Chemical Infuser, a fancy machine that can make plants produce an inputted chemical! Research it from science today!

/:cl:

Comment thread modular_oculis/master_files/code/modules/research/techweb/all_nodes.dm Outdated
Comment thread modular_oculis/modules/hydroponics/code/infuser.dm
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@@ -0,0 +1,293 @@
import { toFixed } from 'tgui-core/math';

@Absolucy Absolucy Sep 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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',
}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the formatTime function already exists

import { formatTime } from 'tgui-core/format';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants