This commit is contained in:
Hatterhat
2020-01-12 12:39:17 -06:00
945 changed files with 189410 additions and 189403 deletions
+333 -333
View File
@@ -1,333 +1,333 @@
/obj/machinery/biogenerator
name = "biogenerator"
desc = "Converts plants into biomass, which can be used to construct useful items."
icon = 'icons/obj/machines/biogenerator.dmi'
icon_state = "biogen-empty"
density = TRUE
use_power = IDLE_POWER_USE
idle_power_usage = 40
circuit = /obj/item/circuitboard/machine/biogenerator
var/processing = FALSE
var/obj/item/reagent_containers/glass/beaker = null
var/points = 0
var/menustat = "menu"
var/efficiency = 0
var/productivity = 0
var/max_items = 40
var/datum/techweb/stored_research
var/list/show_categories = list("Food", "Botany Chemicals", "Organic Materials")
var/list/timesFiveCategories = list("Food", "Botany Chemicals")
/obj/machinery/biogenerator/Initialize()
. = ..()
stored_research = new /datum/techweb/specialized/autounlocking/biogenerator
create_reagents(1000)
/obj/machinery/biogenerator/Destroy()
QDEL_NULL(beaker)
return ..()
/obj/machinery/biogenerator/contents_explosion(severity, target)
..()
if(beaker)
beaker.ex_act(severity, target)
/obj/machinery/biogenerator/handle_atom_del(atom/A)
..()
if(A == beaker)
beaker = null
update_icon()
updateUsrDialog()
/obj/machinery/biogenerator/RefreshParts()
var/E = 0
var/P = 0
var/max_storage = 40
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
P += B.rating
max_storage = 40 * B.rating
for(var/obj/item/stock_parts/manipulator/M in component_parts)
E += M.rating
efficiency = E
productivity = P
max_items = max_storage
/obj/machinery/biogenerator/examine(mob/user)
..()
if(in_range(user, src) || isobserver(user))
to_chat(user, "<span class='notice'>The status display reads: Productivity at <b>[productivity*100]%</b>.<br>Matter consumption reduced by <b>[(efficiency*25)-25]</b>%.<br>Machine can hold up to <b>[max_items]</b> pieces of produce.<span>")
/obj/machinery/biogenerator/on_reagent_change(changetype) //When the reagents change, change the icon as well.
update_icon()
/obj/machinery/biogenerator/update_icon()
if(panel_open)
icon_state = "biogen-empty-o"
else if(!src.beaker)
icon_state = "biogen-empty"
else if(!src.processing)
icon_state = "biogen-stand"
else
icon_state = "biogen-work"
return
/obj/machinery/biogenerator/attackby(obj/item/O, mob/user, params)
if(user.a_intent == INTENT_HARM)
return ..()
if(processing)
to_chat(user, "<span class='warning'>The biogenerator is currently processing.</span>")
return
if(default_deconstruction_screwdriver(user, "biogen-empty-o", "biogen-empty", O))
if(beaker)
var/obj/item/reagent_containers/glass/B = beaker
B.forceMove(drop_location())
beaker = null
update_icon()
return
if(default_deconstruction_crowbar(O))
return
if(istype(O, /obj/item/reagent_containers/glass))
. = 1 //no afterattack
if(!panel_open)
if(beaker)
to_chat(user, "<span class='warning'>A container is already loaded into the machine.</span>")
else
if(!user.transferItemToLoc(O, src))
return
beaker = O
to_chat(user, "<span class='notice'>You add the container to the machine.</span>")
update_icon()
updateUsrDialog()
else
to_chat(user, "<span class='warning'>Close the maintenance panel first.</span>")
return
else if(istype(O, /obj/item/storage/bag/plants))
var/obj/item/storage/bag/plants/PB = O
var/i = 0
for(var/obj/item/reagent_containers/food/snacks/grown/G in contents)
i++
if(i >= max_items)
to_chat(user, "<span class='warning'>The biogenerator is already full! Activate it.</span>")
else
for(var/obj/item/reagent_containers/food/snacks/grown/G in PB.contents)
if(i >= max_items)
break
if(SEND_SIGNAL(PB, COMSIG_TRY_STORAGE_TAKE, G, src))
i++
if(i<max_items)
to_chat(user, "<span class='info'>You empty the plant bag into the biogenerator.</span>")
else if(PB.contents.len == 0)
to_chat(user, "<span class='info'>You empty the plant bag into the biogenerator, filling it to its capacity.</span>")
else
to_chat(user, "<span class='info'>You fill the biogenerator to its capacity.</span>")
return TRUE //no afterattack
else if(istype(O, /obj/item/reagent_containers/food/snacks/grown))
var/i = 0
for(var/obj/item/reagent_containers/food/snacks/grown/G in contents)
i++
if(i >= max_items)
to_chat(user, "<span class='warning'>The biogenerator is full! Activate it.</span>")
else
if(user.transferItemToLoc(O, src))
to_chat(user, "<span class='info'>You put [O.name] in [src.name]</span>")
return TRUE //no afterattack
else if (istype(O, /obj/item/disk/design_disk))
user.visible_message("[user] begins to load \the [O] in \the [src]...",
"You begin to load a design from \the [O]...",
"You hear the chatter of a floppy drive.")
processing = TRUE
var/obj/item/disk/design_disk/D = O
if(do_after(user, 10, target = src))
for(var/B in D.blueprints)
if(B)
stored_research.add_design(B)
processing = FALSE
return TRUE
else
to_chat(user, "<span class='warning'>You cannot put this in [src.name]!</span>")
/obj/machinery/biogenerator/ui_interact(mob/user)
if(stat & BROKEN || panel_open)
return
. = ..()
var/dat
if(processing)
dat += "<div class='statusDisplay'>Biogenerator is processing! Please wait...</div><BR>"
else
switch(menustat)
if("nopoints")
dat += "<div class='statusDisplay'>You do not have enough biomass to create products.<BR>Please, put growns into reactor and activate it.</div>"
menustat = "menu"
if("complete")
dat += "<div class='statusDisplay'>Operation complete.</div>"
menustat = "menu"
if("void")
dat += "<div class='statusDisplay'>Error: No growns inside.<BR>Please, put growns into reactor.</div>"
menustat = "menu"
if("nobeakerspace")
dat += "<div class='statusDisplay'>Not enough space left in container. Unable to create product.</div>"
menustat = "menu"
if(beaker)
var/categories = show_categories.Copy()
for(var/V in categories)
categories[V] = list()
for(var/V in stored_research.researched_designs)
var/datum/design/D = SSresearch.techweb_design_by_id(V)
for(var/C in categories)
if(C in D.category)
categories[C] += D
dat += "<div class='statusDisplay'>Biomass: [points] units.</div><BR>"
dat += "<A href='?src=[REF(src)];activate=1'>Activate</A><A href='?src=[REF(src)];detach=1'>Detach Container</A>"
for(var/cat in categories)
dat += "<h3>[cat]:</h3>"
dat += "<div class='statusDisplay'>"
for(var/V in categories[cat])
var/datum/design/D = V
dat += "[D.name]: <A href='?src=[REF(src)];create=[D.id];amount=1'>Make</A>"
if(cat in timesFiveCategories)
dat += "<A href='?src=[REF(src)];create=[D.id];amount=5'>x5</A>"
if(ispath(D.build_path, /obj/item/stack))
dat += "<A href='?src=[REF(src)];create=[D.id];amount=10'>x10</A>"
dat += "([D.materials[MAT_BIOMASS]/efficiency])<br>"
dat += "</div>"
else
dat += "<div class='statusDisplay'>No container inside, please insert container.</div>"
var/datum/browser/popup = new(user, "biogen", name, 350, 520)
popup.set_content(dat)
popup.open()
/obj/machinery/biogenerator/proc/activate()
if (usr.stat != CONSCIOUS)
return
if (src.stat != NONE) //NOPOWER etc
return
if(processing)
to_chat(usr, "<span class='warning'>The biogenerator is in the process of working.</span>")
return
var/S = 0
for(var/obj/item/reagent_containers/food/snacks/grown/I in contents)
S += 5
if(I.reagents.get_reagent_amount(/datum/reagent/consumable/nutriment) < 0.1)
points += 1*productivity
else points += I.reagents.get_reagent_amount(/datum/reagent/consumable/nutriment)*10*productivity
qdel(I)
if(S)
processing = TRUE
update_icon()
updateUsrDialog()
playsound(src.loc, 'sound/machines/blender.ogg', 50, 1)
use_power(S*30)
sleep(S+15/productivity)
processing = FALSE
update_icon()
else
menustat = "void"
/obj/machinery/biogenerator/proc/check_cost(list/materials, multiplier = 1, remove_points = 1)
if(materials.len != 1 || materials[1] != MAT_BIOMASS)
return FALSE
if (materials[MAT_BIOMASS]*multiplier/efficiency > points)
menustat = "nopoints"
return FALSE
else
if(remove_points)
points -= materials[MAT_BIOMASS]*multiplier/efficiency
update_icon()
updateUsrDialog()
return TRUE
/obj/machinery/biogenerator/proc/check_container_volume(list/reagents, multiplier = 1)
var/sum_reagents = 0
for(var/R in reagents)
sum_reagents += reagents[R]
sum_reagents *= multiplier
if(beaker.reagents.total_volume + sum_reagents > beaker.reagents.maximum_volume)
menustat = "nobeakerspace"
return FALSE
return TRUE
/obj/machinery/biogenerator/proc/create_product(datum/design/D, amount)
if(!beaker || !loc)
return FALSE
if(ispath(D.build_path, /obj/item/stack))
if(!check_container_volume(D.make_reagents, amount))
return FALSE
if(!check_cost(D.materials, amount))
return FALSE
new D.build_path(drop_location(), amount)
for(var/R in D.make_reagents)
beaker.reagents.add_reagent(R, D.make_reagents[R]*amount)
else
var/i = amount
while(i > 0)
if(!check_container_volume(D.make_reagents))
return .
if(!check_cost(D.materials))
return .
if(D.build_path)
new D.build_path(loc)
for(var/R in D.make_reagents)
beaker.reagents.add_reagent(R, D.make_reagents[R])
. = 1
--i
menustat = "complete"
update_icon()
return .
/obj/machinery/biogenerator/proc/detach()
if(beaker)
beaker.forceMove(drop_location())
beaker = null
update_icon()
/obj/machinery/biogenerator/Topic(href, href_list)
if(..() || panel_open)
return
usr.set_machine(src)
if(href_list["activate"])
activate()
updateUsrDialog()
else if(href_list["detach"])
detach()
updateUsrDialog()
else if(href_list["create"])
var/amount = (text2num(href_list["amount"]))
//Can't be outside these (if you change this keep a sane limit)
amount = CLAMP(amount, 1, 50)
var/id = href_list["create"]
if(!stored_research.researched_designs.Find(id))
//naughty naughty
stack_trace("ID did not map to a researched datum [id]")
return
//Get design by id (or may return error design)
var/datum/design/D = SSresearch.techweb_design_by_id(id)
//Valid design datum, amount and the datum is not the error design, lets proceed
if(D && amount && !istype(D, /datum/design/error_design))
create_product(D, amount)
//This shouldnt happen normally but href forgery is real
else
stack_trace("ID could not be turned into a valid techweb design datum [id]")
updateUsrDialog()
else if(href_list["menu"])
menustat = "menu"
updateUsrDialog()
/obj/machinery/biogenerator
name = "biogenerator"
desc = "Converts plants into biomass, which can be used to construct useful items."
icon = 'icons/obj/machines/biogenerator.dmi'
icon_state = "biogen-empty"
density = TRUE
use_power = IDLE_POWER_USE
idle_power_usage = 40
circuit = /obj/item/circuitboard/machine/biogenerator
var/processing = FALSE
var/obj/item/reagent_containers/glass/beaker = null
var/points = 0
var/menustat = "menu"
var/efficiency = 0
var/productivity = 0
var/max_items = 40
var/datum/techweb/stored_research
var/list/show_categories = list("Food", "Botany Chemicals", "Organic Materials")
var/list/timesFiveCategories = list("Food", "Botany Chemicals")
/obj/machinery/biogenerator/Initialize()
. = ..()
stored_research = new /datum/techweb/specialized/autounlocking/biogenerator
create_reagents(1000)
/obj/machinery/biogenerator/Destroy()
QDEL_NULL(beaker)
return ..()
/obj/machinery/biogenerator/contents_explosion(severity, target)
..()
if(beaker)
beaker.ex_act(severity, target)
/obj/machinery/biogenerator/handle_atom_del(atom/A)
..()
if(A == beaker)
beaker = null
update_icon()
updateUsrDialog()
/obj/machinery/biogenerator/RefreshParts()
var/E = 0
var/P = 0
var/max_storage = 40
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
P += B.rating
max_storage = 40 * B.rating
for(var/obj/item/stock_parts/manipulator/M in component_parts)
E += M.rating
efficiency = E
productivity = P
max_items = max_storage
/obj/machinery/biogenerator/examine(mob/user)
..()
if(in_range(user, src) || isobserver(user))
to_chat(user, "<span class='notice'>The status display reads: Productivity at <b>[productivity*100]%</b>.<br>Matter consumption reduced by <b>[(efficiency*25)-25]</b>%.<br>Machine can hold up to <b>[max_items]</b> pieces of produce.<span>")
/obj/machinery/biogenerator/on_reagent_change(changetype) //When the reagents change, change the icon as well.
update_icon()
/obj/machinery/biogenerator/update_icon()
if(panel_open)
icon_state = "biogen-empty-o"
else if(!src.beaker)
icon_state = "biogen-empty"
else if(!src.processing)
icon_state = "biogen-stand"
else
icon_state = "biogen-work"
return
/obj/machinery/biogenerator/attackby(obj/item/O, mob/user, params)
if(user.a_intent == INTENT_HARM)
return ..()
if(processing)
to_chat(user, "<span class='warning'>The biogenerator is currently processing.</span>")
return
if(default_deconstruction_screwdriver(user, "biogen-empty-o", "biogen-empty", O))
if(beaker)
var/obj/item/reagent_containers/glass/B = beaker
B.forceMove(drop_location())
beaker = null
update_icon()
return
if(default_deconstruction_crowbar(O))
return
if(istype(O, /obj/item/reagent_containers/glass))
. = 1 //no afterattack
if(!panel_open)
if(beaker)
to_chat(user, "<span class='warning'>A container is already loaded into the machine.</span>")
else
if(!user.transferItemToLoc(O, src))
return
beaker = O
to_chat(user, "<span class='notice'>You add the container to the machine.</span>")
update_icon()
updateUsrDialog()
else
to_chat(user, "<span class='warning'>Close the maintenance panel first.</span>")
return
else if(istype(O, /obj/item/storage/bag/plants))
var/obj/item/storage/bag/plants/PB = O
var/i = 0
for(var/obj/item/reagent_containers/food/snacks/grown/G in contents)
i++
if(i >= max_items)
to_chat(user, "<span class='warning'>The biogenerator is already full! Activate it.</span>")
else
for(var/obj/item/reagent_containers/food/snacks/grown/G in PB.contents)
if(i >= max_items)
break
if(SEND_SIGNAL(PB, COMSIG_TRY_STORAGE_TAKE, G, src))
i++
if(i<max_items)
to_chat(user, "<span class='info'>You empty the plant bag into the biogenerator.</span>")
else if(PB.contents.len == 0)
to_chat(user, "<span class='info'>You empty the plant bag into the biogenerator, filling it to its capacity.</span>")
else
to_chat(user, "<span class='info'>You fill the biogenerator to its capacity.</span>")
return TRUE //no afterattack
else if(istype(O, /obj/item/reagent_containers/food/snacks/grown))
var/i = 0
for(var/obj/item/reagent_containers/food/snacks/grown/G in contents)
i++
if(i >= max_items)
to_chat(user, "<span class='warning'>The biogenerator is full! Activate it.</span>")
else
if(user.transferItemToLoc(O, src))
to_chat(user, "<span class='info'>You put [O.name] in [src.name]</span>")
return TRUE //no afterattack
else if (istype(O, /obj/item/disk/design_disk))
user.visible_message("[user] begins to load \the [O] in \the [src]...",
"You begin to load a design from \the [O]...",
"You hear the chatter of a floppy drive.")
processing = TRUE
var/obj/item/disk/design_disk/D = O
if(do_after(user, 10, target = src))
for(var/B in D.blueprints)
if(B)
stored_research.add_design(B)
processing = FALSE
return TRUE
else
to_chat(user, "<span class='warning'>You cannot put this in [src.name]!</span>")
/obj/machinery/biogenerator/ui_interact(mob/user)
if(stat & BROKEN || panel_open)
return
. = ..()
var/dat
if(processing)
dat += "<div class='statusDisplay'>Biogenerator is processing! Please wait...</div><BR>"
else
switch(menustat)
if("nopoints")
dat += "<div class='statusDisplay'>You do not have enough biomass to create products.<BR>Please, put growns into reactor and activate it.</div>"
menustat = "menu"
if("complete")
dat += "<div class='statusDisplay'>Operation complete.</div>"
menustat = "menu"
if("void")
dat += "<div class='statusDisplay'>Error: No growns inside.<BR>Please, put growns into reactor.</div>"
menustat = "menu"
if("nobeakerspace")
dat += "<div class='statusDisplay'>Not enough space left in container. Unable to create product.</div>"
menustat = "menu"
if(beaker)
var/categories = show_categories.Copy()
for(var/V in categories)
categories[V] = list()
for(var/V in stored_research.researched_designs)
var/datum/design/D = SSresearch.techweb_design_by_id(V)
for(var/C in categories)
if(C in D.category)
categories[C] += D
dat += "<div class='statusDisplay'>Biomass: [points] units.</div><BR>"
dat += "<A href='?src=[REF(src)];activate=1'>Activate</A><A href='?src=[REF(src)];detach=1'>Detach Container</A>"
for(var/cat in categories)
dat += "<h3>[cat]:</h3>"
dat += "<div class='statusDisplay'>"
for(var/V in categories[cat])
var/datum/design/D = V
dat += "[D.name]: <A href='?src=[REF(src)];create=[D.id];amount=1'>Make</A>"
if(cat in timesFiveCategories)
dat += "<A href='?src=[REF(src)];create=[D.id];amount=5'>x5</A>"
if(ispath(D.build_path, /obj/item/stack))
dat += "<A href='?src=[REF(src)];create=[D.id];amount=10'>x10</A>"
dat += "([D.materials[MAT_BIOMASS]/efficiency])<br>"
dat += "</div>"
else
dat += "<div class='statusDisplay'>No container inside, please insert container.</div>"
var/datum/browser/popup = new(user, "biogen", name, 350, 520)
popup.set_content(dat)
popup.open()
/obj/machinery/biogenerator/proc/activate()
if (usr.stat != CONSCIOUS)
return
if (src.stat != NONE) //NOPOWER etc
return
if(processing)
to_chat(usr, "<span class='warning'>The biogenerator is in the process of working.</span>")
return
var/S = 0
for(var/obj/item/reagent_containers/food/snacks/grown/I in contents)
S += 5
if(I.reagents.get_reagent_amount(/datum/reagent/consumable/nutriment) < 0.1)
points += 1*productivity
else points += I.reagents.get_reagent_amount(/datum/reagent/consumable/nutriment)*10*productivity
qdel(I)
if(S)
processing = TRUE
update_icon()
updateUsrDialog()
playsound(src.loc, 'sound/machines/blender.ogg', 50, 1)
use_power(S*30)
sleep(S+15/productivity)
processing = FALSE
update_icon()
else
menustat = "void"
/obj/machinery/biogenerator/proc/check_cost(list/materials, multiplier = 1, remove_points = 1)
if(materials.len != 1 || materials[1] != MAT_BIOMASS)
return FALSE
if (materials[MAT_BIOMASS]*multiplier/efficiency > points)
menustat = "nopoints"
return FALSE
else
if(remove_points)
points -= materials[MAT_BIOMASS]*multiplier/efficiency
update_icon()
updateUsrDialog()
return TRUE
/obj/machinery/biogenerator/proc/check_container_volume(list/reagents, multiplier = 1)
var/sum_reagents = 0
for(var/R in reagents)
sum_reagents += reagents[R]
sum_reagents *= multiplier
if(beaker.reagents.total_volume + sum_reagents > beaker.reagents.maximum_volume)
menustat = "nobeakerspace"
return FALSE
return TRUE
/obj/machinery/biogenerator/proc/create_product(datum/design/D, amount)
if(!beaker || !loc)
return FALSE
if(ispath(D.build_path, /obj/item/stack))
if(!check_container_volume(D.make_reagents, amount))
return FALSE
if(!check_cost(D.materials, amount))
return FALSE
new D.build_path(drop_location(), amount)
for(var/R in D.make_reagents)
beaker.reagents.add_reagent(R, D.make_reagents[R]*amount)
else
var/i = amount
while(i > 0)
if(!check_container_volume(D.make_reagents))
return .
if(!check_cost(D.materials))
return .
if(D.build_path)
new D.build_path(loc)
for(var/R in D.make_reagents)
beaker.reagents.add_reagent(R, D.make_reagents[R])
. = 1
--i
menustat = "complete"
update_icon()
return .
/obj/machinery/biogenerator/proc/detach()
if(beaker)
beaker.forceMove(drop_location())
beaker = null
update_icon()
/obj/machinery/biogenerator/Topic(href, href_list)
if(..() || panel_open)
return
usr.set_machine(src)
if(href_list["activate"])
activate()
updateUsrDialog()
else if(href_list["detach"])
detach()
updateUsrDialog()
else if(href_list["create"])
var/amount = (text2num(href_list["amount"]))
//Can't be outside these (if you change this keep a sane limit)
amount = CLAMP(amount, 1, 50)
var/id = href_list["create"]
if(!stored_research.researched_designs.Find(id))
//naughty naughty
stack_trace("ID did not map to a researched datum [id]")
return
//Get design by id (or may return error design)
var/datum/design/D = SSresearch.techweb_design_by_id(id)
//Valid design datum, amount and the datum is not the error design, lets proceed
if(D && amount && !istype(D, /datum/design/error_design))
create_product(D, amount)
//This shouldnt happen normally but href forgery is real
else
stack_trace("ID could not be turned into a valid techweb design datum [id]")
updateUsrDialog()
else if(href_list["menu"])
menustat = "menu"
updateUsrDialog()
+169 -169
View File
@@ -1,169 +1,169 @@
// ***********************************************************
// Foods that are produced from hydroponics ~~~~~~~~~~
// Data from the seeds carry over to these grown foods
// ***********************************************************
// Base type. Subtypes are found in /grown dir.
/obj/item/reagent_containers/food/snacks/grown
icon = 'icons/obj/hydroponics/harvest.dmi'
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/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.
/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 = rand(-5, 5)
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 1
return 0
/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/msg = "<span class='info'>*---------*\n This is \a <span class='name'>[src]</span>.\n"
if(seed)
msg += seed.get_analyzer_text()
var/reag_txt = ""
if(seed)
for(var/reagent_id in seed.reagents_add)
var/datum/reagent/R = GLOB.chemical_reagents_list[reagent_id]
var/amt = reagents.get_reagent_amount(reagent_id)
reag_txt += "\n<span class='info'>- [R.name]: [amt]</span>"
if(reag_txt)
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 && seed.get_gene(/datum/plant_gene/trait/squash))
squash(user)
..()
/obj/item/reagent_containers/food/snacks/grown/throw_impact(atom/hit_atom)
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)
if(ispath(splat_type, /obj/effect/decal/cleanable/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] has been squashed.</span>","<span class='italics'>You hear a smack.</span>")
if(seed)
for(var/datum/plant_gene/trait/trait in seed.genes)
trait.on_squash(src, target)
reagents.reaction(T)
for(var/A in T)
reagents.reaction(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&&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&&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)
// For item-containing growns such as eggy or gatfruit
/obj/item/reagent_containers/food/snacks/grown/shell/attack_self(mob/user)
var/obj/item/T
if(trash)
T = generate_trash()
qdel(src)
user.putItemFromInventoryInHandIfPossible(T, user.active_hand_index, TRUE)
to_chat(user, "<span class='notice'>You open [src]\'s shell, revealing \a [T].</span>")
// ***********************************************************
// Foods that are produced from hydroponics ~~~~~~~~~~
// Data from the seeds carry over to these grown foods
// ***********************************************************
// Base type. Subtypes are found in /grown dir.
/obj/item/reagent_containers/food/snacks/grown
icon = 'icons/obj/hydroponics/harvest.dmi'
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/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.
/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 = rand(-5, 5)
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 1
return 0
/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/msg = "<span class='info'>*---------*\n This is \a <span class='name'>[src]</span>.\n"
if(seed)
msg += seed.get_analyzer_text()
var/reag_txt = ""
if(seed)
for(var/reagent_id in seed.reagents_add)
var/datum/reagent/R = GLOB.chemical_reagents_list[reagent_id]
var/amt = reagents.get_reagent_amount(reagent_id)
reag_txt += "\n<span class='info'>- [R.name]: [amt]</span>"
if(reag_txt)
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 && seed.get_gene(/datum/plant_gene/trait/squash))
squash(user)
..()
/obj/item/reagent_containers/food/snacks/grown/throw_impact(atom/hit_atom)
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)
if(ispath(splat_type, /obj/effect/decal/cleanable/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] has been squashed.</span>","<span class='italics'>You hear a smack.</span>")
if(seed)
for(var/datum/plant_gene/trait/trait in seed.genes)
trait.on_squash(src, target)
reagents.reaction(T)
for(var/A in T)
reagents.reaction(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&&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&&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)
// For item-containing growns such as eggy or gatfruit
/obj/item/reagent_containers/food/snacks/grown/shell/attack_self(mob/user)
var/obj/item/T
if(trash)
T = generate_trash()
qdel(src)
user.putItemFromInventoryInHandIfPossible(T, user.active_hand_index, TRUE)
to_chat(user, "<span class='notice'>You open [src]\'s shell, revealing \a [T].</span>")
+62 -62
View File
@@ -1,62 +1,62 @@
// **********************
// Other harvested materials from plants (that are not food)
// **********************
/obj/item/grown // Grown weapons
name = "grown_weapon"
icon = 'icons/obj/hydroponics/harvest.dmi'
resistance_flags = FLAMMABLE
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/tastes = list("indescribable" = 1) //Stops runtimes. Grown are un-eatable anyways so if you do then its a bug
/obj/item/grown/Initialize(newloc, obj/item/seeds/new_seed)
. = ..()
create_reagents(50)
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 = rand(-5, 5)
pixel_y = rand(-5, 5)
if(seed)
for(var/datum/plant_gene/trait/T in seed.genes)
T.on_new(src, newloc)
if(istype(src, seed.product)) // no adding reagents if it is just a trash item
seed.prepare_result(src)
transform *= TRANSFORM_USING_VARIABLE(seed.potency, 100) + 0.5
add_juice()
/obj/item/grown/attackby(obj/item/O, mob/user, params)
..()
if (istype(O, /obj/item/plant_analyzer))
var/msg = "<span class='info'>*---------*\n This is \a <span class='name'>[src]</span>\n"
if(seed)
msg += seed.get_analyzer_text()
msg += "</span>"
to_chat(usr, msg)
return
/obj/item/grown/proc/add_juice()
if(reagents)
return 1
return 0
/obj/item/grown/throw_impact(atom/hit_atom)
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)
/obj/item/grown/microwave_act(obj/machinery/microwave/M)
return
/obj/item/grown/on_grind()
for(var/i in 1 to grind_results.len)
grind_results[grind_results[i]] = round(seed.potency)
// **********************
// Other harvested materials from plants (that are not food)
// **********************
/obj/item/grown // Grown weapons
name = "grown_weapon"
icon = 'icons/obj/hydroponics/harvest.dmi'
resistance_flags = FLAMMABLE
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/tastes = list("indescribable" = 1) //Stops runtimes. Grown are un-eatable anyways so if you do then its a bug
/obj/item/grown/Initialize(newloc, obj/item/seeds/new_seed)
. = ..()
create_reagents(50)
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 = rand(-5, 5)
pixel_y = rand(-5, 5)
if(seed)
for(var/datum/plant_gene/trait/T in seed.genes)
T.on_new(src, newloc)
if(istype(src, seed.product)) // no adding reagents if it is just a trash item
seed.prepare_result(src)
transform *= TRANSFORM_USING_VARIABLE(seed.potency, 100) + 0.5
add_juice()
/obj/item/grown/attackby(obj/item/O, mob/user, params)
..()
if (istype(O, /obj/item/plant_analyzer))
var/msg = "<span class='info'>*---------*\n This is \a <span class='name'>[src]</span>\n"
if(seed)
msg += seed.get_analyzer_text()
msg += "</span>"
to_chat(usr, msg)
return
/obj/item/grown/proc/add_juice()
if(reagents)
return 1
return 0
/obj/item/grown/throw_impact(atom/hit_atom)
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)
/obj/item/grown/microwave_act(obj/machinery/microwave/M)
return
/obj/item/grown/on_grind()
for(var/i in 1 to grind_results.len)
grind_results[grind_results[i]] = round(seed.potency)
+194 -194
View File
@@ -1,195 +1,195 @@
// Plant analyzer
/obj/item/plant_analyzer
name = "plant analyzer"
desc = "A scanner used to evaluate a plant's various areas of growth."
icon = 'icons/obj/device.dmi'
icon_state = "hydro"
item_state = "analyzer"
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
w_class = WEIGHT_CLASS_TINY
slot_flags = ITEM_SLOT_BELT
materials = list(MAT_METAL=30, MAT_GLASS=20)
// *************************************
// Hydroponics Tools
// *************************************
/obj/item/reagent_containers/spray/weedspray // -- Skie
desc = "It's a toxic mixture, in spray form, to kill small weeds."
icon = 'icons/obj/hydroponics/equipment.dmi'
name = "weed spray"
icon_state = "weedspray"
item_state = "spraycan"
lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
volume = 100
list_reagents = list(/datum/reagent/toxin/plantbgone/weedkiller = 100)
/obj/item/reagent_containers/spray/weedspray/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is huffing [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return (TOXLOSS)
/obj/item/reagent_containers/spray/pestspray // -- Skie
desc = "It's some pest eliminator spray! <I>Do not inhale!</I>"
icon = 'icons/obj/hydroponics/equipment.dmi'
name = "pest spray"
icon_state = "pestspray"
item_state = "plantbgone"
lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
volume = 100
list_reagents = list(/datum/reagent/toxin/pestkiller = 100)
/obj/item/reagent_containers/spray/pestspray/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is huffing [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return (TOXLOSS)
/obj/item/cultivator
name = "cultivator"
desc = "It's used for removing weeds or scratching your back."
icon = 'icons/obj/items_and_weapons.dmi'
icon_state = "cultivator"
item_state = "cultivator"
lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
flags_1 = CONDUCT_1
force = 5
throwforce = 7
w_class = WEIGHT_CLASS_SMALL
materials = list(MAT_METAL=50)
attack_verb = list("slashed", "sliced", "cut", "clawed")
hitsound = 'sound/weapons/bladeslice.ogg'
/obj/item/cultivator/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is scratching [user.p_their()] back as hard as [user.p_they()] can with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return (BRUTELOSS)
/obj/item/hatchet
name = "hatchet"
desc = "A very sharp axe blade upon a short fibremetal handle. It has a long history of chopping things, but now it is used for chopping wood."
icon = 'icons/obj/items_and_weapons.dmi'
icon_state = "hatchet"
item_state = "hatchet"
lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
flags_1 = CONDUCT_1
force = 12
w_class = WEIGHT_CLASS_SMALL
throwforce = 15
throw_speed = 3
throw_range = 4
materials = list(MAT_METAL = 15000)
attack_verb = list("chopped", "torn", "cut")
hitsound = 'sound/weapons/bladeslice.ogg'
sharpness = IS_SHARP
/obj/item/hatchet/Initialize()
. = ..()
AddComponent(/datum/component/butchering, 70, 100)
/obj/item/hatchet/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is chopping at [user.p_them()]self with [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
playsound(src, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
return (BRUTELOSS)
/obj/item/scythe
icon_state = "scythe0"
lefthand_file = 'icons/mob/inhands/weapons/polearms_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/polearms_righthand.dmi'
name = "scythe"
desc = "A sharp and curved blade on a long fibremetal handle, this tool makes it easy to reap what you sow."
force = 13
throwforce = 5
throw_speed = 2
throw_range = 3
w_class = WEIGHT_CLASS_BULKY
flags_1 = CONDUCT_1
armour_penetration = 20
slot_flags = ITEM_SLOT_BACK
attack_verb = list("chopped", "sliced", "cut", "reaped")
hitsound = 'sound/weapons/bladeslice.ogg'
var/swiping = FALSE
/obj/item/scythe/Initialize()
. = ..()
AddComponent(/datum/component/butchering, 90, 105)
/obj/item/scythe/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is beheading [user.p_them()]self with [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
if(iscarbon(user))
var/mob/living/carbon/C = user
var/obj/item/bodypart/BP = C.get_bodypart(BODY_ZONE_HEAD)
if(BP)
BP.drop_limb()
playsound(src,pick('sound/misc/desceration-01.ogg','sound/misc/desceration-02.ogg','sound/misc/desceration-01.ogg') ,50, 1, -1)
return (BRUTELOSS)
/obj/item/scythe/pre_attack(atom/A, mob/living/user, params)
if(swiping || !istype(A, /obj/structure/spacevine) || get_turf(A) == get_turf(user))
return ..()
else
var/turf/user_turf = get_turf(user)
var/dir_to_target = get_dir(user_turf, get_turf(A))
var/stam_gain = 0
swiping = TRUE
var/static/list/scythe_slash_angles = list(0, 45, 90, -45, -90)
for(var/i in scythe_slash_angles)
var/turf/T = get_step(user_turf, turn(dir_to_target, i))
for(var/obj/structure/spacevine/V in T)
if(user.Adjacent(V))
melee_attack_chain(user, V)
stam_gain += 5 //should be hitcost
swiping = FALSE
stam_gain += 2 //Initial hitcost
user.adjustStaminaLoss(-stam_gain)
// *************************************
// Nutrient defines for hydroponics
// *************************************
/obj/item/reagent_containers/glass/bottle/nutrient
name = "bottle of nutrient"
volume = 50
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(1,2,5,10,15,25,50)
/obj/item/reagent_containers/glass/bottle/nutrient/Initialize()
. = ..()
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
/obj/item/reagent_containers/glass/bottle/nutrient/ez
name = "bottle of E-Z-Nutrient"
desc = "Contains a fertilizer that causes mild mutations with each harvest."
list_reagents = list(/datum/reagent/plantnutriment/eznutriment = 50)
/obj/item/reagent_containers/glass/bottle/nutrient/l4z
name = "bottle of Left 4 Zed"
desc = "Contains a fertilizer that limits plant yields to no more than one and causes significant mutations in plants."
list_reagents = list(/datum/reagent/plantnutriment/left4zednutriment = 50)
/obj/item/reagent_containers/glass/bottle/nutrient/rh
name = "bottle of Robust Harvest"
desc = "Contains a fertilizer that increases the yield of a plant by 30% while causing no mutations."
list_reagents = list(/datum/reagent/plantnutriment/robustharvestnutriment = 50)
/obj/item/reagent_containers/glass/bottle/nutrient/empty
name = "bottle"
/obj/item/reagent_containers/glass/bottle/killer
volume = 50
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(1,2,5,10,15,25,50)
/obj/item/reagent_containers/glass/bottle/killer/weedkiller
name = "bottle of weed killer"
desc = "Contains a herbicide."
list_reagents = list(/datum/reagent/toxin/plantbgone/weedkiller = 50)
/obj/item/reagent_containers/glass/bottle/killer/pestkiller
name = "bottle of pest spray"
desc = "Contains a pesticide."
// Plant analyzer
/obj/item/plant_analyzer
name = "plant analyzer"
desc = "A scanner used to evaluate a plant's various areas of growth."
icon = 'icons/obj/device.dmi'
icon_state = "hydro"
item_state = "analyzer"
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
w_class = WEIGHT_CLASS_TINY
slot_flags = ITEM_SLOT_BELT
materials = list(MAT_METAL=30, MAT_GLASS=20)
// *************************************
// Hydroponics Tools
// *************************************
/obj/item/reagent_containers/spray/weedspray // -- Skie
desc = "It's a toxic mixture, in spray form, to kill small weeds."
icon = 'icons/obj/hydroponics/equipment.dmi'
name = "weed spray"
icon_state = "weedspray"
item_state = "spraycan"
lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
volume = 100
list_reagents = list(/datum/reagent/toxin/plantbgone/weedkiller = 100)
/obj/item/reagent_containers/spray/weedspray/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is huffing [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return (TOXLOSS)
/obj/item/reagent_containers/spray/pestspray // -- Skie
desc = "It's some pest eliminator spray! <I>Do not inhale!</I>"
icon = 'icons/obj/hydroponics/equipment.dmi'
name = "pest spray"
icon_state = "pestspray"
item_state = "plantbgone"
lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
volume = 100
list_reagents = list(/datum/reagent/toxin/pestkiller = 100)
/obj/item/reagent_containers/spray/pestspray/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is huffing [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return (TOXLOSS)
/obj/item/cultivator
name = "cultivator"
desc = "It's used for removing weeds or scratching your back."
icon = 'icons/obj/items_and_weapons.dmi'
icon_state = "cultivator"
item_state = "cultivator"
lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
flags_1 = CONDUCT_1
force = 5
throwforce = 7
w_class = WEIGHT_CLASS_SMALL
materials = list(MAT_METAL=50)
attack_verb = list("slashed", "sliced", "cut", "clawed")
hitsound = 'sound/weapons/bladeslice.ogg'
/obj/item/cultivator/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is scratching [user.p_their()] back as hard as [user.p_they()] can with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return (BRUTELOSS)
/obj/item/hatchet
name = "hatchet"
desc = "A very sharp axe blade upon a short fibremetal handle. It has a long history of chopping things, but now it is used for chopping wood."
icon = 'icons/obj/items_and_weapons.dmi'
icon_state = "hatchet"
item_state = "hatchet"
lefthand_file = 'icons/mob/inhands/equipment/hydroponics_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/hydroponics_righthand.dmi'
flags_1 = CONDUCT_1
force = 12
w_class = WEIGHT_CLASS_SMALL
throwforce = 15
throw_speed = 3
throw_range = 4
materials = list(MAT_METAL = 15000)
attack_verb = list("chopped", "torn", "cut")
hitsound = 'sound/weapons/bladeslice.ogg'
sharpness = IS_SHARP
/obj/item/hatchet/Initialize()
. = ..()
AddComponent(/datum/component/butchering, 70, 100)
/obj/item/hatchet/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is chopping at [user.p_them()]self with [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
playsound(src, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
return (BRUTELOSS)
/obj/item/scythe
icon_state = "scythe0"
lefthand_file = 'icons/mob/inhands/weapons/polearms_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/polearms_righthand.dmi'
name = "scythe"
desc = "A sharp and curved blade on a long fibremetal handle, this tool makes it easy to reap what you sow."
force = 13
throwforce = 5
throw_speed = 2
throw_range = 3
w_class = WEIGHT_CLASS_BULKY
flags_1 = CONDUCT_1
armour_penetration = 20
slot_flags = ITEM_SLOT_BACK
attack_verb = list("chopped", "sliced", "cut", "reaped")
hitsound = 'sound/weapons/bladeslice.ogg'
var/swiping = FALSE
/obj/item/scythe/Initialize()
. = ..()
AddComponent(/datum/component/butchering, 90, 105)
/obj/item/scythe/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is beheading [user.p_them()]self with [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
if(iscarbon(user))
var/mob/living/carbon/C = user
var/obj/item/bodypart/BP = C.get_bodypart(BODY_ZONE_HEAD)
if(BP)
BP.drop_limb()
playsound(src,pick('sound/misc/desceration-01.ogg','sound/misc/desceration-02.ogg','sound/misc/desceration-01.ogg') ,50, 1, -1)
return (BRUTELOSS)
/obj/item/scythe/pre_attack(atom/A, mob/living/user, params)
if(swiping || !istype(A, /obj/structure/spacevine) || get_turf(A) == get_turf(user))
return ..()
else
var/turf/user_turf = get_turf(user)
var/dir_to_target = get_dir(user_turf, get_turf(A))
var/stam_gain = 0
swiping = TRUE
var/static/list/scythe_slash_angles = list(0, 45, 90, -45, -90)
for(var/i in scythe_slash_angles)
var/turf/T = get_step(user_turf, turn(dir_to_target, i))
for(var/obj/structure/spacevine/V in T)
if(user.Adjacent(V))
melee_attack_chain(user, V)
stam_gain += 5 //should be hitcost
swiping = FALSE
stam_gain += 2 //Initial hitcost
user.adjustStaminaLoss(-stam_gain)
// *************************************
// Nutrient defines for hydroponics
// *************************************
/obj/item/reagent_containers/glass/bottle/nutrient
name = "bottle of nutrient"
volume = 50
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(1,2,5,10,15,25,50)
/obj/item/reagent_containers/glass/bottle/nutrient/Initialize()
. = ..()
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
/obj/item/reagent_containers/glass/bottle/nutrient/ez
name = "bottle of E-Z-Nutrient"
desc = "Contains a fertilizer that causes mild mutations with each harvest."
list_reagents = list(/datum/reagent/plantnutriment/eznutriment = 50)
/obj/item/reagent_containers/glass/bottle/nutrient/l4z
name = "bottle of Left 4 Zed"
desc = "Contains a fertilizer that limits plant yields to no more than one and causes significant mutations in plants."
list_reagents = list(/datum/reagent/plantnutriment/left4zednutriment = 50)
/obj/item/reagent_containers/glass/bottle/nutrient/rh
name = "bottle of Robust Harvest"
desc = "Contains a fertilizer that increases the yield of a plant by 30% while causing no mutations."
list_reagents = list(/datum/reagent/plantnutriment/robustharvestnutriment = 50)
/obj/item/reagent_containers/glass/bottle/nutrient/empty
name = "bottle"
/obj/item/reagent_containers/glass/bottle/killer
volume = 50
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(1,2,5,10,15,25,50)
/obj/item/reagent_containers/glass/bottle/killer/weedkiller
name = "bottle of weed killer"
desc = "Contains a herbicide."
list_reagents = list(/datum/reagent/toxin/plantbgone/weedkiller = 50)
/obj/item/reagent_containers/glass/bottle/killer/pestkiller
name = "bottle of pest spray"
desc = "Contains a pesticide."
list_reagents = list(/datum/reagent/toxin/pestkiller = 50)
File diff suppressed because it is too large Load Diff
+197 -197
View File
@@ -1,197 +1,197 @@
/proc/seedify(obj/item/O, t_max, obj/machinery/seed_extractor/extractor, mob/living/user)
var/t_amount = 0
var/list/seeds = list()
if(t_max == -1)
if(extractor)
t_max = rand(1,4) * extractor.seed_multiplier
else
t_max = rand(1,4)
var/seedloc = O.loc
if(extractor)
seedloc = extractor.loc
if(istype(O, /obj/item/reagent_containers/food/snacks/grown/))
var/obj/item/reagent_containers/food/snacks/grown/F = O
if(F.seed)
if(user && !user.temporarilyRemoveItemFromInventory(O)) //couldn't drop the item
return
while(t_amount < t_max)
var/obj/item/seeds/t_prod = F.seed.Copy()
seeds.Add(t_prod)
t_prod.forceMove(seedloc)
t_amount++
qdel(O)
return seeds
else if(istype(O, /obj/item/grown))
var/obj/item/grown/F = O
if(F.seed)
if(user && !user.temporarilyRemoveItemFromInventory(O))
return
while(t_amount < t_max)
var/obj/item/seeds/t_prod = F.seed.Copy()
t_prod.forceMove(seedloc)
t_amount++
qdel(O)
return 1
return 0
/obj/machinery/seed_extractor
name = "seed extractor"
desc = "Extracts and bags seeds from produce."
icon = 'icons/obj/hydroponics/equipment.dmi'
icon_state = "sextractor"
density = TRUE
circuit = /obj/item/circuitboard/machine/seed_extractor
var/piles = list()
var/max_seeds = 1000
var/seed_multiplier = 1
/obj/machinery/seed_extractor/RefreshParts()
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
max_seeds = 1000 * B.rating
for(var/obj/item/stock_parts/manipulator/M in component_parts)
seed_multiplier = M.rating
/obj/machinery/seed_extractor/examine(mob/user)
..()
if(in_range(user, src) || isobserver(user))
to_chat(user, "<span class='notice'>The status display reads: Extracting <b>[seed_multiplier]</b> seed(s) per piece of produce.<br>Machine can store up to <b>[max_seeds]%</b> seeds.<span>")
/obj/machinery/seed_extractor/attackby(obj/item/O, mob/user, params)
if(default_deconstruction_screwdriver(user, "sextractor_open", "sextractor", O))
return
if(default_pry_open(O))
return
if(default_unfasten_wrench(user, O))
return
if(default_deconstruction_crowbar(O))
return
if(istype(O, /obj/item/storage/bag/plants))
var/obj/item/storage/P = O
var/loaded = 0
for(var/obj/item/seeds/G in P.contents)
if(contents.len >= max_seeds)
break
++loaded
add_seed(G)
if (loaded)
to_chat(user, "<span class='notice'>You put as many seeds from \the [O.name] into [src] as you can.</span>")
else
to_chat(user, "<span class='notice'>There are no seeds in \the [O.name].</span>")
return
else if(seedify(O,-1, src, user))
to_chat(user, "<span class='notice'>You extract some seeds.</span>")
return
else if (istype(O, /obj/item/seeds))
if(add_seed(O))
to_chat(user, "<span class='notice'>You add [O] to [src.name].</span>")
updateUsrDialog()
return
else if(user.a_intent != INTENT_HARM)
to_chat(user, "<span class='warning'>You can't extract any seeds from \the [O.name]!</span>")
else
return ..()
/datum/seed_pile
var/name = ""
var/lifespan = 0 //Saved stats
var/endurance = 0
var/maturation = 0
var/production = 0
var/yield = 0
var/potency = 0
var/amount = 0
/datum/seed_pile/New(var/name, var/life, var/endur, var/matur, var/prod, var/yie, var/poten, var/am = 1)
src.name = name
src.lifespan = life
src.endurance = endur
src.maturation = matur
src.production = prod
src.yield = yie
src.potency = poten
src.amount = am
/obj/machinery/seed_extractor/ui_interact(mob/user)
. = ..()
if (stat)
return FALSE
var/dat = "<b>Stored seeds:</b><br>"
if (contents.len == 0)
dat += "<font color='red'>No seeds</font>"
else
dat += "<table cellpadding='3' style='text-align:center;'><tr><td>Name</td><td>Lifespan</td><td>Endurance</td><td>Maturation</td><td>Production</td><td>Yield</td><td>Potency</td><td>Stock</td></tr>"
for (var/datum/seed_pile/O in piles)
dat += "<tr><td>[O.name]</td><td>[O.lifespan]</td><td>[O.endurance]</td><td>[O.maturation]</td>"
dat += "<td>[O.production]</td><td>[O.yield]</td><td>[O.potency]</td><td>"
dat += "<a href='byond://?src=[REF(src)];name=[O.name];li=[O.lifespan];en=[O.endurance];ma=[O.maturation];pr=[O.production];yi=[O.yield];pot=[O.potency]'>Vend</a> ([O.amount] left)</td></tr>"
dat += "</table>"
var/datum/browser/popup = new(user, "seed_ext", name, 700, 400)
popup.set_content(dat)
popup.open()
return
/obj/machinery/seed_extractor/Topic(var/href, var/list/href_list)
if(..())
return
usr.set_machine(src)
href_list["li"] = text2num(href_list["li"])
href_list["en"] = text2num(href_list["en"])
href_list["ma"] = text2num(href_list["ma"])
href_list["pr"] = text2num(href_list["pr"])
href_list["yi"] = text2num(href_list["yi"])
href_list["pot"] = text2num(href_list["pot"])
for (var/datum/seed_pile/N in piles)//Find the pile we need to reduce...
if (href_list["name"] == N.name && href_list["li"] == N.lifespan && href_list["en"] == N.endurance && href_list["ma"] == N.maturation && href_list["pr"] == N.production && href_list["yi"] == N.yield && href_list["pot"] == N.potency)
if(N.amount <= 0)
return
N.amount = max(N.amount - 1, 0)
if (N.amount <= 0)
piles -= N
qdel(N)
break
for (var/obj/T in contents)//Now we find the seed we need to vend
var/obj/item/seeds/O = T
if (O.plantname == href_list["name"] && O.lifespan == href_list["li"] && O.endurance == href_list["en"] && O.maturation == href_list["ma"] && O.production == href_list["pr"] && O.yield == href_list["yi"] && O.potency == href_list["pot"])
O.forceMove(drop_location())
break
src.updateUsrDialog()
return
/obj/machinery/seed_extractor/proc/add_seed(obj/item/seeds/O)
if(contents.len >= 999)
to_chat(usr, "<span class='notice'>\The [src] is full.</span>")
return FALSE
var/datum/component/storage/STR = O.loc.GetComponent(/datum/component/storage)
if(STR)
if(!STR.remove_from_storage(O,src))
return FALSE
else if(ismob(O.loc))
var/mob/M = O.loc
if(!M.transferItemToLoc(O, src))
return FALSE
. = TRUE
for (var/datum/seed_pile/N in piles)
if (O.plantname == N.name && O.lifespan == N.lifespan && O.endurance == N.endurance && O.maturation == N.maturation && O.production == N.production && O.yield == N.yield && O.potency == N.potency)
++N.amount
return
piles += new /datum/seed_pile(O.plantname, O.lifespan, O.endurance, O.maturation, O.production, O.yield, O.potency)
/proc/seedify(obj/item/O, t_max, obj/machinery/seed_extractor/extractor, mob/living/user)
var/t_amount = 0
var/list/seeds = list()
if(t_max == -1)
if(extractor)
t_max = rand(1,4) * extractor.seed_multiplier
else
t_max = rand(1,4)
var/seedloc = O.loc
if(extractor)
seedloc = extractor.loc
if(istype(O, /obj/item/reagent_containers/food/snacks/grown/))
var/obj/item/reagent_containers/food/snacks/grown/F = O
if(F.seed)
if(user && !user.temporarilyRemoveItemFromInventory(O)) //couldn't drop the item
return
while(t_amount < t_max)
var/obj/item/seeds/t_prod = F.seed.Copy()
seeds.Add(t_prod)
t_prod.forceMove(seedloc)
t_amount++
qdel(O)
return seeds
else if(istype(O, /obj/item/grown))
var/obj/item/grown/F = O
if(F.seed)
if(user && !user.temporarilyRemoveItemFromInventory(O))
return
while(t_amount < t_max)
var/obj/item/seeds/t_prod = F.seed.Copy()
t_prod.forceMove(seedloc)
t_amount++
qdel(O)
return 1
return 0
/obj/machinery/seed_extractor
name = "seed extractor"
desc = "Extracts and bags seeds from produce."
icon = 'icons/obj/hydroponics/equipment.dmi'
icon_state = "sextractor"
density = TRUE
circuit = /obj/item/circuitboard/machine/seed_extractor
var/piles = list()
var/max_seeds = 1000
var/seed_multiplier = 1
/obj/machinery/seed_extractor/RefreshParts()
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
max_seeds = 1000 * B.rating
for(var/obj/item/stock_parts/manipulator/M in component_parts)
seed_multiplier = M.rating
/obj/machinery/seed_extractor/examine(mob/user)
..()
if(in_range(user, src) || isobserver(user))
to_chat(user, "<span class='notice'>The status display reads: Extracting <b>[seed_multiplier]</b> seed(s) per piece of produce.<br>Machine can store up to <b>[max_seeds]%</b> seeds.<span>")
/obj/machinery/seed_extractor/attackby(obj/item/O, mob/user, params)
if(default_deconstruction_screwdriver(user, "sextractor_open", "sextractor", O))
return
if(default_pry_open(O))
return
if(default_unfasten_wrench(user, O))
return
if(default_deconstruction_crowbar(O))
return
if(istype(O, /obj/item/storage/bag/plants))
var/obj/item/storage/P = O
var/loaded = 0
for(var/obj/item/seeds/G in P.contents)
if(contents.len >= max_seeds)
break
++loaded
add_seed(G)
if (loaded)
to_chat(user, "<span class='notice'>You put as many seeds from \the [O.name] into [src] as you can.</span>")
else
to_chat(user, "<span class='notice'>There are no seeds in \the [O.name].</span>")
return
else if(seedify(O,-1, src, user))
to_chat(user, "<span class='notice'>You extract some seeds.</span>")
return
else if (istype(O, /obj/item/seeds))
if(add_seed(O))
to_chat(user, "<span class='notice'>You add [O] to [src.name].</span>")
updateUsrDialog()
return
else if(user.a_intent != INTENT_HARM)
to_chat(user, "<span class='warning'>You can't extract any seeds from \the [O.name]!</span>")
else
return ..()
/datum/seed_pile
var/name = ""
var/lifespan = 0 //Saved stats
var/endurance = 0
var/maturation = 0
var/production = 0
var/yield = 0
var/potency = 0
var/amount = 0
/datum/seed_pile/New(var/name, var/life, var/endur, var/matur, var/prod, var/yie, var/poten, var/am = 1)
src.name = name
src.lifespan = life
src.endurance = endur
src.maturation = matur
src.production = prod
src.yield = yie
src.potency = poten
src.amount = am
/obj/machinery/seed_extractor/ui_interact(mob/user)
. = ..()
if (stat)
return FALSE
var/dat = "<b>Stored seeds:</b><br>"
if (contents.len == 0)
dat += "<font color='red'>No seeds</font>"
else
dat += "<table cellpadding='3' style='text-align:center;'><tr><td>Name</td><td>Lifespan</td><td>Endurance</td><td>Maturation</td><td>Production</td><td>Yield</td><td>Potency</td><td>Stock</td></tr>"
for (var/datum/seed_pile/O in piles)
dat += "<tr><td>[O.name]</td><td>[O.lifespan]</td><td>[O.endurance]</td><td>[O.maturation]</td>"
dat += "<td>[O.production]</td><td>[O.yield]</td><td>[O.potency]</td><td>"
dat += "<a href='byond://?src=[REF(src)];name=[O.name];li=[O.lifespan];en=[O.endurance];ma=[O.maturation];pr=[O.production];yi=[O.yield];pot=[O.potency]'>Vend</a> ([O.amount] left)</td></tr>"
dat += "</table>"
var/datum/browser/popup = new(user, "seed_ext", name, 700, 400)
popup.set_content(dat)
popup.open()
return
/obj/machinery/seed_extractor/Topic(var/href, var/list/href_list)
if(..())
return
usr.set_machine(src)
href_list["li"] = text2num(href_list["li"])
href_list["en"] = text2num(href_list["en"])
href_list["ma"] = text2num(href_list["ma"])
href_list["pr"] = text2num(href_list["pr"])
href_list["yi"] = text2num(href_list["yi"])
href_list["pot"] = text2num(href_list["pot"])
for (var/datum/seed_pile/N in piles)//Find the pile we need to reduce...
if (href_list["name"] == N.name && href_list["li"] == N.lifespan && href_list["en"] == N.endurance && href_list["ma"] == N.maturation && href_list["pr"] == N.production && href_list["yi"] == N.yield && href_list["pot"] == N.potency)
if(N.amount <= 0)
return
N.amount = max(N.amount - 1, 0)
if (N.amount <= 0)
piles -= N
qdel(N)
break
for (var/obj/T in contents)//Now we find the seed we need to vend
var/obj/item/seeds/O = T
if (O.plantname == href_list["name"] && O.lifespan == href_list["li"] && O.endurance == href_list["en"] && O.maturation == href_list["ma"] && O.production == href_list["pr"] && O.yield == href_list["yi"] && O.potency == href_list["pot"])
O.forceMove(drop_location())
break
src.updateUsrDialog()
return
/obj/machinery/seed_extractor/proc/add_seed(obj/item/seeds/O)
if(contents.len >= 999)
to_chat(usr, "<span class='notice'>\The [src] is full.</span>")
return FALSE
var/datum/component/storage/STR = O.loc.GetComponent(/datum/component/storage)
if(STR)
if(!STR.remove_from_storage(O,src))
return FALSE
else if(ismob(O.loc))
var/mob/M = O.loc
if(!M.transferItemToLoc(O, src))
return FALSE
. = TRUE
for (var/datum/seed_pile/N in piles)
if (O.plantname == N.name && O.lifespan == N.lifespan && O.endurance == N.endurance && O.maturation == N.maturation && O.production == N.production && O.yield == N.yield && O.potency == N.potency)
++N.amount
return
piles += new /datum/seed_pile(O.plantname, O.lifespan, O.endurance, O.maturation, O.production, O.yield, O.potency)
+468 -468
View File
@@ -1,468 +1,468 @@
// ********************************************************
// Here's all the seeds (plants) that can be used in hydro
// ********************************************************
/obj/item/seeds
icon = 'icons/obj/hydroponics/seeds.dmi'
icon_state = "seed" // Unknown plant seed - these shouldn't exist in-game.
w_class = WEIGHT_CLASS_TINY
resistance_flags = FLAMMABLE
var/plantname = "Plants" // Name of plant when planted.
var/obj/item/product // A type path. The thing that is created when the plant is harvested.
var/productdesc
var/species = "" // Used to update icons. Should match the name in the sprites unless all icon_* are overridden.
var/growing_icon = 'icons/obj/hydroponics/growing.dmi' //the file that stores the sprites of the growing plant from this seed.
var/icon_grow // Used to override grow icon (default is "[species]-grow"). You can use one grow icon for multiple closely related plants with it.
var/icon_dead // Used to override dead icon (default is "[species]-dead"). You can use one dead icon for multiple closely related plants with it.
var/icon_harvest // Used to override harvest icon (default is "[species]-harvest"). If null, plant will use [icon_grow][growthstages].
var/lifespan = 25 // How long before the plant begins to take damage from age.
var/endurance = 15 // Amount of health the plant has.
var/maturation = 6 // Used to determine which sprite to switch to when growing.
var/production = 6 // Changes the amount of time needed for a plant to become harvestable.
var/yield = 3 // Amount of growns created per harvest. If is -1, the plant/shroom/weed is never meant to be harvested.
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/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/forbiddengenes = list()
var/list/reagents_add = list()
// A list of reagents to add to product.
// Format: "reagent_id" = potency multiplier
// Stronger reagents must always come first to avoid being displaced by weaker ones.
// Total amount of any reagent in plant is calculated by formula: 1 + round(potency * multiplier)
var/weed_rate = 1 //If the chance below passes, then this many weeds sprout during growth
var/weed_chance = 5 //Percentage chance per tray update to grow weeds
/obj/item/seeds/Initialize(loc, nogenes = 0)
. = ..()
pixel_x = rand(-8, 8)
pixel_y = rand(-8, 8)
if(!icon_grow)
icon_grow = "[species]-grow"
if(!icon_dead)
icon_dead = "[species]-dead"
if(!icon_harvest && !get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism) && yield != -1)
icon_harvest = "[species]-harvest"
if(!nogenes) // not used on Copy()
genes += new /datum/plant_gene/core/lifespan(lifespan)
genes += new /datum/plant_gene/core/endurance(endurance)
genes += new /datum/plant_gene/core/weed_rate(weed_rate)
genes += new /datum/plant_gene/core/weed_chance(weed_chance)
if(yield != -1)
genes += new /datum/plant_gene/core/yield(yield)
genes += new /datum/plant_gene/core/production(production)
if(potency != -1)
genes += new /datum/plant_gene/core/potency(potency)
for(var/p in genes)
if(ispath(p))
genes -= p
genes += new p
for(var/reag_id in reagents_add)
genes += new /datum/plant_gene/reagent(reag_id, reagents_add[reag_id])
reagents_from_genes() //quality coding
/obj/item/seeds/examine(mob/user)
. = ..()
. += "<span class='notice'>Use a pen on it to rename it or change its description.</span>"
/obj/item/seeds/proc/Copy()
var/obj/item/seeds/S = new type(null, 1)
// Copy all the stats
S.lifespan = lifespan
S.endurance = endurance
S.maturation = maturation
S.production = production
S.yield = yield
S.potency = potency
S.weed_rate = weed_rate
S.weed_chance = weed_chance
S.name = name
S.plantname = plantname
S.desc = desc
S.productdesc = productdesc
S.genes = list()
for(var/g in genes)
var/datum/plant_gene/G = g
S.genes += G.Copy()
S.reagents_add = reagents_add.Copy() // Faster than grabbing the list from genes.
return S
obj/item/seeds/proc/is_gene_forbidden(typepath)
return (typepath in forbiddengenes)
/obj/item/seeds/proc/get_gene(typepath)
return (locate(typepath) in genes)
/obj/item/seeds/proc/reagents_from_genes()
reagents_add = list()
for(var/datum/plant_gene/reagent/R in genes)
reagents_add[R.reagent_id] = R.rate
///This proc adds a mutability_flag to a gene
/obj/item/seeds/proc/set_mutability(typepath, mutability)
var/datum/plant_gene/g = get_gene(typepath)
if(g)
g.mutability_flags |= mutability
///This proc removes a mutability_flag from a gene
/obj/item/seeds/proc/unset_mutability(typepath, mutability)
var/datum/plant_gene/g = get_gene(typepath)
if(g)
g.mutability_flags &= ~mutability
/obj/item/seeds/proc/mutate(lifemut = 2, endmut = 5, productmut = 1, yieldmut = 2, potmut = 25, wrmut = 2, wcmut = 5, traitmut = 0)
adjust_lifespan(rand(-lifemut,lifemut))
adjust_endurance(rand(-endmut,endmut))
adjust_production(rand(-productmut,productmut))
adjust_yield(rand(-yieldmut,yieldmut))
adjust_potency(rand(-potmut,potmut))
adjust_weed_rate(rand(-wrmut, wrmut))
adjust_weed_chance(rand(-wcmut, wcmut))
if(prob(traitmut))
add_random_traits(1, 1)
/obj/item/seeds/bullet_act(obj/item/projectile/Proj) //Works with the Somatoray to modify plant variables.
if(istype(Proj, /obj/item/projectile/energy/florayield))
var/rating = 1
if(istype(loc, /obj/machinery/hydroponics))
var/obj/machinery/hydroponics/H = loc
rating = H.rating
if(yield == 0)//Oh god don't divide by zero you'll doom us all.
adjust_yield(1 * rating)
else if(prob(1/(yield * yield) * 100))//This formula gives you diminishing returns based on yield. 100% with 1 yield, decreasing to 25%, 11%, 6, 4, 2...
adjust_yield(1 * rating)
else
return ..()
// Harvest procs
/obj/item/seeds/proc/getYield()
var/return_yield = yield
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)
return return_yield
/obj/item/seeds/proc/harvest(mob/user)
var/obj/machinery/hydroponics/parent = loc //for ease of access
var/t_amount = 0
var/list/result = list()
var/output_loc = parent.Adjacent(user) ? user.loc : parent.loc //needed for TK
var/product_name
while(t_amount < getYield())
var/obj/item/reagent_containers/food/snacks/grown/t_prod = new product(output_loc, src)
if(parent.myseed.plantname != initial(parent.myseed.plantname))
t_prod.name = lowertext(parent.myseed.plantname)
if(productdesc)
t_prod.desc = productdesc
t_prod.seed.name = parent.myseed.name
t_prod.seed.desc = parent.myseed.desc
t_prod.seed.plantname = parent.myseed.plantname
result.Add(t_prod) // User gets a consumable
if(!t_prod)
return
t_amount++
product_name = parent.myseed.plantname
if(getYield() >= 1)
SSblackbox.record_feedback("tally", "food_harvested", getYield(), product_name)
parent.update_tray(user)
return result
/obj/item/seeds/proc/prepare_result(var/obj/item/reagent_containers/food/snacks/grown/T)
if(!T.reagents)
CRASH("[T] has no reagents.")
for(var/rid in reagents_add)
var/amount = 1 + round(potency * reagents_add[rid], 1)
var/list/data = null
if(rid == "blood") // Hack to make blood in plants always O-
data = list("blood_type" = "O-")
if(rid == /datum/reagent/consumable/nutriment || rid == /datum/reagent/consumable/nutriment/vitamin)
// apple tastes of apple.
data = T.tastes
T.reagents.add_reagent(rid, amount, data)
/// Setters procs ///
/obj/item/seeds/proc/adjust_yield(adjustamt)
if(yield != -1) // Unharvestable shouldn't suddenly turn harvestable
yield = CLAMP(yield + adjustamt, 0, 10)
if(yield <= 0 && get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism))
yield = 1 // Mushrooms always have a minimum yield of 1.
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/yield)
if(C)
C.value = yield
/obj/item/seeds/proc/adjust_lifespan(adjustamt)
lifespan = CLAMP(lifespan + adjustamt, 10, 100)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/lifespan)
if(C)
C.value = lifespan
/obj/item/seeds/proc/adjust_endurance(adjustamt)
endurance = CLAMP(endurance + adjustamt, 10, 100)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/endurance)
if(C)
C.value = endurance
/obj/item/seeds/proc/adjust_production(adjustamt)
if(yield != -1)
production = CLAMP(production + adjustamt, 1, 10)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/production)
if(C)
C.value = production
/obj/item/seeds/proc/adjust_potency(adjustamt)
if(potency != -1)
potency = CLAMP(potency + adjustamt, 0, 100)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/potency)
if(C)
C.value = potency
/obj/item/seeds/proc/adjust_weed_rate(adjustamt)
weed_rate = CLAMP(weed_rate + adjustamt, 0, 10)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_rate)
if(C)
C.value = weed_rate
/obj/item/seeds/proc/adjust_weed_chance(adjustamt)
weed_chance = CLAMP(weed_chance + adjustamt, 0, 67)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_chance)
if(C)
C.value = weed_chance
//Directly setting stats
/obj/item/seeds/proc/set_yield(adjustamt)
if(yield != -1) // Unharvestable shouldn't suddenly turn harvestable
yield = CLAMP(adjustamt, 0, 10)
if(yield <= 0 && get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism))
yield = 1 // Mushrooms always have a minimum yield of 1.
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/yield)
if(C)
C.value = yield
/obj/item/seeds/proc/set_lifespan(adjustamt)
lifespan = CLAMP(adjustamt, 10, 100)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/lifespan)
if(C)
C.value = lifespan
/obj/item/seeds/proc/set_endurance(adjustamt)
endurance = CLAMP(adjustamt, 10, 100)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/endurance)
if(C)
C.value = endurance
/obj/item/seeds/proc/set_production(adjustamt)
if(yield != -1)
production = CLAMP(adjustamt, 1, 10)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/production)
if(C)
C.value = production
/obj/item/seeds/proc/set_potency(adjustamt)
if(potency != -1)
potency = CLAMP(adjustamt, 0, 100)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/potency)
if(C)
C.value = potency
/obj/item/seeds/proc/set_weed_rate(adjustamt)
weed_rate = CLAMP(adjustamt, 0, 10)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_rate)
if(C)
C.value = weed_rate
/obj/item/seeds/proc/set_weed_chance(adjustamt)
weed_chance = CLAMP(adjustamt, 0, 67)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_chance)
if(C)
C.value = weed_chance
/obj/item/seeds/proc/get_analyzer_text() //in case seeds have something special to tell to the analyzer
var/text = ""
if(!get_gene(/datum/plant_gene/trait/plant_type/weed_hardy) && !get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism) && !get_gene(/datum/plant_gene/trait/plant_type/alien_properties))
text += "- Plant type: Normal plant\n"
if(get_gene(/datum/plant_gene/trait/plant_type/weed_hardy))
text += "- Plant type: Weed. Can grow in nutrient-poor soil.\n"
if(get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism))
text += "- Plant type: Mushroom. Can grow in dry soil.\n"
if(get_gene(/datum/plant_gene/trait/plant_type/alien_properties))
text += "- Plant type: <span class='warning'>UNKNOWN</span> \n"
if(potency != -1)
text += "- Potency: [potency]\n"
if(yield != -1)
text += "- Yield: [yield]\n"
text += "- Maturation speed: [maturation]\n"
if(yield != -1)
text += "- Production speed: [production]\n"
text += "- Endurance: [endurance]\n"
text += "- Lifespan: [lifespan]\n"
text += "- Weed Growth Rate: [weed_rate]\n"
text += "- Weed Vulnerability: [weed_chance]\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()]"
text += "- Plant Traits:[all_traits]\n"
text += "*---------*"
return text
/obj/item/seeds/proc/on_chem_reaction(datum/reagents/S) //in case seeds have some special interaction with special chems
return
/obj/item/seeds/attackby(obj/item/O, mob/user, params)
if (istype(O, /obj/item/plant_analyzer))
to_chat(user, "<span class='info'>*---------*\n This is \a <span class='name'>[src]</span>.</span>")
var/text = get_analyzer_text()
if(text)
to_chat(user, "<span class='notice'>[text]</span>")
return
if(istype(O, /obj/item/pen))
var/choice = input("What would you like to change?") in list("Plant Name", "Seed Description", "Product Description", "Cancel")
if(!user.canUseTopic(src, BE_CLOSE))
return
switch(choice)
if("Plant Name")
var/newplantname = reject_bad_text(stripped_input(user, "Write a new plant name:", name, plantname))
if(!user.canUseTopic(src, BE_CLOSE))
return
if (length(newplantname) > 20)
to_chat(user, "That name is too long!")
return
if(!newplantname)
to_chat(user, "That name is invalid.")
return
else
name = "[lowertext(newplantname)]"
plantname = newplantname
if("Seed Description")
var/newdesc = stripped_input(user, "Write a new description:", name, desc)
if(!user.canUseTopic(src, BE_CLOSE))
return
if (length(newdesc) > 180)
to_chat(user, "That description is too long!")
return
if(!newdesc)
to_chat(user, "That description is invalid.")
return
else
desc = newdesc
if("Product Description")
if(product && !productdesc)
productdesc = initial(product.desc)
var/newproductdesc = stripped_input(user, "Write a new description:", name, productdesc)
if(!user.canUseTopic(src, BE_CLOSE))
return
if (length(newproductdesc) > 180)
to_chat(user, "That description is too long!")
return
if(!newproductdesc)
to_chat(user, "That description is invalid.")
return
else
productdesc = newproductdesc
else
return
..() // Fallthrough to item/attackby() so that bags can pick seeds up
// Checks plants for broken tray icons. Use Advanced Proc Call to activate.
// Maybe some day it would be used as unit test.
/proc/check_plants_growth_stages_icons()
var/list/states = icon_states('icons/obj/hydroponics/growing.dmi')
states |= icon_states('icons/obj/hydroponics/growing_fruits.dmi')
states |= icon_states('icons/obj/hydroponics/growing_flowers.dmi')
states |= icon_states('icons/obj/hydroponics/growing_mushrooms.dmi')
states |= icon_states('icons/obj/hydroponics/growing_vegetables.dmi')
var/list/paths = typesof(/obj/item/seeds) - /obj/item/seeds - typesof(/obj/item/seeds/sample)
for(var/seedpath in paths)
var/obj/item/seeds/seed = new seedpath
for(var/i in 1 to seed.growthstages)
if("[seed.icon_grow][i]" in states)
continue
to_chat(world, "[seed.name] ([seed.type]) lacks the [seed.icon_grow][i] icon!")
if(!(seed.icon_dead in states))
to_chat(world, "[seed.name] ([seed.type]) lacks the [seed.icon_dead] icon!")
if(seed.icon_harvest) // mushrooms have no grown sprites, same for items with no product
if(!(seed.icon_harvest in states))
to_chat(world, "[seed.name] ([seed.type]) lacks the [seed.icon_harvest] icon!")
/obj/item/seeds/proc/randomize_stats()
set_lifespan(rand(25, 60))
set_endurance(rand(15, 35))
set_production(rand(2, 10))
set_yield(rand(1, 10))
set_potency(rand(10, 35))
set_weed_rate(rand(1, 10))
set_weed_chance(rand(5, 100))
maturation = rand(6, 12)
/obj/item/seeds/proc/add_random_reagents(lower = 0, upper = 2)
var/amount_random_reagents = rand(lower, upper)
for(var/i in 1 to amount_random_reagents)
var/random_amount = rand(4, 15) * 0.01 // this must be multiplied by 0.01, otherwise, it will not properly associate
var/datum/plant_gene/reagent/R = new(get_random_reagent_id(), random_amount)
if(R.can_add(src))
genes += R
else
qdel(R)
reagents_from_genes()
/obj/item/seeds/proc/add_random_traits(lower = 0, upper = 2)
var/amount_random_traits = rand(lower, upper)
for(var/i in 1 to amount_random_traits)
var/random_trait = pick((subtypesof(/datum/plant_gene/trait)-typesof(/datum/plant_gene/trait/plant_type)))
var/datum/plant_gene/trait/T = new random_trait
if(T.can_add(src) && !is_gene_forbidden(random_trait))
genes += T
else
qdel(T)
/obj/item/seeds/proc/add_random_plant_type(normal_plant_chance = 75)
if(prob(normal_plant_chance))
var/random_plant_type = pick(subtypesof(/datum/plant_gene/trait/plant_type))
var/datum/plant_gene/trait/plant_type/P = new random_plant_type
if(P.can_add(src))
genes += P
else
qdel(P)
// ********************************************************
// Here's all the seeds (plants) that can be used in hydro
// ********************************************************
/obj/item/seeds
icon = 'icons/obj/hydroponics/seeds.dmi'
icon_state = "seed" // Unknown plant seed - these shouldn't exist in-game.
w_class = WEIGHT_CLASS_TINY
resistance_flags = FLAMMABLE
var/plantname = "Plants" // Name of plant when planted.
var/obj/item/product // A type path. The thing that is created when the plant is harvested.
var/productdesc
var/species = "" // Used to update icons. Should match the name in the sprites unless all icon_* are overridden.
var/growing_icon = 'icons/obj/hydroponics/growing.dmi' //the file that stores the sprites of the growing plant from this seed.
var/icon_grow // Used to override grow icon (default is "[species]-grow"). You can use one grow icon for multiple closely related plants with it.
var/icon_dead // Used to override dead icon (default is "[species]-dead"). You can use one dead icon for multiple closely related plants with it.
var/icon_harvest // Used to override harvest icon (default is "[species]-harvest"). If null, plant will use [icon_grow][growthstages].
var/lifespan = 25 // How long before the plant begins to take damage from age.
var/endurance = 15 // Amount of health the plant has.
var/maturation = 6 // Used to determine which sprite to switch to when growing.
var/production = 6 // Changes the amount of time needed for a plant to become harvestable.
var/yield = 3 // Amount of growns created per harvest. If is -1, the plant/shroom/weed is never meant to be harvested.
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/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/forbiddengenes = list()
var/list/reagents_add = list()
// A list of reagents to add to product.
// Format: "reagent_id" = potency multiplier
// Stronger reagents must always come first to avoid being displaced by weaker ones.
// Total amount of any reagent in plant is calculated by formula: 1 + round(potency * multiplier)
var/weed_rate = 1 //If the chance below passes, then this many weeds sprout during growth
var/weed_chance = 5 //Percentage chance per tray update to grow weeds
/obj/item/seeds/Initialize(loc, nogenes = 0)
. = ..()
pixel_x = rand(-8, 8)
pixel_y = rand(-8, 8)
if(!icon_grow)
icon_grow = "[species]-grow"
if(!icon_dead)
icon_dead = "[species]-dead"
if(!icon_harvest && !get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism) && yield != -1)
icon_harvest = "[species]-harvest"
if(!nogenes) // not used on Copy()
genes += new /datum/plant_gene/core/lifespan(lifespan)
genes += new /datum/plant_gene/core/endurance(endurance)
genes += new /datum/plant_gene/core/weed_rate(weed_rate)
genes += new /datum/plant_gene/core/weed_chance(weed_chance)
if(yield != -1)
genes += new /datum/plant_gene/core/yield(yield)
genes += new /datum/plant_gene/core/production(production)
if(potency != -1)
genes += new /datum/plant_gene/core/potency(potency)
for(var/p in genes)
if(ispath(p))
genes -= p
genes += new p
for(var/reag_id in reagents_add)
genes += new /datum/plant_gene/reagent(reag_id, reagents_add[reag_id])
reagents_from_genes() //quality coding
/obj/item/seeds/examine(mob/user)
. = ..()
. += "<span class='notice'>Use a pen on it to rename it or change its description.</span>"
/obj/item/seeds/proc/Copy()
var/obj/item/seeds/S = new type(null, 1)
// Copy all the stats
S.lifespan = lifespan
S.endurance = endurance
S.maturation = maturation
S.production = production
S.yield = yield
S.potency = potency
S.weed_rate = weed_rate
S.weed_chance = weed_chance
S.name = name
S.plantname = plantname
S.desc = desc
S.productdesc = productdesc
S.genes = list()
for(var/g in genes)
var/datum/plant_gene/G = g
S.genes += G.Copy()
S.reagents_add = reagents_add.Copy() // Faster than grabbing the list from genes.
return S
obj/item/seeds/proc/is_gene_forbidden(typepath)
return (typepath in forbiddengenes)
/obj/item/seeds/proc/get_gene(typepath)
return (locate(typepath) in genes)
/obj/item/seeds/proc/reagents_from_genes()
reagents_add = list()
for(var/datum/plant_gene/reagent/R in genes)
reagents_add[R.reagent_id] = R.rate
///This proc adds a mutability_flag to a gene
/obj/item/seeds/proc/set_mutability(typepath, mutability)
var/datum/plant_gene/g = get_gene(typepath)
if(g)
g.mutability_flags |= mutability
///This proc removes a mutability_flag from a gene
/obj/item/seeds/proc/unset_mutability(typepath, mutability)
var/datum/plant_gene/g = get_gene(typepath)
if(g)
g.mutability_flags &= ~mutability
/obj/item/seeds/proc/mutate(lifemut = 2, endmut = 5, productmut = 1, yieldmut = 2, potmut = 25, wrmut = 2, wcmut = 5, traitmut = 0)
adjust_lifespan(rand(-lifemut,lifemut))
adjust_endurance(rand(-endmut,endmut))
adjust_production(rand(-productmut,productmut))
adjust_yield(rand(-yieldmut,yieldmut))
adjust_potency(rand(-potmut,potmut))
adjust_weed_rate(rand(-wrmut, wrmut))
adjust_weed_chance(rand(-wcmut, wcmut))
if(prob(traitmut))
add_random_traits(1, 1)
/obj/item/seeds/bullet_act(obj/item/projectile/Proj) //Works with the Somatoray to modify plant variables.
if(istype(Proj, /obj/item/projectile/energy/florayield))
var/rating = 1
if(istype(loc, /obj/machinery/hydroponics))
var/obj/machinery/hydroponics/H = loc
rating = H.rating
if(yield == 0)//Oh god don't divide by zero you'll doom us all.
adjust_yield(1 * rating)
else if(prob(1/(yield * yield) * 100))//This formula gives you diminishing returns based on yield. 100% with 1 yield, decreasing to 25%, 11%, 6, 4, 2...
adjust_yield(1 * rating)
else
return ..()
// Harvest procs
/obj/item/seeds/proc/getYield()
var/return_yield = yield
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)
return return_yield
/obj/item/seeds/proc/harvest(mob/user)
var/obj/machinery/hydroponics/parent = loc //for ease of access
var/t_amount = 0
var/list/result = list()
var/output_loc = parent.Adjacent(user) ? user.loc : parent.loc //needed for TK
var/product_name
while(t_amount < getYield())
var/obj/item/reagent_containers/food/snacks/grown/t_prod = new product(output_loc, src)
if(parent.myseed.plantname != initial(parent.myseed.plantname))
t_prod.name = lowertext(parent.myseed.plantname)
if(productdesc)
t_prod.desc = productdesc
t_prod.seed.name = parent.myseed.name
t_prod.seed.desc = parent.myseed.desc
t_prod.seed.plantname = parent.myseed.plantname
result.Add(t_prod) // User gets a consumable
if(!t_prod)
return
t_amount++
product_name = parent.myseed.plantname
if(getYield() >= 1)
SSblackbox.record_feedback("tally", "food_harvested", getYield(), product_name)
parent.update_tray(user)
return result
/obj/item/seeds/proc/prepare_result(var/obj/item/reagent_containers/food/snacks/grown/T)
if(!T.reagents)
CRASH("[T] has no reagents.")
for(var/rid in reagents_add)
var/amount = 1 + round(potency * reagents_add[rid], 1)
var/list/data = null
if(rid == "blood") // Hack to make blood in plants always O-
data = list("blood_type" = "O-")
if(rid == /datum/reagent/consumable/nutriment || rid == /datum/reagent/consumable/nutriment/vitamin)
// apple tastes of apple.
data = T.tastes
T.reagents.add_reagent(rid, amount, data)
/// Setters procs ///
/obj/item/seeds/proc/adjust_yield(adjustamt)
if(yield != -1) // Unharvestable shouldn't suddenly turn harvestable
yield = CLAMP(yield + adjustamt, 0, 10)
if(yield <= 0 && get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism))
yield = 1 // Mushrooms always have a minimum yield of 1.
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/yield)
if(C)
C.value = yield
/obj/item/seeds/proc/adjust_lifespan(adjustamt)
lifespan = CLAMP(lifespan + adjustamt, 10, 100)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/lifespan)
if(C)
C.value = lifespan
/obj/item/seeds/proc/adjust_endurance(adjustamt)
endurance = CLAMP(endurance + adjustamt, 10, 100)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/endurance)
if(C)
C.value = endurance
/obj/item/seeds/proc/adjust_production(adjustamt)
if(yield != -1)
production = CLAMP(production + adjustamt, 1, 10)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/production)
if(C)
C.value = production
/obj/item/seeds/proc/adjust_potency(adjustamt)
if(potency != -1)
potency = CLAMP(potency + adjustamt, 0, 100)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/potency)
if(C)
C.value = potency
/obj/item/seeds/proc/adjust_weed_rate(adjustamt)
weed_rate = CLAMP(weed_rate + adjustamt, 0, 10)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_rate)
if(C)
C.value = weed_rate
/obj/item/seeds/proc/adjust_weed_chance(adjustamt)
weed_chance = CLAMP(weed_chance + adjustamt, 0, 67)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_chance)
if(C)
C.value = weed_chance
//Directly setting stats
/obj/item/seeds/proc/set_yield(adjustamt)
if(yield != -1) // Unharvestable shouldn't suddenly turn harvestable
yield = CLAMP(adjustamt, 0, 10)
if(yield <= 0 && get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism))
yield = 1 // Mushrooms always have a minimum yield of 1.
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/yield)
if(C)
C.value = yield
/obj/item/seeds/proc/set_lifespan(adjustamt)
lifespan = CLAMP(adjustamt, 10, 100)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/lifespan)
if(C)
C.value = lifespan
/obj/item/seeds/proc/set_endurance(adjustamt)
endurance = CLAMP(adjustamt, 10, 100)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/endurance)
if(C)
C.value = endurance
/obj/item/seeds/proc/set_production(adjustamt)
if(yield != -1)
production = CLAMP(adjustamt, 1, 10)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/production)
if(C)
C.value = production
/obj/item/seeds/proc/set_potency(adjustamt)
if(potency != -1)
potency = CLAMP(adjustamt, 0, 100)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/potency)
if(C)
C.value = potency
/obj/item/seeds/proc/set_weed_rate(adjustamt)
weed_rate = CLAMP(adjustamt, 0, 10)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_rate)
if(C)
C.value = weed_rate
/obj/item/seeds/proc/set_weed_chance(adjustamt)
weed_chance = CLAMP(adjustamt, 0, 67)
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_chance)
if(C)
C.value = weed_chance
/obj/item/seeds/proc/get_analyzer_text() //in case seeds have something special to tell to the analyzer
var/text = ""
if(!get_gene(/datum/plant_gene/trait/plant_type/weed_hardy) && !get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism) && !get_gene(/datum/plant_gene/trait/plant_type/alien_properties))
text += "- Plant type: Normal plant\n"
if(get_gene(/datum/plant_gene/trait/plant_type/weed_hardy))
text += "- Plant type: Weed. Can grow in nutrient-poor soil.\n"
if(get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism))
text += "- Plant type: Mushroom. Can grow in dry soil.\n"
if(get_gene(/datum/plant_gene/trait/plant_type/alien_properties))
text += "- Plant type: <span class='warning'>UNKNOWN</span> \n"
if(potency != -1)
text += "- Potency: [potency]\n"
if(yield != -1)
text += "- Yield: [yield]\n"
text += "- Maturation speed: [maturation]\n"
if(yield != -1)
text += "- Production speed: [production]\n"
text += "- Endurance: [endurance]\n"
text += "- Lifespan: [lifespan]\n"
text += "- Weed Growth Rate: [weed_rate]\n"
text += "- Weed Vulnerability: [weed_chance]\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()]"
text += "- Plant Traits:[all_traits]\n"
text += "*---------*"
return text
/obj/item/seeds/proc/on_chem_reaction(datum/reagents/S) //in case seeds have some special interaction with special chems
return
/obj/item/seeds/attackby(obj/item/O, mob/user, params)
if (istype(O, /obj/item/plant_analyzer))
to_chat(user, "<span class='info'>*---------*\n This is \a <span class='name'>[src]</span>.</span>")
var/text = get_analyzer_text()
if(text)
to_chat(user, "<span class='notice'>[text]</span>")
return
if(istype(O, /obj/item/pen))
var/choice = input("What would you like to change?") in list("Plant Name", "Seed Description", "Product Description", "Cancel")
if(!user.canUseTopic(src, BE_CLOSE))
return
switch(choice)
if("Plant Name")
var/newplantname = reject_bad_text(stripped_input(user, "Write a new plant name:", name, plantname))
if(!user.canUseTopic(src, BE_CLOSE))
return
if (length(newplantname) > 20)
to_chat(user, "That name is too long!")
return
if(!newplantname)
to_chat(user, "That name is invalid.")
return
else
name = "[lowertext(newplantname)]"
plantname = newplantname
if("Seed Description")
var/newdesc = stripped_input(user, "Write a new description:", name, desc)
if(!user.canUseTopic(src, BE_CLOSE))
return
if (length(newdesc) > 180)
to_chat(user, "That description is too long!")
return
if(!newdesc)
to_chat(user, "That description is invalid.")
return
else
desc = newdesc
if("Product Description")
if(product && !productdesc)
productdesc = initial(product.desc)
var/newproductdesc = stripped_input(user, "Write a new description:", name, productdesc)
if(!user.canUseTopic(src, BE_CLOSE))
return
if (length(newproductdesc) > 180)
to_chat(user, "That description is too long!")
return
if(!newproductdesc)
to_chat(user, "That description is invalid.")
return
else
productdesc = newproductdesc
else
return
..() // Fallthrough to item/attackby() so that bags can pick seeds up
// Checks plants for broken tray icons. Use Advanced Proc Call to activate.
// Maybe some day it would be used as unit test.
/proc/check_plants_growth_stages_icons()
var/list/states = icon_states('icons/obj/hydroponics/growing.dmi')
states |= icon_states('icons/obj/hydroponics/growing_fruits.dmi')
states |= icon_states('icons/obj/hydroponics/growing_flowers.dmi')
states |= icon_states('icons/obj/hydroponics/growing_mushrooms.dmi')
states |= icon_states('icons/obj/hydroponics/growing_vegetables.dmi')
var/list/paths = typesof(/obj/item/seeds) - /obj/item/seeds - typesof(/obj/item/seeds/sample)
for(var/seedpath in paths)
var/obj/item/seeds/seed = new seedpath
for(var/i in 1 to seed.growthstages)
if("[seed.icon_grow][i]" in states)
continue
to_chat(world, "[seed.name] ([seed.type]) lacks the [seed.icon_grow][i] icon!")
if(!(seed.icon_dead in states))
to_chat(world, "[seed.name] ([seed.type]) lacks the [seed.icon_dead] icon!")
if(seed.icon_harvest) // mushrooms have no grown sprites, same for items with no product
if(!(seed.icon_harvest in states))
to_chat(world, "[seed.name] ([seed.type]) lacks the [seed.icon_harvest] icon!")
/obj/item/seeds/proc/randomize_stats()
set_lifespan(rand(25, 60))
set_endurance(rand(15, 35))
set_production(rand(2, 10))
set_yield(rand(1, 10))
set_potency(rand(10, 35))
set_weed_rate(rand(1, 10))
set_weed_chance(rand(5, 100))
maturation = rand(6, 12)
/obj/item/seeds/proc/add_random_reagents(lower = 0, upper = 2)
var/amount_random_reagents = rand(lower, upper)
for(var/i in 1 to amount_random_reagents)
var/random_amount = rand(4, 15) * 0.01 // this must be multiplied by 0.01, otherwise, it will not properly associate
var/datum/plant_gene/reagent/R = new(get_random_reagent_id(), random_amount)
if(R.can_add(src))
genes += R
else
qdel(R)
reagents_from_genes()
/obj/item/seeds/proc/add_random_traits(lower = 0, upper = 2)
var/amount_random_traits = rand(lower, upper)
for(var/i in 1 to amount_random_traits)
var/random_trait = pick((subtypesof(/datum/plant_gene/trait)-typesof(/datum/plant_gene/trait/plant_type)))
var/datum/plant_gene/trait/T = new random_trait
if(T.can_add(src) && !is_gene_forbidden(random_trait))
genes += T
else
qdel(T)
/obj/item/seeds/proc/add_random_plant_type(normal_plant_chance = 75)
if(prob(normal_plant_chance))
var/random_plant_type = pick(subtypesof(/datum/plant_gene/trait/plant_type))
var/datum/plant_gene/trait/plant_type/P = new random_plant_type
if(P.can_add(src))
genes += P
else
qdel(P)