Skip to content

Commit

Permalink
Bees need flowers to produce honey.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 authored and comma committed Feb 12, 2025
1 parent df65026 commit fd9e2f5
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions code/__defines/hydroponics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Defining these to point to the relevant decl types just to avoid a massive changeset.
// TODO: rename to PLANT_TRAIT or bare decls to avoid mixing up with GetTrait etc.
#define TRAIT_CHEMS /decl/plant_trait/chems
#define TRAIT_POLLEN /decl/plant_trait/pollen
#define TRAIT_EXUDE_GASSES /decl/plant_trait/exude_gasses
#define TRAIT_ALTER_TEMP /decl/plant_trait/alter_temp
#define TRAIT_POTENCY /decl/plant_trait/potency
Expand Down
4 changes: 4 additions & 0 deletions code/modules/genetics/plants/gene_biochemistry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
if(seed.get_trait(trait) > 0)
seed.set_trait(trait, seed.get_trait(trait), null, 1, 0.85)

seed.produces_pollen = LAZYACCESS(gene.values, TRAIT_POLLEN)

LAZYINITLIST(seed.chems)
var/list/gene_value = LAZYACCESS(gene.values, TRAIT_CHEMS)
for(var/rid in gene_value)
Expand All @@ -42,10 +44,12 @@

LAZYREMOVE(gene.values, TRAIT_EXUDE_GASSES)
LAZYREMOVE(gene.values, TRAIT_CHEMS)
LAZYREMOVE(gene.values, TRAIT_POLLEN)

return ..()

/decl/plant_gene/biochemistry/copy_initial_seed_values(datum/plantgene/gene, datum/seed/seed)
LAZYSET(gene.values, TRAIT_CHEMS, seed.chems?.Copy())
LAZYSET(gene.values, TRAIT_EXUDE_GASSES, seed.exude_gasses?.Copy())
LAZYSET(gene.values, TRAIT_POLLEN, seed.produces_pollen)
return ..()
3 changes: 3 additions & 0 deletions code/modules/genetics/plants/trait_pollen.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/decl/plant_trait/pollen
name = "pollen"
requires_master_gene = FALSE
4 changes: 3 additions & 1 deletion code/modules/hydroponics/beekeeping/beehive.dm
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@
for(var/obj/machinery/portable_atmospherics/hydroponics/H in view(7, src))
if(H.seed && !H.dead)
H.plant_health += 0.05 * coef
++trays
if(H.pollen >= 1)
H.pollen--
trays++
honeycombs = min(honeycombs + 0.1 * coef * min(trays, 5), frames * 100)

/obj/machinery/honey_extractor
Expand Down
1 change: 1 addition & 0 deletions code/modules/hydroponics/plant_types/seeds_herbs.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/datum/seed/herb
abstract_type = /datum/seed/herb
allergen_flags = ALLERGEN_NONE // Do not make people allergic to the only medicine available on Shadyhills
produces_pollen = 0.5

/datum/seed/herb/New()
..()
Expand Down
1 change: 1 addition & 0 deletions code/modules/hydroponics/plant_types/seeds_misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@
chems = list(/decl/material/liquid/nutriment = list(1,20))
slice_product = /obj/item/food/processed_grown/crushed
slice_amount = 3
produces_pollen = 1

/datum/seed/flower/New()
..()
Expand Down
1 change: 1 addition & 0 deletions code/modules/hydroponics/seed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
var/scannable_result
var/grown_is_seed = FALSE
var/product_w_class = ITEM_SIZE_SMALL
var/produces_pollen = 0

// Dissection values.
var/min_seed_extracted = 1
Expand Down
3 changes: 3 additions & 0 deletions code/modules/hydroponics/trays/tray.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
var/force_update // Set this to bypass the cycle time check.
var/obj/temp_chem_holder // Something to hold reagents during process_reagents()

// Counter used by bees.
var/pollen = 0

// Seed details/line data.
var/datum/seed/seed = null // The currently planted seed

Expand Down
3 changes: 3 additions & 0 deletions code/modules/hydroponics/trays/tray_process.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
mutate((rand(100) < 15) ? 2 : 1)
mutation_level = 0

if(pollen < 10)
pollen += seed?.produces_pollen

// Maintain tray nutrient and water levels.
if(seed.get_trait(TRAIT_REQUIRES_NUTRIENTS) && seed.get_trait(TRAIT_NUTRIENT_CONSUMPTION) > 0 && nutrilevel > 0 && prob(25))
nutrilevel -= max(0,seed.get_trait(TRAIT_NUTRIENT_CONSUMPTION) * growth_rate)
Expand Down
1 change: 1 addition & 0 deletions nebula.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2523,6 +2523,7 @@
#include "code\modules\genetics\plants\trait_photosynthesis.dm"
#include "code\modules\genetics\plants\trait_plant_colour.dm"
#include "code\modules\genetics\plants\trait_plant_icon.dm"
#include "code\modules\genetics\plants\trait_pollen.dm"
#include "code\modules\genetics\plants\trait_potency.dm"
#include "code\modules\genetics\plants\trait_produces_power.dm"
#include "code\modules\genetics\plants\trait_product_colour.dm"
Expand Down

0 comments on commit fd9e2f5

Please sign in to comment.