mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-01 12:31:32 +00:00
191 lines
6.8 KiB
Plaintext
191 lines
6.8 KiB
Plaintext
// ***********************************************************
|
|
// Foods that are produced from hydroponics ~~~~~~~~~~
|
|
// Data from the seeds carry over to these grown foods
|
|
// ***********************************************************
|
|
|
|
// Base type. Subtypes are found in /grown dir. Lavaland-based subtypes can be found in mining/ash_flora.dm
|
|
/obj/item/reagent_containers/food/snacks/grown
|
|
icon = 'icons/obj/hydroponics/harvest.dmi'
|
|
name = "fresh produce" // so recipe text doesn't say 'snack'
|
|
var/obj/item/seeds/seed = null // type path, gets converted to item on New(). It's safe to assume it's always a seed item.
|
|
var/plantname = ""
|
|
var/bitesize_mod = 0
|
|
var/splat_type = /obj/effect/decal/cleanable/food/plant_smudge
|
|
// If set, bitesize = 1 + round(reagents.total_volume / bitesize_mod)
|
|
dried_type = -1
|
|
// Saves us from having to define each stupid grown's dried_type as itself.
|
|
// If you don't want a plant to be driable (watermelons) set this to null in the time definition.
|
|
resistance_flags = FLAMMABLE
|
|
var/dry_grind = FALSE //If TRUE, this object needs to be dry to be ground up
|
|
var/can_distill = TRUE //If FALSE, this object cannot be distilled into an alcohol.
|
|
var/distill_reagent //If NULL and this object can be distilled, it uses a generic fruit_wine reagent and adjusts its variables.
|
|
var/wine_flavor //If NULL, this is automatically set to the fruit's flavor. Determines the flavor of the wine if distill_reagent is NULL.
|
|
var/wine_power = 10 //Determines the boozepwr of the wine if distill_reagent is NULL.
|
|
volume = 100
|
|
|
|
/obj/item/reagent_containers/food/snacks/grown/Initialize(mapload, obj/item/seeds/new_seed)
|
|
. = ..()
|
|
if(!tastes)
|
|
tastes = list("[name]" = 1)
|
|
|
|
if(new_seed)
|
|
seed = new_seed.Copy()
|
|
else if(ispath(seed))
|
|
// This is for adminspawn or map-placed growns. They get the default stats of their seed type.
|
|
seed = new seed()
|
|
seed.adjust_potency(50-seed.potency)
|
|
|
|
pixel_x = base_pixel_x + rand(-5, 5)
|
|
pixel_y = base_pixel_y + rand(-5, 5)
|
|
|
|
if(dried_type == -1)
|
|
dried_type = src.type
|
|
|
|
if(seed)
|
|
for(var/datum/plant_gene/trait/T in seed.genes)
|
|
T.on_new(src, loc)
|
|
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!
|
|
add_juice()
|
|
|
|
|
|
|
|
/obj/item/reagent_containers/food/snacks/grown/proc/add_juice()
|
|
if(reagents)
|
|
if(bitesize_mod)
|
|
bitesize = 1 + round(reagents.total_volume / bitesize_mod)
|
|
return TRUE
|
|
return FALSE
|
|
|
|
/obj/item/reagent_containers/food/snacks/grown/examine(user)
|
|
. = ..()
|
|
if(seed)
|
|
for(var/datum/plant_gene/trait/T in seed.genes)
|
|
if(T.examine_line)
|
|
. += T.examine_line
|
|
|
|
/obj/item/reagent_containers/food/snacks/grown/attackby(obj/item/O, mob/user, params)
|
|
..()
|
|
if (istype(O, /obj/item/plant_analyzer))
|
|
var/obj/item/plant_analyzer/P_analyzer = O
|
|
var/msg = "<span class='info'>*---------*\n This is \a <span class='name'>[src]</span>.\n"
|
|
if(seed && P_analyzer.scan_mode == PLANT_SCANMODE_STATS)
|
|
msg += seed.get_analyzer_text()
|
|
var/reag_txt = ""
|
|
if(seed && P_analyzer.scan_mode == PLANT_SCANMODE_CHEMICALS)
|
|
msg += "<br><span class='info'>*Plant Reagents*</span>"
|
|
msg += "<br><span class='info'>Maximum reagent capacity: [reagents.maximum_volume]</span>"
|
|
var/chem_cap = 0
|
|
for(var/reagent_id in reagents.reagent_list)
|
|
var/datum/reagent/R = reagent_id
|
|
var/amt = R.volume
|
|
chem_cap += R.volume
|
|
reag_txt += "\n<span class='info'>- [R.name]: [amt]</span>"
|
|
if(chem_cap > 100)
|
|
msg += "<br><span class='warning'>- Reagent Traits Over 100% Production</span></br>"
|
|
|
|
if(reag_txt)
|
|
msg += "<br><span class='info'>*---------*</span>"
|
|
msg += reag_txt
|
|
msg += "<br><span class='info'>*---------*</span>"
|
|
to_chat(user, msg)
|
|
else
|
|
if(seed)
|
|
for(var/datum/plant_gene/trait/T in seed.genes)
|
|
T.on_attackby(src, O, user)
|
|
|
|
|
|
// Various gene procs
|
|
/obj/item/reagent_containers/food/snacks/grown/attack_self(mob/user)
|
|
if(seed?.get_gene(/datum/plant_gene/trait/squash))
|
|
squash(user)
|
|
..()
|
|
|
|
/obj/item/reagent_containers/food/snacks/grown/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
|
|
if(!..()) //was it caught by a mob?
|
|
if(seed)
|
|
for(var/datum/plant_gene/trait/T in seed.genes)
|
|
T.on_throw_impact(src, hit_atom)
|
|
if(seed.get_gene(/datum/plant_gene/trait/squash))
|
|
squash(hit_atom)
|
|
|
|
/obj/item/reagent_containers/food/snacks/grown/proc/squash(atom/target)
|
|
var/turf/T = get_turf(target)
|
|
forceMove(T)
|
|
if(ispath(splat_type, /obj/effect/decal/cleanable/food/plant_smudge))
|
|
if(filling_color)
|
|
var/obj/O = new splat_type(T)
|
|
O.color = filling_color
|
|
O.name = "[name] smudge"
|
|
else if(splat_type)
|
|
new splat_type(T)
|
|
|
|
if(trash)
|
|
generate_trash(T)
|
|
|
|
visible_message("<span class='warning'>[src] is squashed.</span>","<span class='hear'>You hear a smack.</span>")
|
|
if(seed)
|
|
for(var/datum/plant_gene/trait/trait in seed.genes)
|
|
trait.on_squash(src, target)
|
|
|
|
reagents.expose(T)
|
|
for(var/A in T)
|
|
reagents.expose(A)
|
|
|
|
qdel(src)
|
|
|
|
/obj/item/reagent_containers/food/snacks/grown/On_Consume()
|
|
if(iscarbon(usr))
|
|
if(seed)
|
|
for(var/datum/plant_gene/trait/T in seed.genes)
|
|
T.on_consume(src, usr)
|
|
..()
|
|
|
|
/obj/item/reagent_containers/food/snacks/grown/generate_trash(atom/location)
|
|
if(trash && (ispath(trash, /obj/item/grown) || ispath(trash, /obj/item/reagent_containers/food/snacks/grown)))
|
|
. = new trash(location, seed)
|
|
trash = null
|
|
return
|
|
return ..()
|
|
|
|
/obj/item/reagent_containers/food/snacks/grown/grind_requirements()
|
|
if(dry_grind && !dry)
|
|
to_chat(usr, "<span class='warning'>[src] needs to be dry before it can be ground up!</span>")
|
|
return
|
|
return TRUE
|
|
|
|
/obj/item/reagent_containers/food/snacks/grown/on_grind()
|
|
var/nutriment = reagents.get_reagent_amount(/datum/reagent/consumable/nutriment)
|
|
if(grind_results?.len)
|
|
for(var/i in 1 to grind_results.len)
|
|
grind_results[grind_results[i]] = nutriment
|
|
reagents.del_reagent(/datum/reagent/consumable/nutriment)
|
|
reagents.del_reagent(/datum/reagent/consumable/nutriment/vitamin)
|
|
|
|
/obj/item/reagent_containers/food/snacks/grown/on_juice()
|
|
var/nutriment = reagents.get_reagent_amount(/datum/reagent/consumable/nutriment)
|
|
if(juice_results?.len)
|
|
for(var/i in 1 to juice_results.len)
|
|
juice_results[juice_results[i]] = nutriment
|
|
reagents.del_reagent(/datum/reagent/consumable/nutriment)
|
|
reagents.del_reagent(/datum/reagent/consumable/nutriment/vitamin)
|
|
|
|
/*
|
|
* Attack self for growns
|
|
*
|
|
* Spawns the trash item at the growns drop_location()
|
|
*
|
|
* Then deletes the grown object
|
|
*
|
|
* Then puts trash item into the hand of user attack selfing, or drops it back on the ground
|
|
*/
|
|
/obj/item/reagent_containers/food/snacks/grown/shell/attack_self(mob/user)
|
|
var/obj/item/T
|
|
if(trash)
|
|
T = generate_trash(drop_location())
|
|
//Delete grown so our hand is free
|
|
qdel(src)
|
|
//put trash obj in hands or drop to ground
|
|
user.put_in_hands(T, user.active_hand_index, TRUE)
|
|
to_chat(user, "<span class='notice'>You open [src]\'s shell, revealing \a [T].</span>")
|