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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds gene complexity to botany #10424

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions code/modules/hydroponics/gene_modder.dm
Expand Up @@ -134,6 +134,7 @@
data["core_genes"] = build_gene_list(core_genes, /datum/plant_gene/core)
data["reagent_genes"] = build_gene_list(reagent_genes, /datum/plant_gene/reagent)
data["trait_genes"] = build_gene_list(trait_genes, /datum/plant_gene/trait)
data["complexity"] = seed.complexity

data["machine_stats"] = build_machine_stats()
data["skip_confirmation"] = skip_confirmation
Expand Down Expand Up @@ -206,6 +207,7 @@
L["type"] = "trait"
L["id"] = get_gene_id(gene)
L["trait_id"] = trait_gene.trait_id
L["complexity"] = trait_gene.complexity

/obj/machinery/plantgenes/ui_static_data(mob/user)
var/list/data = list()
Expand Down Expand Up @@ -305,6 +307,10 @@
seed.genes -= G
if(istype(G, /datum/plant_gene/reagent))
seed.reagents_from_genes()
if(istype(G, /datum/plant_gene/trait))
var/datum/plant_gene/trait/trait = disk.gene
seed.complexity -= trait.complexity

repaint_seed()

if(operation == "extract")
Expand Down Expand Up @@ -344,6 +350,9 @@
seed.genes += disk.gene.Copy()
if(istype(disk.gene, /datum/plant_gene/reagent))
seed.reagents_from_genes()
if(istype(disk.gene, /datum/plant_gene/trait))
var/datum/plant_gene/trait/trait = disk.gene
seed.complexity += trait.complexity
repaint_seed()

operation = null
Expand Down
13 changes: 13 additions & 0 deletions code/modules/hydroponics/plant_genes.dm
Expand Up @@ -168,7 +168,12 @@
var/rate = 0.05
var/examine_line = ""
var/trait_id // must be set and equal for any two traits of the same type
var/complexity = 0

/datum/plant_gene/trait/get_name()
if(complexity != 0)
return "[name] [complexity] complexity"
else return "[name]"
/datum/plant_gene/trait/Copy()
var/datum/plant_gene/trait/G = ..()
G.rate = rate
Expand Down Expand Up @@ -251,6 +256,7 @@
// Also affects plant batteries see capatative cell production datum
name = "Electrical Activity"
rate = 0.2
complexity = 1

/datum/plant_gene/trait/cell_charge/on_slip(obj/item/food/grown/G, mob/living/carbon/C)
var/power = round(G.seed.potency*rate)
Expand Down Expand Up @@ -314,6 +320,7 @@
name = "Shadow Emission"
rate = 0.04
glow_color = "#AAD84B"
complexity = 1

/datum/plant_gene/trait/glow/shadow/glow_power(obj/item/seeds/S)
return -max(S.potency*(rate*0.2), 0.2)
Expand Down Expand Up @@ -362,6 +369,7 @@
// Teleport radius is calculated as max(round(potency*rate), 1)
name = "Bluespace Activity"
rate = 0.1
complexity = 1

/datum/plant_gene/trait/teleport/on_squash(obj/item/food/grown/G, atom/target)
if(isliving(target))
Expand Down Expand Up @@ -394,13 +402,15 @@
name = "Densified Chemicals"
rate = 2
trait_id = "chem_boost"
complexity = 2

/datum/plant_gene/trait/maxchem/on_new(obj/item/food/grown/G, newloc)
..()
G.max_volume *= rate

/datum/plant_gene/trait/repeated_harvest
name = "Perennial Growth"
complexity = 2

/datum/plant_gene/trait/repeated_harvest/can_add(obj/item/seeds/S)
if(!..())
Expand All @@ -411,6 +421,7 @@

/datum/plant_gene/trait/battery
name = "Capacitive Cell Production"
complexity = 1

/datum/plant_gene/trait/battery/on_attackby(obj/item/food/grown/G, obj/item/I, mob/user)
if(istype(I, /obj/item/stack/cable_coil))
Expand Down Expand Up @@ -439,6 +450,7 @@

