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

New plant trait and dank vescicles bug fix #2342

Merged
merged 21 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions code/modules/hydroponics/gene_modder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@
var/read_only = 0 //Well, it's still a floppy disk
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var/read_only = 0 //Well, it's still a floppy disk
var/read_only = FALSE //Well, it's still a floppy disk

fix this while ya here i guess

obj_flags = UNIQUE_RENAME

/obj/item/disk/plantgene/syndicate // Monkestation item
gene = new /datum/plant_gene/trait/noreact
read_only = 1
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
read_only = 1
read_only = TRUE


/obj/item/disk/plantgene/Initialize(mapload)
. = ..()
add_overlay("datadisk_gene")
Expand Down
14 changes: 13 additions & 1 deletion code/modules/hydroponics/grown.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
var/alt_icon
/// Should we pixel offset ourselves at init? for mapping
var/offset_at_init = TRUE
//This volume can be altered by densified chemicals trait
var/volume_rate = 1 //Monkestation Edit

/obj/item/food/grown/Initialize(mapload, obj/item/seeds/new_seed)
if(!tastes)
Expand All @@ -65,16 +67,26 @@
make_dryable()

// Go through all traits in their genes and call on_new_plant from them.
//TODO: We need a priority queue for traits,some of them need to be called first
for(var/datum/plant_gene/trait/trait in seed.genes)
trait.on_new_plant(src, loc)

//Needs to be run after traits are called because some of them alter max_volume and volume_rate
//Since traits do not know in which order they were run we need to do it here
max_volume *= volume_rate //Monkestation Edit

// Set our default bitesize: bite size = 1 + (potency * 0.05) * (max_volume * 0.01) * modifier
// A 100 potency, non-densified plant = 1 + (5 * 1 * modifier) = 6u bite size
// For reference, your average 100 potency tomato has 14u of reagents - So, with no modifier it is eaten in 3 bites
bite_consumption = 1 + round(max((seed.potency * BITE_SIZE_POTENCY_MULTIPLIER), 1) * (max_volume * BITE_SIZE_VOLUME_MULTIPLIER) * bite_consumption_mod)

. = ..() //Only call it here because we want all the genes and shit to be applied before we add edibility. God this code is a mess.

//Monkestation Edit Begin
//We want this trait to run after reagents component is added to the plant
var/datum/plant_gene/trait/trait_noreact = seed.get_gene(/datum/plant_gene/trait/noreact)
if(trait_noreact)
trait_noreact.on_new_plant(src, loc)
//Monkestation Edit End
seed.prepare_result(src)
transform *= TRANSFORM_USING_VARIABLE(seed.potency, 100) + 0.5 //Makes the resulting produce's sprite larger or smaller based on potency!

Expand Down
2 changes: 1 addition & 1 deletion code/modules/hydroponics/grown/mushrooms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
potency = 30 //-> brightness
growthstages = 4
rarity = 20
genes = list(/datum/plant_gene/trait/glow, /datum/plant_gene/trait/plant_type/fungal_metabolism, /datum/plant_gene/trait/potencylimit)
genes = list(/datum/plant_gene/trait/glow, /datum/plant_gene/trait/plant_type/fungal_metabolism)
growing_icon = 'icons/obj/hydroponics/growing_mushrooms.dmi'
possible_mutations = list(/datum/hydroponics/plant_mutation/glow_cap, /datum/hydroponics/plant_mutation/shadow_shroom)
reagents_add = list(/datum/reagent/uranium/radium = 0.1, /datum/reagent/phosphorus = 0.1, /datum/reagent/consumable/nutriment = 0.04)
Expand Down
8 changes: 1 addition & 7 deletions code/modules/hydroponics/plant_genes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,7 @@

