Added portable_atmospherics to hydroponics machine path, couple of other tweaks.

This commit is contained in:
Zuhayr
2014-07-27 03:20:16 +09:30
parent 976cb4f844
commit 4ef8a08310
14 changed files with 104 additions and 118 deletions
+2 -2
View File
@@ -31,9 +31,9 @@
var/obj/item/seeds/S = target
grown_seed = S.seed
else if(istype(target,/obj/machinery/hydroponics))
else if(istype(target,/obj/machinery/portable_atmospherics/hydroponics))
var/obj/machinery/hydroponics/H = target
var/obj/machinery/portable_atmospherics/hydroponics/H = target
grown_seed = H.seed
grown_reagents = H.reagents
+45 -62
View File
@@ -1,6 +1,6 @@
#define HYDRO_SPEED_MULTIPLIER 1
/obj/machinery/hydroponics
/obj/machinery/portable_atmospherics/hydroponics
name = "hydroponics tray"
icon = 'icons/obj/hydroponics.dmi'
icon_state = "hydrotray3"
@@ -30,7 +30,6 @@
var/lastcycle = 0 // Cycle timing/tracking var.
var/cycledelay = 150 // Delay per cycle.
var/closed_system // If set, the tray will attempt to take atmos from a pipe.
var/obj/machinery/atmospherics/portables_connector/atmos_source //Used for above.
// Seed details/line data.
var/datum/seed/seed = null // The currently planted seed
@@ -111,21 +110,12 @@
"mutagen" = 3
)
/obj/machinery/hydroponics/New()
/obj/machinery/portable_atmospherics/hydroponics/New()
..()
if(closed_system)
get_connector()
updateicon()
connect()
update_icon()
/obj/machinery/hydroponics/proc/get_connector()
atmos_source = null
var/turf/T = get_turf(src)
if(!T) return
atmos_source = locate() in T.contents
if(atmos_source)
src.visible_message("[src] connects to [atmos_source] with a solid clunk.")
/obj/machinery/hydroponics/bullet_act(var/obj/item/projectile/Proj)
/obj/machinery/portable_atmospherics/hydroponics/bullet_act(var/obj/item/projectile/Proj)
//Override for somatoray projectiles.
if(istype(Proj ,/obj/item/projectile/energy/floramut) && prob(20))
@@ -137,7 +127,7 @@
..()
/obj/machinery/hydroponics/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
/obj/machinery/portable_atmospherics/hydroponics/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0)) return 1
if(istype(mover) && mover.checkpass(PASSTABLE))
@@ -145,7 +135,7 @@
else
return 0
/obj/machinery/hydroponics/process()
/obj/machinery/portable_atmospherics/hydroponics/process()
// Update values every cycle rather than every process() tick.
if(world.time < (lastcycle + cycledelay))
@@ -191,11 +181,9 @@
var/turf/T = loc
var/datum/gas_mixture/environment
//TODO: Fix this. Dev atmos changes impacted it most likely.
// If we're a closed system, take from any connected network.
//if(closed_system && atmos_source)
// if(atmos_source.network)
// environment = atmos_source.network.air_transient
// If we're closed, take from our internal sources.
if(closed_system && (connected_port || holding))
environment = air_contents
// If atmos input is not there, grab from turf.
if(!environment)
@@ -269,11 +257,11 @@
pestlevel += 1 * HYDRO_SPEED_MULTIPLIER
check_level_sanity()
updateicon()
update_icon()
return
//Harvests the product of a plant.
/obj/machinery/hydroponics/proc/harvest(var/mob/user)
/obj/machinery/portable_atmospherics/hydroponics/proc/harvest(var/mob/user)
//Harvest the product of the plant,
if(!seed || !harvest || !user)
@@ -296,11 +284,11 @@
age = 0
check_level_sanity()
updateicon()
update_icon()
return
//Clears out a dead plant.
/obj/machinery/hydroponics/proc/remove_dead(var/mob/user)
/obj/machinery/portable_atmospherics/hydroponics/proc/remove_dead(var/mob/user)
if(!user || !dead) return
if(closed_system)
@@ -311,11 +299,11 @@
dead = 0
user << "You remove the dead plant from the [src]."
check_level_sanity()
updateicon()
update_icon()
return
//Refreshes the icon and sets the luminosity
/obj/machinery/hydroponics/proc/updateicon()
/obj/machinery/portable_atmospherics/hydroponics/update_icon()
overlays.Cut()
@@ -371,7 +359,7 @@
return
// If a weed growth is sufficient, this proc is called.
obj/machinery/hydroponics/proc/weed_invasion()
/obj/machinery/portable_atmospherics/hydroponics/proc/weed_invasion()
//Remove the seed if something is already planted.
if(seed) seed = null
@@ -385,12 +373,12 @@ obj/machinery/hydroponics/proc/weed_invasion()
harvest = 0
weedlevel = 0
pestlevel = 0
updateicon()
update_icon()
visible_message("\blue [src] has been overtaken by [seed.display_name].")
return
/obj/machinery/hydroponics/proc/mutate(var/severity)
/obj/machinery/portable_atmospherics/hydroponics/proc/mutate(var/severity)
// No seed, no mutations.
if(!seed)
@@ -398,7 +386,6 @@ obj/machinery/hydroponics/proc/weed_invasion()
// Check if we should even bother working on the current seed datum.
if(seed.mutants.len && severity > 1 && prob(10+mutation_mod))
world << "Mutating species instead."
mutate_species()
return
@@ -411,7 +398,7 @@ obj/machinery/hydroponics/proc/weed_invasion()
return
/obj/machinery/hydroponics/proc/check_level_sanity()
/obj/machinery/portable_atmospherics/hydroponics/proc/check_level_sanity()
//Make sure various values are sane.
if(seed)
health = max(0,min(seed.endurance,health))
@@ -426,7 +413,7 @@ obj/machinery/hydroponics/proc/weed_invasion()
toxins = max(0,min(toxins,10))
/obj/machinery/hydroponics/proc/mutate_species()
/obj/machinery/portable_atmospherics/hydroponics/proc/mutate_species()
var/previous_plant = seed.display_name
var/newseed = seed.get_mutant_variant()
@@ -443,16 +430,12 @@ obj/machinery/hydroponics/proc/weed_invasion()
harvest = 0
weedlevel = 0
updateicon()
update_icon()
visible_message("\red The \blue [previous_plant] \red has suddenly mutated into \blue [seed.display_name]!")
return
/obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(closed_system && !istype(O,/obj/item/weapon/wrench))
user << "You can't reach the interior while the lid is shut."
return
/obj/machinery/portable_atmospherics/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob)
if (istype(O, /obj/item/weapon/reagent_containers/glass))
var/b_amount = O.reagents.get_reagent_amount("water")
@@ -473,7 +456,7 @@ obj/machinery/hydroponics/proc/weed_invasion()
user << "\red \The [O] is not filled with water."
check_level_sanity()
updateicon()
update_icon()
// Nutrient fluid replacement. TODO: Consider rolling this into a proper reagent-processing proc.
else if ( istype(O, /obj/item/nutrient) )
@@ -484,7 +467,7 @@ obj/machinery/hydroponics/proc/weed_invasion()
mutation_mod = nutrient.mutmod
user << "You replace the nutrient solution in the [src]."
del(O)
updateicon()
update_icon()
// Syringe stuff
else if(istype(O, /obj/item/weapon/reagent_containers/syringe))
@@ -600,7 +583,7 @@ obj/machinery/hydroponics/proc/weed_invasion()
user << "There's nothing to inject the solution into."
check_level_sanity()
updateicon()
update_icon()
else if (istype(O, /obj/item/seeds))
@@ -636,7 +619,7 @@ obj/machinery/hydroponics/proc/weed_invasion()
del(O)
check_level_sanity()
updateicon()
update_icon()
else
user << "\red The [src] already has seeds in it!"
@@ -657,7 +640,7 @@ obj/machinery/hydroponics/proc/weed_invasion()
visible_message("\red <B>\The [src] has been sprayed with \the [O][(user ? " by [user]." : ".")]")
playsound(loc, 'sound/effects/spray3.ogg', 50, 1, -6)
updateicon()
update_icon()
else
user << "There's nothing in [src] to spray!"
@@ -666,7 +649,7 @@ obj/machinery/hydroponics/proc/weed_invasion()
if(weedlevel > 0)
user.visible_message("\red [user] starts uprooting the weeds.", "\red You remove the weeds from the [src].")
weedlevel = 0
updateicon()
update_icon()
else
user << "\red This plot is completely devoid of weeds. It doesn't need uprooting."
@@ -692,17 +675,18 @@ obj/machinery/hydroponics/proc/weed_invasion()
del(O)
check_level_sanity()
updateicon()
update_icon()
else if(istype(O, /obj/item/weapon/wrench))
//If there's a connector here, the portable_atmospherics setup can handle it.
if(locate(/obj/machinery/atmospherics/portables_connector/) in loc)
return ..()
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
anchored = !anchored
user << "You [anchored ? "wrench" : "unwrench"] \the [src]."
//Update atmos feed, if needed.
if(anchored && closed_system)
get_connector()
else if(istype(O, /obj/item/apiary))
if(seed)
@@ -718,7 +702,7 @@ obj/machinery/hydroponics/proc/weed_invasion()
del(src)
return
/obj/machinery/hydroponics/attack_tk(mob/user as mob)
/obj/machinery/portable_atmospherics/hydroponics/attack_tk(mob/user as mob)
if(harvest)
harvest(user)
@@ -726,7 +710,7 @@ obj/machinery/hydroponics/proc/weed_invasion()
else if(dead)
remove_dead(user)
/obj/machinery/hydroponics/attack_hand(mob/user as mob)
/obj/machinery/portable_atmospherics/hydroponics/attack_hand(mob/user as mob)
if(istype(usr,/mob/living/silicon))
return
@@ -751,7 +735,7 @@ obj/machinery/hydroponics/proc/weed_invasion()
usr << "[src] is \red filled with tiny worms!"
usr << text ("")
/obj/machinery/hydroponics/verb/close_lid()
/obj/machinery/portable_atmospherics/hydroponics/verb/close_lid()
set name = "Toggle Tray Lid"
set category = "Object"
set src in view(1)
@@ -761,12 +745,9 @@ obj/machinery/hydroponics/proc/weed_invasion()
closed_system = !closed_system
usr << "You [closed_system ? "close" : "open"] the tray's lid."
updateicon()
update_icon()
if(anchored && closed_system)
get_connector()
/obj/machinery/hydroponics/soil
/obj/machinery/portable_atmospherics/hydroponics/soil
name = "soil"
icon = 'icons/obj/hydroponics.dmi'
icon_state = "soil"
@@ -774,15 +755,17 @@ obj/machinery/hydroponics/proc/weed_invasion()
use_power = 0
draw_warnings = 0
/obj/machinery/hydroponics/soil/attackby(var/obj/item/O as obj, var/mob/user as mob)
/obj/machinery/portable_atmospherics/hydroponics/soil/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(istype(O, /obj/item/weapon/shovel))
user << "You clear up [src]!"
del(src)
else if(istype(O,/obj/item/weapon/shovel) || istype(O,/obj/item/weapon/tank))
return
else
..()
/obj/machinery/hydroponics/soil/New()
/obj/machinery/portable_atmospherics/hydroponics/soil/New()
..()
verbs -= /obj/machinery/hydroponics/verb/close_lid
verbs -= /obj/machinery/portable_atmospherics/hydroponics/verb/close_lid
#undef HYDRO_SPEED_MULTIPLIER
+1 -1
View File
@@ -1154,7 +1154,7 @@ proc/populate_seed_list()
name = "weeds"
seed_name = "weed"
display_name = "weeds"
packet_icon = "seed"
packet_icon = "seed-ambrosiavulgaris"
plant_icon = "weeds"
lifespan = 100
+10 -8
View File
@@ -8,11 +8,13 @@
/obj/item/weapon/disk/botany/attack_self(var/mob/user as mob)
if(genes.len)
user << "You wipe the disk data."
name = initial(name)
desc = initial(name)
genes = list()
genesource = "unknown"
var/choice = alert(user, "Are you sure you want to wipe the disk?", "Xenobotany Data", "No", "Yes")
if(src && user && genes && choice == "Yes")
user << "You wipe the disk data."
name = initial(name)
desc = initial(name)
genes = list()
genesource = "unknown"
/obj/item/weapon/storage/box/botanydisk
name = "flora disk box"
@@ -171,7 +173,7 @@
/obj/machinery/botany/Topic(href, href_list)
if(..())
return
return 1
if(href_list["eject_packet"])
if(!seed) return
@@ -199,7 +201,7 @@
/obj/machinery/botany/extractor/Topic(href, href_list)
if(..())
return
return 1
usr.set_machine(src)
src.add_fingerprint(usr)
@@ -299,7 +301,7 @@
/obj/machinery/botany/editor/Topic(href, href_list)
if(..())
return
return 1
if(href_list["apply_gene"])
if(!loaded_disk || !seed) return
+1 -1
View File
@@ -39,7 +39,7 @@
return
if(9)
for(var/i = 0, i < 3, i++)
new/obj/machinery/hydroponics(src)
new/obj/machinery/portable_atmospherics/hydroponics(src)
if(10)
for(var/i = 0, i < 3, i++)
new/obj/item/weapon/reagent_containers/glass/beaker/noreact(src)
@@ -107,11 +107,11 @@
set desc = "Turn your food into nutrients for plants."
var/list/trays = list()
for(var/obj/machinery/hydroponics/tray in range(1))
for(var/obj/machinery/portable_atmospherics/hydroponics/tray in range(1))
if(tray.nutrilevel < 10)
trays += tray
var/obj/machinery/hydroponics/target = input("Select a tray:") as null|anything in trays
var/obj/machinery/portable_atmospherics/hydroponics/target = input("Select a tray:") as null|anything in trays
if(!src || !target || target.nutrilevel == 10) return //Sanity check.
@@ -126,11 +126,11 @@
set desc = "Clean the weeds out of soil or a hydroponics tray."
var/list/trays = list()
for(var/obj/machinery/hydroponics/tray in range(1))
for(var/obj/machinery/portable_atmospherics/hydroponics/tray in range(1))
if(tray.weedlevel > 0)
trays += tray
var/obj/machinery/hydroponics/target = input("Select a tray:") as null|anything in trays
var/obj/machinery/portable_atmospherics/hydroponics/target = input("Select a tray:") as null|anything in trays
if(!src || !target || target.weedlevel == 0) return //Sanity check.
@@ -13,7 +13,7 @@
var/obj/machinery/apiary/parent
pass_flags = PASSTABLE
turns_per_move = 6
var/obj/machinery/hydroponics/my_hydrotray
var/obj/machinery/portable_atmospherics/hydroponics/my_hydrotray
/mob/living/simple_animal/bee/New(loc, var/obj/machinery/apiary/new_parent)
..()
@@ -156,7 +156,7 @@
else if(feral < 0)
turns_since_move = 0
else if(!my_hydrotray || my_hydrotray.loc != src.loc || my_hydrotray.dead || !my_hydrotray.seed)
var/obj/machinery/hydroponics/my_hydrotray = locate() in src.loc
var/obj/machinery/portable_atmospherics/hydroponics/my_hydrotray = locate() in src.loc
if(my_hydrotray)
if(!my_hydrotray.dead && my_hydrotray.seed)
turns_per_move = rand(20,50)
@@ -40,7 +40,7 @@
/obj/machinery/sleeper,
/obj/machinery/smartfridge/,
/obj/machinery/biogenerator,
/obj/machinery/hydroponics,
/obj/machinery/portable_atmospherics/hydroponics,
/obj/machinery/constructable_frame)
New()
@@ -242,7 +242,7 @@
/obj/item/weapon/reagent_containers/spray/plantbgone/afterattack(atom/A as mob|obj, mob/user as mob, proximity)
if(!proximity) return
if (istype(A, /obj/machinery/hydroponics)) // We are targeting hydrotray
if (istype(A, /obj/machinery/portable_atmospherics/hydroponics)) // We are targeting hydrotray
return
if (istype(A, /obj/effect/blob)) // blob damage in blob code