Re-Adds Hydro Tray Covers

Also fixed a derp with the define
This commit is contained in:
FalseIncarnate
2017-02-12 23:32:49 -05:00
parent 030dba205d
commit b0f46a28a1
3 changed files with 27 additions and 6 deletions
+23 -2
View File
@@ -1,4 +1,4 @@
#define HYDRO_CYCLES_PER_AGE 3 //Adjust this to adjust how many hydroponics cycles it takes to increase age. Positive integers only.
#define HYDRO_CYCLES_PER_AGE 3 //Adjust this to adjust how many hydroponics cycles it takes to increase age. Positive integers only.
/obj/machinery/hydroponics
name = "hydroponics tray"
@@ -27,6 +27,7 @@
var/obj/item/seeds/myseed = null //The currently planted seed
var/rating = 1
var/wrenchable = 1
var/lid_state = 0
var/recent_bee_visit = FALSE //Have we been visited by a bee recently, so bees dont overpollinate one plant
var/using_irrigation = FALSE //If the tray is connected to other trays via irrigation hoses
var/self_sustaining = FALSE //If the tray generates nutrients and water on its own
@@ -111,6 +112,20 @@
return connected
/obj/machinery/hydroponics/AltClick()
if(wrenchable && !usr.stat && !usr.lying && Adjacent(usr))
toggle_lid(usr)
return
return ..()
/obj/machinery/hydroponics/proc/toggle_lid(mob/living/user)
if(!user || user.stat || user.restrained())
return
lid_state = !lid_state
to_chat(user, "<span class='notice'>You [lid_state ? "close" : "open"] the tray's lid.</span>")
update_icon()
/obj/machinery/hydroponics/bullet_act(obj/item/projectile/Proj) //Works with the Somatoray to modify plant variables.
if(!myseed)
@@ -273,6 +288,9 @@
overlays += image('icons/obj/hydroponics/equipment.dmi', icon_state = "gaia_blessing")
set_light(3)
if(lid_state)
overlays += image('icons/obj/hydroponics/equipment.dmi', icon_state = "hydrocover")
update_icon_hoses()
if(myseed)
@@ -910,6 +928,9 @@
/obj/machinery/hydroponics/attack_hand(mob/user)
if(issilicon(user)) //How does AI know what plant is?
return
if(lid_state)
to_chat(user, "<span class='warning'>You can't reach the plant through the cover.</span>")
return
if(harvest)
myseed.harvest(user)
else if(dead)
@@ -1021,4 +1042,4 @@
else
..()
#undefine HYDRO_CYCLES_PER_AGE
#undef HYDRO_CYCLES_PER_AGE
@@ -161,8 +161,8 @@
/mob/living/simple_animal/hostile/poison/bees/worker/Found(atom/A)
if(istype(A, /obj/machinery/hydroponics))
var/obj/machinery/hydroponics/Hydro = A
if(Hydro.myseed && !Hydro.dead && !Hydro.recent_bee_visit)
wanted_objects |= /obj/machinery/hydroponics //so we only hunt them while they're alive/seeded/not visisted
if(Hydro.myseed && !Hydro.dead && !Hydro.recent_bee_visit && !Hydro.lid_state)
wanted_objects |= /obj/machinery/hydroponics //so we only hunt them while they're alive/seeded/not visisted and uncovered
return 1
..()
@@ -188,12 +188,12 @@
..()
/mob/living/simple_animal/hostile/poison/bees/worker/proc/pollinate(obj/machinery/hydroponics/Hydro)
if(!istype(Hydro) || !Hydro.myseed || Hydro.dead || Hydro.recent_bee_visit)
if(!istype(Hydro) || !Hydro.myseed || Hydro.dead || Hydro.recent_bee_visit || Hydro.lid_state)
target = null
return
target = null //so we pick a new hydro tray next FindTarget(), instead of loving the same plant for eternity
wanted_objects -= /obj/machinery/hydroponics //so we only hunt them while they're alive/seeded/not visisted
wanted_objects -= /obj/machinery/hydroponics //so we only hunt them while they're alive/seeded/not visisted and uncovered
Hydro.recent_bee_visit = TRUE
spawn(BEE_TRAY_RECENT_VISIT)
if(Hydro)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 26 KiB