/datum/plant_gene/trait/stinging
name = "Hypodermic Prickles"
complexity = 3

/datum/plant_gene/trait/stinging/on_slip(obj/item/food/grown/G, atom/target)
if(!isliving(target) || !G.reagents || !G.reagents.total_volume)
Expand Down Expand Up @@ -527,6 +539,7 @@
name = "Richer Juice"
rate = 2
trait_id = "chem_boost"
complexity = 2

/datum/plant_gene/trait/plant_type // Parent type
name = "you shouldn't see this"
Expand Down
13 changes: 12 additions & 1 deletion code/modules/hydroponics/seeds.dm
Expand Up @@ -26,6 +26,7 @@
var/potency = 10 // The 'power' of a plant. Generally effects the amount of reagent in a plant, also used in other ways.
var/growthstages = 6 // Amount of growth sprites the plant has.
var/rarity = 0 // How rare the plant is. Used for giving points to cargo when shipping off to CentCom.
var/complexity = 0 // How many powerful genes the plant has.
var/list/mutatelist = list() // The type of plants that this plant can mutate into.
var/list/genes = list() // Plant genes are stored here, see plant_genes.dm for more info.
var/list/reagents_add = list()
Expand Down Expand Up @@ -71,6 +72,9 @@
genes += new /datum/plant_gene/reagent(reag_id, reagents_add[reag_id])
reagents_from_genes() //quality coding

for(var/datum/plant_gene/trait/each_comp in genes)
complexity += each_comp.complexity

/obj/item/seeds/proc/Copy()
var/obj/item/seeds/S = new type(null, 1)
// Copy all the stats
Expand Down Expand Up @@ -144,13 +148,19 @@
// Harvest procs
/obj/item/seeds/proc/getYield()
var/return_yield = yield
if (yield==0)
return 0

var/obj/machinery/hydroponics/parent = loc
if(istype(loc, /obj/machinery/hydroponics))
if(parent.yieldmod == 0)
return_yield = min(return_yield, 1)//1 if above zero, 0 otherwise
else
return_yield *= (parent.yieldmod)
if(return_yield <= complexity)
return_yield = clamp(return_yield, 0, 1)
else
return_yield -= complexity

return return_yield

Expand Down Expand Up @@ -371,13 +381,14 @@
text += "- Lifespan: [lifespan]\n"
text += "- Weed Growth Rate: [weed_rate]\n"
text += "- Weed Vulnerability: [weed_chance]\n"
text += "- Complexity: [complexity]\n"
if(rarity)
text += "- Species Discovery Value: [rarity]\n"
var/all_traits = ""
for(var/datum/plant_gene/trait/traits in genes)
if(istype(traits, /datum/plant_gene/trait/plant_type))
continue
all_traits += " [traits.get_name()]"
all_traits += " [traits.name]"
text += "- Plant Traits:[all_traits]\n"

text += "*---------*"
Expand Down
4 changes: 2 additions & 2 deletions tgui/packages/tgui/interfaces/PlantDNAManipulator.js
Expand Up @@ -164,7 +164,7 @@ const PlantDNAManipulatorHeader = (props, context) => {

const PlantDNAManipulatorContent = (props, context) => {
const { act, data } = useBackend(context);
const { seed, core_genes, reagent_genes, trait_genes } = data;
const { seed, core_genes, reagent_genes, trait_genes, complexity } = data;

if (!seed) {
return (
Expand All @@ -179,7 +179,7 @@ const PlantDNAManipulatorContent = (props, context) => {
<>
<PlantDNAManipulatorGenes label="Core genes" type="core" list={core_genes} />
<PlantDNAManipulatorGenes label="Reagent genes" type="reagent" list={reagent_genes} />
<PlantDNAManipulatorGenes label="Trait genes" type="trait" list={trait_genes} />
<PlantDNAManipulatorGenes label={'Trait genes ' + complexity + ' complexity'} type="trait" list={trait_genes} />
</>
);
};
Expand Down