July 5th TG sync (#1883)

July 5th TG sync
This commit is contained in:
Poojawa
2017-07-05 22:14:19 -05:00
committed by GitHub
parent 454b9c3d68
commit b1b4826c0c
1264 changed files with 149689 additions and 570309 deletions
+335 -335
View File
@@ -1,337 +1,337 @@
/obj/machinery/biogenerator
/obj/machinery/biogenerator
name = "biogenerator"
desc = "Converts plants into biomass, which can be used to construct useful items."
icon = 'icons/obj/biogenerator.dmi'
icon_state = "biogen-empty"
density = 1
anchored = 1
desc = "Converts plants into biomass, which can be used to construct useful items."
icon = 'icons/obj/biogenerator.dmi'
icon_state = "biogen-empty"
density = 1
anchored = 1
use_power = IDLE_POWER_USE
idle_power_usage = 40
var/processing = 0
var/obj/item/weapon/reagent_containers/glass/beaker = null
var/points = 0
var/menustat = "menu"
var/efficiency = 0
var/productivity = 0
var/max_items = 40
var/datum/research/files
var/list/show_categories = list("Food", "Botany Chemicals", "Leather and Cloth")
var/list/timesFiveCategories = list("Food", "Botany Chemicals")
/obj/machinery/biogenerator/New()
..()
files = new /datum/research/biogenerator(src)
create_reagents(1000)
var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/biogenerator(null)
B.apply_default_parts(src)
/obj/machinery/biogenerator/Destroy()
if(beaker)
qdel(beaker)
beaker = null
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/item/weapon/circuitboard/machine/biogenerator
name = "Biogenerator (Machine Board)"
build_path = /obj/machinery/biogenerator
origin_tech = "programming=2;biotech=3;materials=3"
req_components = list(
/obj/item/weapon/stock_parts/matter_bin = 1,
/obj/item/weapon/stock_parts/manipulator = 1,
/obj/item/stack/cable_coil = 1,
/obj/item/weapon/stock_parts/console_screen = 1)
/obj/machinery/biogenerator/RefreshParts()
var/E = 0
var/P = 0
var/max_storage = 40
for(var/obj/item/weapon/stock_parts/matter_bin/B in component_parts)
P += B.rating
max_storage = 40 * B.rating
for(var/obj/item/weapon/stock_parts/manipulator/M in component_parts)
E += M.rating
efficiency = E
productivity = P
max_items = max_storage
/obj/machinery/biogenerator/on_reagent_change() //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/weapon/reagent_containers/glass/B = beaker
B.loc = loc
beaker = null
update_icon()
return
if(exchange_parts(user, O))
return
if(default_deconstruction_crowbar(O))
return
if(istype(O, /obj/item/weapon/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.drop_item())
return
O.loc = src
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/weapon/storage/bag/plants))
var/obj/item/weapon/storage/bag/plants/PB = O
var/i = 0
for(var/obj/item/weapon/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/weapon/reagent_containers/food/snacks/grown/G in PB.contents)
if(i >= max_items)
break
PB.remove_from_storage(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 1 //no afterattack
else if(istype(O, /obj/item/weapon/reagent_containers/food/snacks/grown))
var/i = 0
for(var/obj/item/weapon/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 1 //no afterattack
else if (istype(O, /obj/item/weapon/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 = 1
var/obj/item/weapon/disk/design_disk/D = O
if(do_after(user, 10, target = src))
for(var/B in D.blueprints)
if(B)
files.AddDesign2Known(B)
processing = 0
return 1
else
to_chat(user, "<span class='warning'>You cannot put this in [src.name]!</span>")
/obj/machinery/biogenerator/interact(mob/user)
if(stat & BROKEN || panel_open)
return
user.set_machine(src)
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 files.known_designs)
var/datum/design/D = files.known_designs[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=\ref[D];amount=1'>Make</A>"
if(cat in timesFiveCategories)
dat += "<A href='?src=\ref[src];create=\ref[D];amount=5'>x5</A>"
if(ispath(D.build_path, /obj/item/stack))
dat += "<A href='?src=\ref[src];create=\ref[D];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()
return
/obj/machinery/biogenerator/attack_hand(mob/user)
interact(user)
/obj/machinery/biogenerator/proc/activate()
if (usr.stat != 0)
return
if (src.stat != 0) //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/weapon/reagent_containers/food/snacks/grown/I in contents)
S += 5
if(I.reagents.get_reagent_amount("nutriment") < 0.1)
points += 1*productivity
else points += I.reagents.get_reagent_amount("nutriment")*10*productivity
qdel(I)
if(S)
processing = 1
update_icon()
updateUsrDialog()
playsound(src.loc, 'sound/machines/blender.ogg', 50, 1)
use_power(S*30)
sleep(S+15/productivity)
processing = 0
update_icon()
else
menustat = "void"
return
/obj/machinery/biogenerator/proc/check_cost(list/materials, multiplier = 1, remove_points = 1)
if(materials.len != 1 || materials[1] != MAT_BIOMASS)
return 0
if (materials[MAT_BIOMASS]*multiplier/efficiency > points)
menustat = "nopoints"
return 0
else
if(remove_points)
points -= materials[MAT_BIOMASS]*multiplier/efficiency
update_icon()
updateUsrDialog()
return 1
/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 0
return 1
/obj/machinery/biogenerator/proc/create_product(datum/design/D, amount)
if(!beaker || !loc)
return 0
if(ispath(D.build_path, /obj/item/stack))
if(!check_container_volume(D.make_reagents, amount))
return 0
if(!check_cost(D.materials, amount))
return 0
var/obj/item/stack/product = new D.build_path(loc)
product.amount = 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.loc = src.loc
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"]))
var/datum/design/D = locate(href_list["create"])
create_product(D, amount)
updateUsrDialog()
else if(href_list["menu"])
menustat = "menu"
updateUsrDialog()
idle_power_usage = 40
var/processing = 0
var/obj/item/weapon/reagent_containers/glass/beaker = null
var/points = 0
var/menustat = "menu"
var/efficiency = 0
var/productivity = 0
var/max_items = 40
var/datum/research/files
var/list/show_categories = list("Food", "Botany Chemicals", "Leather and Cloth")
var/list/timesFiveCategories = list("Food", "Botany Chemicals")
/obj/machinery/biogenerator/New()
..()
files = new /datum/research/biogenerator(src)
create_reagents(1000)
var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/biogenerator(null)
B.apply_default_parts(src)
/obj/machinery/biogenerator/Destroy()
if(beaker)
qdel(beaker)
beaker = null
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/item/weapon/circuitboard/machine/biogenerator
name = "Biogenerator (Machine Board)"
build_path = /obj/machinery/biogenerator
origin_tech = "programming=2;biotech=3;materials=3"
req_components = list(
/obj/item/weapon/stock_parts/matter_bin = 1,
/obj/item/weapon/stock_parts/manipulator = 1,
/obj/item/stack/cable_coil = 1,
/obj/item/weapon/stock_parts/console_screen = 1)
/obj/machinery/biogenerator/RefreshParts()
var/E = 0
var/P = 0
var/max_storage = 40
for(var/obj/item/weapon/stock_parts/matter_bin/B in component_parts)
P += B.rating
max_storage = 40 * B.rating
for(var/obj/item/weapon/stock_parts/manipulator/M in component_parts)
E += M.rating
efficiency = E
productivity = P
max_items = max_storage
/obj/machinery/biogenerator/on_reagent_change() //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/weapon/reagent_containers/glass/B = beaker
B.loc = loc
beaker = null
update_icon()
return
if(exchange_parts(user, O))
return
if(default_deconstruction_crowbar(O))
return
if(istype(O, /obj/item/weapon/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.drop_item())
return
O.loc = src
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/weapon/storage/bag/plants))
var/obj/item/weapon/storage/bag/plants/PB = O
var/i = 0
for(var/obj/item/weapon/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/weapon/reagent_containers/food/snacks/grown/G in PB.contents)
if(i >= max_items)
break
PB.remove_from_storage(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 1 //no afterattack
else if(istype(O, /obj/item/weapon/reagent_containers/food/snacks/grown))
var/i = 0
for(var/obj/item/weapon/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 1 //no afterattack
else if (istype(O, /obj/item/weapon/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 = 1
var/obj/item/weapon/disk/design_disk/D = O
if(do_after(user, 10, target = src))
for(var/B in D.blueprints)
if(B)
files.AddDesign2Known(B)
processing = 0
return 1
else
to_chat(user, "<span class='warning'>You cannot put this in [src.name]!</span>")
/obj/machinery/biogenerator/interact(mob/user)
if(stat & BROKEN || panel_open)
return
user.set_machine(src)
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 files.known_designs)
var/datum/design/D = files.known_designs[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=\ref[D];amount=1'>Make</A>"
if(cat in timesFiveCategories)
dat += "<A href='?src=\ref[src];create=\ref[D];amount=5'>x5</A>"
if(ispath(D.build_path, /obj/item/stack))
dat += "<A href='?src=\ref[src];create=\ref[D];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()
return
/obj/machinery/biogenerator/attack_hand(mob/user)
interact(user)
/obj/machinery/biogenerator/proc/activate()
if (usr.stat != 0)
return
if (src.stat != 0) //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/weapon/reagent_containers/food/snacks/grown/I in contents)
S += 5
if(I.reagents.get_reagent_amount("nutriment") < 0.1)
points += 1*productivity
else points += I.reagents.get_reagent_amount("nutriment")*10*productivity
qdel(I)
if(S)
processing = 1
update_icon()
updateUsrDialog()
playsound(src.loc, 'sound/machines/blender.ogg', 50, 1)
use_power(S*30)
sleep(S+15/productivity)
processing = 0
update_icon()
else
menustat = "void"
return
/obj/machinery/biogenerator/proc/check_cost(list/materials, multiplier = 1, remove_points = 1)
if(materials.len != 1 || materials[1] != MAT_BIOMASS)
return 0
if (materials[MAT_BIOMASS]*multiplier/efficiency > points)
menustat = "nopoints"
return 0
else
if(remove_points)
points -= materials[MAT_BIOMASS]*multiplier/efficiency
update_icon()
updateUsrDialog()
return 1
/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 0
return 1
/obj/machinery/biogenerator/proc/create_product(datum/design/D, amount)
if(!beaker || !loc)
return 0
if(ispath(D.build_path, /obj/item/stack))
if(!check_container_volume(D.make_reagents, amount))
return 0
if(!check_cost(D.materials, amount))
return 0
var/obj/item/stack/product = new D.build_path(loc)
product.amount = 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.loc = src.loc
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"]))
var/datum/design/D = locate(href_list["create"])
create_product(D, amount)
updateUsrDialog()
else if(href_list["menu"])
menustat = "menu"
updateUsrDialog()
+1
View File
@@ -368,6 +368,7 @@
seed.genes += disk.gene.Copy()
if(istype(disk.gene, /datum/plant_gene/reagent))
seed.reagents_from_genes()
disk.gene.apply_vars(seed)
repaint_seed()
+147 -147
View File
@@ -1,148 +1,148 @@
// ***********************************************************
// 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/weapon/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
origin_tech = "biotech=1"
/obj/item/weapon/reagent_containers/food/snacks/grown/New(newloc, var/obj/item/seeds/new_seed = null)
tastes = list(name = 1) // apples taste of apple, silly.
..()
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, newloc)
seed.prepare_result(src)
transform *= TransformUsingVariable(seed.potency, 100, 0.5) //Makes the resulting produce's sprite larger or smaller based on potency!
add_juice()
/obj/item/weapon/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/weapon/reagent_containers/food/snacks/grown/examine(user)
..()
if(seed)
for(var/datum/plant_gene/trait/T in seed.genes)
if(T.examine_line)
to_chat(user, T.examine_line)
/obj/item/weapon/reagent_containers/food/snacks/grown/attackby(obj/item/O, mob/user, params)
..()
if (istype(O, /obj/item/device/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/weapon/reagent_containers/food/snacks/grown/attack_self(mob/user)
if(seed && seed.get_gene(/datum/plant_gene/trait/squash))
squash(user)
..()
/obj/item/weapon/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/weapon/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)
// ***********************************************************
// 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/weapon/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
origin_tech = "biotech=1"
/obj/item/weapon/reagent_containers/food/snacks/grown/New(newloc, var/obj/item/seeds/new_seed = null)
tastes = list(name = 1) // apples taste of apple, silly.
..()
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, newloc)
seed.prepare_result(src)
transform *= TransformUsingVariable(seed.potency, 100, 0.5) //Makes the resulting produce's sprite larger or smaller based on potency!
add_juice()
/obj/item/weapon/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/weapon/reagent_containers/food/snacks/grown/examine(user)
..()
if(seed)
for(var/datum/plant_gene/trait/T in seed.genes)
if(T.examine_line)
to_chat(user, T.examine_line)
/obj/item/weapon/reagent_containers/food/snacks/grown/attackby(obj/item/O, mob/user, params)
..()
if (istype(O, /obj/item/device/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/weapon/reagent_containers/food/snacks/grown/attack_self(mob/user)
if(seed && seed.get_gene(/datum/plant_gene/trait/squash))
squash(user)
..()
/obj/item/weapon/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/weapon/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/weapon/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/weapon/reagent_containers/food/snacks/grown/Crossed(atom/movable/AM)
if(seed)
for(var/datum/plant_gene/trait/T in seed.genes)
T.on_cross(src, AM)
..()
/obj/item/weapon/reagent_containers/food/snacks/grown/generate_trash(atom/location)
if(trash && ispath(trash, /obj/item/weapon/grown))
. = new trash(location, seed)
trash = null
return
return ..()
// For item-containing growns such as eggy or gatfruit
/obj/item/weapon/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>")
for(var/A in T)
reagents.reaction(A)
qdel(src)
/obj/item/weapon/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/weapon/reagent_containers/food/snacks/grown/Crossed(atom/movable/AM)
if(seed)
for(var/datum/plant_gene/trait/T in seed.genes)
T.on_cross(src, AM)
..()
/obj/item/weapon/reagent_containers/food/snacks/grown/generate_trash(atom/location)
if(trash && ispath(trash, /obj/item/weapon/grown))
. = new trash(location, seed)
trash = null
return
return ..()
// For item-containing growns such as eggy or gatfruit
/obj/item/weapon/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>")
+1 -1
View File
@@ -117,5 +117,5 @@
/obj/item/weapon/grown/bananapeel/specialpeel/Crossed(AM)
if(iscarbon(AM))
var/mob/living/carbon/carbon = AM
if(carbon.slip(2, 2, src, FALSE))
if(carbon.slip(40, src, FALSE))
qdel(src)
+1 -1
View File
@@ -78,7 +78,7 @@
/obj/item/weapon/reagent_containers/food/snacks/grown/ghost_chili/attack_hand(mob/user)
..()
if( istype(src.loc, /mob) )
if( ismob(src.loc) )
held_mob = src.loc
START_PROCESSING(SSobj, src)
+12
View File
@@ -154,3 +154,15 @@
playsound(src, 'sound/effects/fuse.ogg', seed.potency, 0)
reagents.chem_temp = 1000 //Sets off the black powder
reagents.handle_reactions()
// Lavaland cactus
/obj/item/seeds/lavaland/cactus
name = "pack of fruiting cactus seeds"
desc = "These seeds grow into fruiting cacti."
icon_state = "seed-cactus"
species = "cactus"
plantname = "Fruiting Cactus"
product = /obj/item/weapon/reagent_containers/food/snacks/grown/ash_flora/cactus_fruit
growing_icon = 'icons/obj/hydroponics/growing_fruits.dmi'
growthstages = 2
@@ -308,3 +308,66 @@
if(.)
investigate_log("was planted by [key_name(user)] at [COORD(user)]", INVESTIGATE_BOTANY)
//// LAVALAND MUSHROOMS ////
// Bracket (Shaving mushroom)
/obj/item/seeds/lavaland
name = "lavaland seeds"
desc = "You should never see this."
lifespan = 50
endurance = 25
maturation = 7
production = 4
yield = 4
potency = 15
growthstages = 3
rarity = 20
reagents_add = list("nutriment" = 0.1)
resistance_flags = FIRE_PROOF
/obj/item/seeds/lavaland/polypore
name = "pack of polypore mycelium"
desc = "This mycelium grows into bracket mushrooms, also known as polypores. Woody and firm, shaft miners often use them for makeshift crafts."
icon_state = "mycelium-polypore"
species = "polypore"
plantname = "Polypore Mushrooms"
product = /obj/item/weapon/reagent_containers/food/snacks/grown/ash_flora/shavings
genes = list(/datum/plant_gene/trait/plant_type/fungal_metabolism)
growing_icon = 'icons/obj/hydroponics/growing_mushrooms.dmi'
// Porcini (Leafy mushroom)
/obj/item/seeds/lavaland/porcini
name = "pack of porcini mycelium"
desc = "This mycelium grows into Boletus edulus, also known as porcini. Native to the late Earth, but discovered on Lavaland. Has culinary, medicinal and relaxant effects."
icon_state = "mycelium-porcini"
species = "porcini"
plantname = "Porcini Mushrooms"
product = /obj/item/weapon/reagent_containers/food/snacks/grown/ash_flora/mushroom_leaf
genes = list(/datum/plant_gene/trait/plant_type/fungal_metabolism)
growing_icon = 'icons/obj/hydroponics/growing_mushrooms.dmi'
// Inocybe (Mushroom caps)
/obj/item/seeds/lavaland/inocybe
name = "pack of inocybe mycelium"
desc = "This mycelium grows into an inocybe mushroom, a species of Lavaland origin with hallucinatory and toxic effects."
icon_state = "mycelium-inocybe"
species = "inocybe"
plantname = "Inocybe Mushrooms"
product = /obj/item/weapon/reagent_containers/food/snacks/grown/ash_flora/mushroom_cap
genes = list(/datum/plant_gene/trait/plant_type/fungal_metabolism)
growing_icon = 'icons/obj/hydroponics/growing_mushrooms.dmi'
// Embershroom (Mushroom stem)
/obj/item/seeds/lavaland/ember
name = "pack of embershroom mycelium"
desc = "This mycelium grows into embershrooms, a species of bioluminescent mushrooms native to Lavaland."
icon_state = "mycelium-ember"
species = "ember"
plantname = "Embershroom Mushrooms"
product = /obj/item/weapon/reagent_containers/food/snacks/grown/ash_flora/mushroom_stem
genes = list(/datum/plant_gene/trait/plant_type/fungal_metabolism, /datum/plant_gene/trait/glow)
growing_icon = 'icons/obj/hydroponics/growing_mushrooms.dmi'
+4 -4
View File
@@ -98,8 +98,8 @@
/obj/item/weapon/grown/nettle/death/pickup(mob/living/carbon/user)
if(..())
if(prob(50))
user.Paralyse(5)
to_chat(user, "<span class='userdanger'>You are stunned by the Deathnettle when you try picking it up!</span>")
user.Knockdown(100)
to_chat(user, "<span class='userdanger'>You are stunned by the Deathnettle as you try picking it up!</span>")
/obj/item/weapon/grown/nettle/death/attack(mob/living/carbon/M, mob/user)
if(!..())
@@ -110,6 +110,6 @@
M.adjust_blurriness(force/7)
if(prob(20))
M.Paralyse(force / 6)
M.Weaken(force / 15)
M.Unconscious(force / 0.3)
M.Knockdown(force / 0.75)
M.drop_item()
+18 -3
View File
@@ -50,6 +50,9 @@
/obj/item/weapon/reagent_containers/food/snacks/grown/ambrosia/deus,
/obj/item/weapon/reagent_containers/food/snacks/grown/wheat)
/obj/item/weapon/grown/log/Initialize()
. = ..()
accepted = typecacheof(accepted)
/obj/item/weapon/grown/log/attackby(obj/item/weapon/W, mob/user, params)
if(W.sharpness)
@@ -66,7 +69,7 @@
to_chat(user, "<span class='notice'>You add the newly-formed [plank_name] to the stack. It now contains [plank.amount] [plank_name].</span>")
qdel(src)
if(is_type_in_list(W,accepted))
if(is_type_in_typecache(W,accepted))
var/obj/item/weapon/reagent_containers/food/snacks/grown/leaf = W
if(leaf.dry)
user.show_message("<span class='notice'>You wrap \the [W] around the log, turning it into a torch!</span>")
@@ -103,6 +106,7 @@
desc = "For grilling, broiling, charring, smoking, heating, roasting, toasting, simmering, searing, melting, and occasionally burning things."
icon = 'icons/obj/hydroponics/equipment.dmi'
icon_state = "bonfire"
light_color = LIGHT_COLOR_FIRE
density = FALSE
anchored = TRUE
buckle_lying = 0
@@ -110,6 +114,16 @@
var/grill = FALSE
var/fire_stack_strength = 5
/obj/structure/bonfire/dense
density = TRUE
/obj/structure/bonfire/CanPass(atom/movable/mover, turf/target)
if(istype(mover) && mover.checkpass(PASSTABLE))
return TRUE
if(mover.throwing)
return TRUE
return ..()
/obj/structure/bonfire/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/stack/rods) && !can_buckle && !grill)
var/obj/item/stack/rods/R = W
@@ -127,8 +141,7 @@
R.use(1)
grill = TRUE
to_chat(user, "<span class='italics'>You add a grill to \the [src].")
var/mutable_appearance/grill_overlay = mutable_appearance('icons/obj/hydroponics/equipment.dmi', "bonfire_grill")
overlays += grill_overlay
add_overlay("bonfire_grill")
else
return ..()
if(W.is_hot())
@@ -157,6 +170,8 @@
var/obj/item/weapon/grown/log/L = new /obj/item/weapon/grown/log(src.loc)
L.pixel_x += rand(1,4)
L.pixel_y += rand(1,4)
if(can_buckle || grill)
new /obj/item/stack/rods(loc, 1)
qdel(src)
return
..()
+190 -190
View File
@@ -1,206 +1,206 @@
// Plant analyzer
/obj/item/device/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"
w_class = WEIGHT_CLASS_TINY
slot_flags = SLOT_BELT
origin_tech = "magnets=2;biotech=2"
materials = list(MAT_METAL=30, MAT_GLASS=20)
// *************************************
// Hydroponics Tools
// *************************************
/obj/item/weapon/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 = "spray"
volume = 100
container_type = OPENCONTAINER
slot_flags = SLOT_BELT
throwforce = 0
w_class = WEIGHT_CLASS_SMALL
throw_speed = 3
throw_range = 10
// Plant analyzer
/obj/item/device/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"
w_class = WEIGHT_CLASS_TINY
slot_flags = SLOT_BELT
origin_tech = "magnets=2;biotech=2"
materials = list(MAT_METAL=30, MAT_GLASS=20)
// *************************************
// Hydroponics Tools
// *************************************
/obj/item/weapon/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 = "spray"
volume = 100
container_type = OPENCONTAINER
slot_flags = SLOT_BELT
throwforce = 0
w_class = WEIGHT_CLASS_SMALL
throw_speed = 3
throw_range = 10
/obj/item/weapon/reagent_containers/spray/weedspray/Initialize()
. = ..()
reagents.add_reagent("weedkiller", 100)
/obj/item/weapon/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/weapon/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"
volume = 100
container_type = OPENCONTAINER
slot_flags = SLOT_BELT
throwforce = 0
w_class = WEIGHT_CLASS_SMALL
throw_speed = 3
throw_range = 10
reagents.add_reagent("weedkiller", 100)
/obj/item/weapon/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/weapon/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"
volume = 100
container_type = OPENCONTAINER
slot_flags = SLOT_BELT
throwforce = 0
w_class = WEIGHT_CLASS_SMALL
throw_speed = 3
throw_range = 10
/obj/item/weapon/reagent_containers/spray/pestspray/Initialize()
. = ..()
reagents.add_reagent("pestkiller", 100)
/obj/item/weapon/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/weapon/cultivator
name = "cultivator"
desc = "It's used for removing weeds or scratching your back."
icon = 'icons/obj/weapons.dmi'
icon_state = "cultivator"
item_state = "cultivator"
origin_tech = "engineering=2;biotech=2"
flags = CONDUCT
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/weapon/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/weapons.dmi'
icon_state = "hatchet"
flags = CONDUCT
force = 12
w_class = WEIGHT_CLASS_TINY
throwforce = 15
throw_speed = 3
throw_range = 4
materials = list(MAT_METAL = 15000)
origin_tech = "materials=2;combat=2"
attack_verb = list("chopped", "torn", "cut")
hitsound = 'sound/weapons/bladeslice.ogg'
sharpness = IS_SHARP
/obj/item/weapon/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(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
return (BRUTELOSS)
/obj/item/weapon/scythe
icon_state = "scythe0"
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 = CONDUCT
armour_penetration = 20
slot_flags = SLOT_BACK
origin_tech = "materials=3;combat=2"
attack_verb = list("chopped", "sliced", "cut", "reaped")
hitsound = 'sound/weapons/bladeslice.ogg'
/obj/item/weapon/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("head")
if(BP)
BP.drop_limb()
playsound(loc,pick('sound/misc/desceration-01.ogg','sound/misc/desceration-02.ogg','sound/misc/desceration-01.ogg') ,50, 1, -1)
return (BRUTELOSS)
// *************************************
// Nutrient defines for hydroponics
// *************************************
/obj/item/weapon/reagent_containers/glass/bottle/nutrient
name = "bottle of nutrient"
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle16"
volume = 50
w_class = WEIGHT_CLASS_TINY
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(1,2,5,10,15,25,50)
reagents.add_reagent("pestkiller", 100)
/obj/item/weapon/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/weapon/cultivator
name = "cultivator"
desc = "It's used for removing weeds or scratching your back."
icon = 'icons/obj/weapons.dmi'
icon_state = "cultivator"
item_state = "cultivator"
origin_tech = "engineering=2;biotech=2"
flags = CONDUCT
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/weapon/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/weapons.dmi'
icon_state = "hatchet"
flags = CONDUCT
force = 12
w_class = WEIGHT_CLASS_TINY
throwforce = 15
throw_speed = 3
throw_range = 4
materials = list(MAT_METAL = 15000)
origin_tech = "materials=2;combat=2"
attack_verb = list("chopped", "torn", "cut")
hitsound = 'sound/weapons/bladeslice.ogg'
sharpness = IS_SHARP
/obj/item/weapon/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(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
return (BRUTELOSS)
/obj/item/weapon/scythe
icon_state = "scythe0"
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 = CONDUCT
armour_penetration = 20
slot_flags = SLOT_BACK
origin_tech = "materials=3;combat=2"
attack_verb = list("chopped", "sliced", "cut", "reaped")
hitsound = 'sound/weapons/bladeslice.ogg'
/obj/item/weapon/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("head")
if(BP)
BP.drop_limb()
playsound(loc,pick('sound/misc/desceration-01.ogg','sound/misc/desceration-02.ogg','sound/misc/desceration-01.ogg') ,50, 1, -1)
return (BRUTELOSS)
// *************************************
// Nutrient defines for hydroponics
// *************************************
/obj/item/weapon/reagent_containers/glass/bottle/nutrient
name = "bottle of nutrient"
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle16"
volume = 50
w_class = WEIGHT_CLASS_TINY
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(1,2,5,10,15,25,50)
/obj/item/weapon/reagent_containers/glass/bottle/nutrient/Initialize()
. = ..()
src.pixel_x = rand(-5, 5)
src.pixel_y = rand(-5, 5)
/obj/item/weapon/reagent_containers/glass/bottle/nutrient/ez
name = "bottle of E-Z-Nutrient"
desc = "Contains a fertilizer that causes mild mutations with each harvest."
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle16"
src.pixel_x = rand(-5, 5)
src.pixel_y = rand(-5, 5)
/obj/item/weapon/reagent_containers/glass/bottle/nutrient/ez
name = "bottle of E-Z-Nutrient"
desc = "Contains a fertilizer that causes mild mutations with each harvest."
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle16"
/obj/item/weapon/reagent_containers/glass/bottle/nutrient/ez/Initialize()
. = ..()
reagents.add_reagent("eznutriment", 50)
/obj/item/weapon/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."
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle18"
reagents.add_reagent("eznutriment", 50)
/obj/item/weapon/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."
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle18"
/obj/item/weapon/reagent_containers/glass/bottle/nutrient/l4z/Initialize()
. = ..()
reagents.add_reagent("left4zednutriment", 50)
/obj/item/weapon/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."
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle15"
reagents.add_reagent("left4zednutriment", 50)
/obj/item/weapon/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."
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle15"
/obj/item/weapon/reagent_containers/glass/bottle/nutrient/rh/Initialize()
. = ..()
reagents.add_reagent("robustharvestnutriment", 50)
/obj/item/weapon/reagent_containers/glass/bottle/nutrient/empty
name = "bottle"
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle16"
/obj/item/weapon/reagent_containers/glass/bottle/killer
name = "bottle"
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle16"
volume = 50
w_class = WEIGHT_CLASS_TINY
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(1,2,5,10,15,25,50)
/obj/item/weapon/reagent_containers/glass/bottle/killer/weedkiller
name = "bottle of weed killer"
desc = "Contains a herbicide."
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle19"
reagents.add_reagent("robustharvestnutriment", 50)
/obj/item/weapon/reagent_containers/glass/bottle/nutrient/empty
name = "bottle"
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle16"
/obj/item/weapon/reagent_containers/glass/bottle/killer
name = "bottle"
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle16"
volume = 50
w_class = WEIGHT_CLASS_TINY
amount_per_transfer_from_this = 10
possible_transfer_amounts = list(1,2,5,10,15,25,50)
/obj/item/weapon/reagent_containers/glass/bottle/killer/weedkiller
name = "bottle of weed killer"
desc = "Contains a herbicide."
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle19"
/obj/item/weapon/reagent_containers/glass/bottle/killer/weedkiller/Initialize()
. = ..()
reagents.add_reagent("weedkiller", 50)
/obj/item/weapon/reagent_containers/glass/bottle/killer/pestkiller
name = "bottle of pest spray"
desc = "Contains a pesticide."
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle20"
reagents.add_reagent("weedkiller", 50)
/obj/item/weapon/reagent_containers/glass/bottle/killer/pestkiller
name = "bottle of pest spray"
desc = "Contains a pesticide."
icon = 'icons/obj/chemical.dmi'
icon_state = "bottle20"
/obj/item/weapon/reagent_containers/glass/bottle/killer/pestkiller/Initialize()
. = ..()
reagents.add_reagent("pestkiller", 50)
reagents.add_reagent("pestkiller", 50)
File diff suppressed because it is too large Load Diff
+17 -7
View File
@@ -10,8 +10,8 @@
/datum/plant_gene/proc/Copy()
return new type
/datum/plant_gene/proc/apply_vars(obj/item/seeds/S) // currently used for fire resist, can prob. be further refactored
return
// Core plant genes store 5 main variables: lifespan, endurance, production, yield, potency
/datum/plant_gene/core
@@ -201,7 +201,7 @@
// Makes plant slippery, unless it has a grown-type trash. Then the trash gets slippery.
// Applies other trait effects (teleporting, etc) to the target by on_slip.
name = "Slippery Skin"
rate = 0.1
rate = 1.6
examine_line = "<span class='info'>It has a very slippery skin.</span>"
/datum/plant_gene/trait/slip/on_cross(obj/item/weapon/reagent_containers/food/snacks/grown/G, atom/target)
@@ -209,17 +209,16 @@
var/obj/item/seeds/seed = G.seed
var/mob/living/carbon/M = target
var/stun_len = seed.potency * rate * 0.8
if(istype(G) && ispath(G.trash, /obj/item/weapon/grown))
return
var/stun_len = seed.potency * rate
if(!istype(G, /obj/item/weapon/grown/bananapeel) && (!G.reagents || !G.reagents.has_reagent("lube")))
stun_len /= 3
var/stun = min(stun_len, 7)
var/weaken = min(stun_len, 7)
var/knockdown = min(stun_len, 140)
if(M.slip(stun, weaken, G))
if(M.slip(knockdown, G))
for(var/datum/plant_gene/trait/T in seed.genes)
T.on_slip(G, M)
@@ -411,6 +410,17 @@
S.start()
G.reagents.clear_reagents()
/datum/plant_gene/trait/fire_resistance // Lavaland
name = "Fire Resistance"
/datum/plant_gene/trait/fire_resistance/apply_vars(obj/item/seeds/S)
if(!(S.resistance_flags & FIRE_PROOF))
S.resistance_flags |= FIRE_PROOF
/datum/plant_gene/trait/fire_resistance/on_new(obj/item/weapon/reagent_containers/food/snacks/grown/G, newloc)
if(!(G.resistance_flags & FIRE_PROOF))
G.resistance_flags |= FIRE_PROOF
/datum/plant_gene/trait/plant_type // Parent type
name = "you shouldn't see this"
trait_id = "plant_type"
+1 -1
View File
@@ -191,7 +191,7 @@
to_chat(usr, "<span class='notice'>\The [src] is full.</span>")
return 0
if(istype(O.loc,/mob))
if(ismob(O.loc))
var/mob/M = O.loc
if(!M.drop_item())
return 0
+385 -385
View File
@@ -1,386 +1,386 @@
// ********************************************************
// 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/product // A type path. The thing that is created when the plant is harvested.
var/species = "" // Used to update icons. Should match the name in the sprites unless all icon_* are overriden.
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/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/New(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])
/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.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/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
/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 = usr)
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/weapon/reagent_containers/food/snacks/grown/t_prod = new product(output_loc, src)
result.Add(t_prod) // User gets a consumable
if(!t_prod)
return
t_amount++
product_name = t_prod.name
if(getYield() >= 1)
// ********************************************************
// 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/product // A type path. The thing that is created when the plant is harvested.
var/species = "" // Used to update icons. Should match the name in the sprites unless all icon_* are overriden.
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/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/New(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])
/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.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/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
/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 = usr)
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/weapon/reagent_containers/food/snacks/grown/t_prod = new product(output_loc, src)
result.Add(t_prod) // User gets a consumable
if(!t_prod)
return
t_amount++
product_name = t_prod.name
if(getYield() >= 1)
SSblackbox.add_details("food_harvested","[product_name]|[getYield()]")
parent.update_tray()
return result
/obj/item/seeds/proc/prepare_result(var/obj/item/weapon/reagent_containers/food/snacks/grown/T)
if(T.reagents)
for(var/reagent_id in reagents_add)
if(reagent_id == "blood") // Hack to make blood in plants always O-
T.reagents.add_reagent(reagent_id, 1 + round(potency * reagents_add[reagent_id], 1), list("blood_type"="O-"))
continue
T.reagents.add_reagent(reagent_id, 1 + round(potency * reagents_add[reagent_id],1))
return 1
/// 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/device/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
..() // 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))
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)
parent.update_tray()
return result
/obj/item/seeds/proc/prepare_result(var/obj/item/weapon/reagent_containers/food/snacks/grown/T)
if(T.reagents)
for(var/reagent_id in reagents_add)
if(reagent_id == "blood") // Hack to make blood in plants always O-
T.reagents.add_reagent(reagent_id, 1 + round(potency * reagents_add[reagent_id], 1), list("blood_type"="O-"))
continue
T.reagents.add_reagent(reagent_id, 1 + round(potency * reagents_add[reagent_id],1))
return 1
/// 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/device/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
..() // 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))
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)