diff --git a/code/datums/supplypacks/misc.dm b/code/datums/supplypacks/misc.dm index 5a3bb038bb..ab4a0163c1 100644 --- a/code/datums/supplypacks/misc.dm +++ b/code/datums/supplypacks/misc.dm @@ -70,3 +70,10 @@ cost = 10 containertype = "/obj/structure/closet/crate" containername = "Webbing crate" + +/datum/supply_packs/misc/holoplant + name = "Holoplant Pot" + contains = list() + cost = 15 + containertype = /obj/machinery/holoplant/shipped + containername = "holoplant" diff --git a/code/game/objects/structures/holoplant.dm b/code/game/objects/structures/holoplant.dm new file mode 100644 index 0000000000..1f6473ebdc --- /dev/null +++ b/code/game/objects/structures/holoplant.dm @@ -0,0 +1,105 @@ +/obj/machinery/holoplant + name = "holoplant" + desc = "One of those Ward-Takahashi holoplants! Give your space a bit of the comfort of being outdoors, by buying this blue buddy. A rugged case guarantees that your flower will outlive you, and variety of plant types won't let you to get bored along the way!" + icon = 'icons/obj/holoplants.dmi' + icon_state = "holopot" + light_color = "#3C94C5" + anchored = TRUE + idle_power_usage = 0 + active_power_usage = 5 + var/interference = FALSE + var/icon/plant = null + var/global/list/possible_plants = list( + "plant-1", + "plant-10", + "plant-09", + "plant-15", + "plant-13" + ) + +/obj/machinery/holoplant/initialize() + . = ..() + activate() + +/obj/machinery/holoplant/attack_hand(var/mob/living/user) + if(!istype(user) || interference) + return + + if(!anchored) + to_chat(user,"\The [src] must be anchored before activation!") + return + + if(!plant) + activate() + else + deactivate() + +/obj/machinery/holoplant/attackby(var/obj/item/O as obj, var/mob/user as mob) + if(default_unfasten_wrench(user, O, 10)) + deactivate() + return + + . = ..() + +/obj/machinery/holoplant/proc/activate() + if(!anchored || stat & (NOPOWER|BROKEN)) + return + + plant = prepare_icon(emagged ? "emagged" : null) + overlays += plant + set_light(2) + use_power = 2 + +/obj/machinery/holoplant/proc/deactivate() + overlays -= plant + qdel_null(plant) + set_light(0) + use_power = 0 + +/obj/machinery/holoplant/power_change() + ..() + if(stat & NOPOWER) + deactivate() + else + activate() + +/obj/machinery/holoplant/proc/flicker() + interference = TRUE + spawn(0) + overlays -= plant + set_light(0) + sleep(rand(2,4)) + overlays += plant + set_light(2) + sleep(rand(2,4)) + overlays -= plant + set_light(0) + sleep(rand(2,4)) + overlays += plant + set_light(2) + interference = FALSE + +/obj/machinery/holoplant/proc/prepare_icon(var/state) + if(!state) + state = pick(possible_plants) + var/plant_icon = icon(icon, state) + return getHologramIcon(plant_icon, 0) + +/obj/machinery/holoplant/emag_act() + if(emagged) + return + + emagged = TRUE + if(plant) + deactivate() + activate() + +/obj/machinery/holoplant/Crossed(var/mob/living/L) + if(!interference && plant && istype(L)) + flicker() + + +/obj/machinery/holoplant/shipped + anchored = FALSE +/obj/machinery/holoplant/shipped/initialize() + . = ..() \ No newline at end of file diff --git a/icons/obj/holoplants.dmi b/icons/obj/holoplants.dmi new file mode 100644 index 0000000000..aada565b95 Binary files /dev/null and b/icons/obj/holoplants.dmi differ diff --git a/polaris.dme b/polaris.dme index e026cf9978..4a785222d5 100644 --- a/polaris.dme +++ b/polaris.dme @@ -1032,6 +1032,7 @@ #include "code\game\objects\structures\girders.dm" #include "code\game\objects\structures\gravemarker.dm" #include "code\game\objects\structures\grille.dm" +#include "code\game\objects\structures\holoplant.dm" #include "code\game\objects\structures\inflatable.dm" #include "code\game\objects\structures\janicart.dm" #include "code\game\objects\structures\kitchen_spike.dm"