Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
12 changes: 12 additions & 0 deletions code/datums/components/blessed_plant_tray.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/datum/component/blessed_plant_tray
var/delete_timer_id

/datum/component/blessed_plant_tray/Initialize(delete_after = 2 MINUTES)
if(!ismovable(parent))
return COMPONENT_INCOMPATIBLE
delete_timer_id = QDEL_IN_STOPPABLE(src, delete_after)

/datum/component/blessed_plant_tray/Destroy(force)
deltimer(delete_timer_id)
delete_timer_id = null
return ..()
2 changes: 2 additions & 0 deletions code/modules/hydroponics/hydroponics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,8 @@
set_plant_status(HYDROTRAY_PLANT_HARVESTABLE)

if(plant_status == HYDROTRAY_PLANT_HARVESTABLE)
if(!myseed.extra_harvest_checks(user, src))
return
return myseed.harvest(user)

else if(plant_status == HYDROTRAY_PLANT_DEAD)
Expand Down
4 changes: 4 additions & 0 deletions code/modules/hydroponics/plant_genes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
/datum/plant_gene/proc/on_new_seed(obj/item/seeds/new_seed)
return // Not implemented

/// Extra checks needed to harvest a plant with this gene.
/datum/plant_gene/proc/extra_harvest_checks(mob/living/user, atom/movable/planter)
return TRUE

/// Core plant genes. Stores the main variables: lifespan, endurance, production, yield, potency, weed rate/chance
/datum/plant_gene/core
/// The number value of our core gene.
Expand Down
6 changes: 6 additions & 0 deletions code/modules/hydroponics/seeds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@
/obj/item/seeds/proc/get_gene(typepath)
return (locate(typepath) in genes)

/obj/item/seeds/proc/extra_harvest_checks(mob/living/user, atom/movable/planter)
. = TRUE
for(var/datum/plant_gene/plant_gene as anything in genes)
if(!plant_gene.extra_harvest_checks(user, planter))
return FALSE

/obj/item/seeds/proc/reagents_from_genes()
reagents_add = list()
for(var/datum/plant_gene/reagent/R in genes)
Expand Down
8 changes: 8 additions & 0 deletions code/modules/hydroponics/unique_plant_genes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
expiration = CALLBACK(src, PROC_REF(expire)), \
)

/datum/plant_gene/trait/anti_magic/extra_harvest_checks(mob/living/user, atom/movable/planter)
var/datum/component/blessed_plant_tray/bless_component = planter.GetComponent(/datum/component/blessed_plant_tray)
if(QDELETED(bless_component))
planter.balloon_alert(user, "can only harvest if tray is blessed!")
return FALSE
qdel(bless_component)
return TRUE

/// When the plant our gene is hosted in is drained of an anti-magic charge.
/datum/plant_gene/trait/anti_magic/proc/drain_antimagic(mob/user, obj/item/our_plant)
to_chat(user, span_warning("[our_plant] hums slightly, and seems to decay a bit."))
Expand Down
4 changes: 4 additions & 0 deletions code/modules/library/bibles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ GLOBAL_LIST_INIT(bibleitemstates, list(
other_bible.inhand_icon_state = inhand_icon_state
other_bible.deity_name = deity_name
. = ITEM_INTERACT_SUCCESS
if(bible_smacked.GetComponent(/datum/component/plant_growing))
bible_smacked.balloon_alert(user, "blessed")
bible_smacked.AddComponent(/datum/component/blessed_plant_tray)
. = ITEM_INTERACT_SUCCESS
if(.)
return .

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@
return

var/obj/item/seeds/seed = parent
if(!seed.extra_harvest_checks(user, planter))
return

if(seed.get_gene(/datum/plant_gene/trait/repeated_harvest))
repeated_harvest = TRUE
Expand Down
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,7 @@
#include "code\datums\components\basic_ranged_ready_overlay.dm"
#include "code\datums\components\bayonet_attachable.dm"
#include "code\datums\components\beetlejuice.dm"
#include "code\datums\components\blessed_plant_tray.dm"
#include "code\datums\components\blob_minion.dm"
#include "code\datums\components\blood_walk.dm"
#include "code\datums\components\bloody_spreader.dm"
Expand Down
Loading