diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 81bbcf16110..8d08286fa8e 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -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, "You [lid_state ? "close" : "open"] the tray's lid.") + 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, "You can't reach the plant through the cover.") + return if(harvest) myseed.harvest(user) else if(dead) @@ -1021,4 +1042,4 @@ else ..() -#undefine HYDRO_CYCLES_PER_AGE \ No newline at end of file +#undef HYDRO_CYCLES_PER_AGE \ No newline at end of file diff --git a/code/modules/mob/living/simple_animal/hostile/bees.dm b/code/modules/mob/living/simple_animal/hostile/bees.dm index 538ce8450c7..76577327b61 100644 --- a/code/modules/mob/living/simple_animal/hostile/bees.dm +++ b/code/modules/mob/living/simple_animal/hostile/bees.dm @@ -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) diff --git a/icons/obj/hydroponics/equipment.dmi b/icons/obj/hydroponics/equipment.dmi index 189d1682194..3b1c4c07cfa 100644 Binary files a/icons/obj/hydroponics/equipment.dmi and b/icons/obj/hydroponics/equipment.dmi differ