var/obj/item/food/grown/grown_plant = our_plant
if(istype(grown_plant, /obj/item/food/grown))
//Grown foods use the edible component so we need to change their max_volume var
grown_plant.max_volume *= rate
grown_plant.volume_rate = rate //Monkestation Edit
else
//Grown inedibles however just use a reagents holder, so.
our_plant.reagents?.maximum_volume *= rate
Expand Down Expand Up @@ -1025,8 +1024,3 @@
/datum/plant_gene/trait/plant_type/alien_properties
name ="?????"
icon = "reddit-alien"

/datum/plant_gene/trait/seedless
name = "Seedless"
description = "The plant is unable to produce seeds"
mutability_flags = PLANT_GENE_REMOVABLE | PLANT_GENE_MUTATABLE | PLANT_GENE_GRAFTABLE
5 changes: 0 additions & 5 deletions code/modules/hydroponics/seeds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,6 @@
return

var/max_potency = MAX_PLANT_YIELD
for(var/datum/plant_gene/trait/trait in genes)
if(trait.trait_flags & TRAIT_LIMIT_POTENCY)
max_potency = 100
break

potency = clamp(potency + adjustamt, 0, max_potency)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/potency)
if(C)
Expand Down
1 change: 0 additions & 1 deletion code/modules/hydroponics/unique_plant_genes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@
. = ..()
if(!.)
return

var/obj/item/food/grown/grown_plant = our_plant
if(istype(grown_plant))
grown_plant.max_volume = new_capcity
Expand Down
28 changes: 20 additions & 8 deletions monkestation/code/modules/hydroponics/plant_genes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,26 @@
* this limits potency, it is used for plants that have strange behavior above 100 potency.
*
*/
/datum/plant_gene/trait/potencylimit
name = "potency limiter"
icon = "lightbulb"
description = "limits potency to 100, used for some plants to avoid lag and similar issues."
trait_flags = TRAIT_LIMIT_POTENCY
mutability_flags = PLANT_GENE_GRAFTABLE

/datum/plant_gene/trait/potencylimit/on_new_plant(obj/item/our_plant, newloc)

/datum/plant_gene/trait/seedless
name = "Seedless"
description = "The plant is unable to produce seeds"
mutability_flags = PLANT_GENE_REMOVABLE | PLANT_GENE_MUTATABLE | PLANT_GENE_GRAFTABLE

/datum/plant_gene/trait/noreact
name = "Catalytic Inhibitor Serum"
description = "This genetic trait enables the plant to produce a serum that effectively halts chemical reactions within its tissues."
mutability_flags = PLANT_GENE_REMOVABLE | PLANT_GENE_GRAFTABLE

/datum/plant_gene/trait/noreact/on_new_plant(obj/item/our_plant, newloc)
. = ..()
if(!.)
return
ENABLE_BITFIELD(our_plant.reagents.flags, NO_REACT)
RegisterSignal(our_plant, COMSIG_PLANT_ON_SQUASH, PROC_REF(noreact_on_squash))

/datum/plant_gene/trait/noreact/proc/noreact_on_squash(obj/item/our_plant, atom/target)
SIGNAL_HANDLER

DISABLE_BITFIELD(our_plant.reagents.flags, NO_REACT)
our_plant.reagents.handle_reactions()
8 changes: 8 additions & 0 deletions monkestation/code/modules/uplink/uplink_items/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,11 @@

/datum/uplink_item/role_restricted/modified_syringe_gun
surplus = 50

/datum/uplink_item/role_restricted/syndicate_plant_gene
Copy link
Member

Choose a reason for hiding this comment

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

this is silly, but can you move this further up in the file, so I can TM this without conflicts?

name = "Catalytic Inhibitor Serum Plant Data Disk"
desc = "This plant data disk contains the genetic blueprint for the Catalytic Inhibitor Serum gene.\
enabling plants to produce a serum that halts all internal chemical reactions"
item = /obj/item/disk/plantgene/syndicate
cost = 20
restricted_roles = list(JOB_BOTANIST)
Loading