diff --git a/code/datums/wires/seedstorage.dm b/code/datums/wires/seedstorage.dm new file mode 100644 index 0000000000..e21bbb9faf --- /dev/null +++ b/code/datums/wires/seedstorage.dm @@ -0,0 +1,60 @@ +#define SEED_WIRE_SMART 1 +#define SEED_WIRE_CONTRABAND 2 +#define SEED_WIRE_ELECTRIFY 4 +#define SEED_WIRE_LOCKDOWN 8 + +/datum/wires/seedstorage + holder_type = /obj/machinery/seed_storage + wire_count = 4 + random = 1 + +/datum/wires/seedstorage/CanUse(var/mob/living/L) + var/obj/machinery/seed_storage/V = holder + if(!istype(L, /mob/living/silicon)) + if(V.seconds_electrified) + if(V.shock(L, 100)) + return 0 + if(V.panel_open) + return 1 + return 0 + +/datum/wires/seedstorage/GetInteractWindow() + var/obj/machinery/seed_storage/V = holder + . += ..() + . += "
The orange light is [V.seconds_electrified ? "off" : "on"].
" + . += "The red light is [V.smart ? "off" : "blinking"].
" + . += "The green light is [(V.hacked || V.emagged) ? "on" : "off"].
" + . += "The keypad lock is [V.lockdown ? "deployed" : "retracted"].
" + +/datum/wires/seedstorage/UpdatePulsed(var/index) + var/obj/machinery/seed_storage/V = holder + switch(index) + if(SEED_WIRE_SMART) + V.smart = !V.smart + if(SEED_WIRE_CONTRABAND) + V.hacked = !V.hacked + if(SEED_WIRE_ELECTRIFY) + V.seconds_electrified = 30 + if(SEED_WIRE_LOCKDOWN) + V.lockdown = !V.lockdown + +/datum/wires/seedstorage/UpdateCut(var/index, var/mended) + var/obj/machinery/seed_storage/V = holder + switch(index) + if(SEED_WIRE_SMART) + V.smart = 0 + if(SEED_WIRE_CONTRABAND) + V.hacked = !mended + if(SEED_WIRE_ELECTRIFY) + if(mended) + V.seconds_electrified = 0 + else + V.seconds_electrified = -1 + if(SEED_WIRE_LOCKDOWN) + if(mended) + V.lockdown = 1 + V.req_access = list() + V.req_one_access = list() + else + V.req_access = initial(V.req_access) + V.req_one_access = initial(V.req_one_access) diff --git a/code/modules/hydroponics/seed_storage.dm b/code/modules/hydroponics/seed_storage.dm index ea7216dfd3..6b2d1d1695 100644 --- a/code/modules/hydroponics/seed_storage.dm +++ b/code/modules/hydroponics/seed_storage.dm @@ -29,12 +29,65 @@ var/seeds_initialized = 0 // Map-placed ones break if seeds are loaded right at the start of the round, so we do it on the first interaction var/list/datum/seed_pile/piles = list() + var/list/datum/seed_pile/piles_contra = list() //Hacked. var/list/starting_seeds = list() + var/list/contraband_seeds = list() //Seeds we only show if we've been hacked. var/list/scanner = list() // What properties we can view + var/seconds_electrified = 0 //Shock users like an airlock. + var/smart = 0 //Used for hacking. Overrides the scanner. + var/hacked = 0 + var/lockdown = 0 + var/datum/wires/seedstorage/wires = null + +/obj/machinery/seed_storage/New() + ..() + wires = new(src) + if(!contraband_seeds.len) + contraband_seeds = pick(list( + list( + /obj/item/seeds/ambrosiavulgarisseed = 3, + /obj/item/seeds/greengrapeseed = 3, + /obj/item/seeds/reishimycelium = 2, + /obj/item/seeds/bloodtomatoseed = 1 + ), + list( + /obj/item/seeds/ambrosiavulgarisseed = 3, + /obj/item/seeds/plastiseed = 3, + /obj/item/seeds/kudzuseed = 2, + /obj/item/seeds/nettleseed = 1 + ), + list( + /obj/item/seeds/ambrosiavulgarisseed = 3, + /obj/item/seeds/amanitamycelium = 3, + /obj/item/seeds/libertymycelium = 2, + /obj/item/seeds/glowshroom = 1 + ), + list( + /obj/item/seeds/ambrosiavulgarisseed = 3, + /obj/item/seeds/glowberryseed = 3, + /obj/item/seeds/icepepperseed = 2, + /obj/item/seeds/bluetomatoseed = 1 + ), + list( + /obj/item/seeds/ambrosiadeusseed = 1, + /obj/item/seeds/killertomatoseed = 1 + ), + list( + /obj/item/seeds/ambrosiavulgarisseed = 3, + /obj/item/seeds/random = 6 + ) + )) + return + +/obj/machinery/seed_storage/process() + ..() + if(seconds_electrified > 0) + seconds_electrified-- + return /obj/machinery/seed_storage/random // This is mostly for testing, but I guess admins could spawn it name = "Random seed storage" - scanner = list("stats", "produce", "soil", "temperature", "light") + scanner = list("stats", "produce", "soil", "temperature", "light", "pressure") starting_seeds = list(/obj/item/seeds/random = 50) /obj/machinery/seed_storage/garden @@ -81,7 +134,8 @@ /obj/machinery/seed_storage/xenobotany name = "Xenobotany seed storage" - scanner = list("stats", "produce", "soil", "temperature", "light") + scanner = list("stats", "produce", "soil", "temperature", "light", "pressure") + smart = 1 starting_seeds = list( /obj/item/seeds/ambrosiavulgarisseed = 3, /obj/item/seeds/appleseed = 3, @@ -128,6 +182,17 @@ ) /obj/machinery/seed_storage/attack_hand(mob/user as mob) + if(stat & (BROKEN|NOPOWER)) + return + + if(seconds_electrified != 0) + if(shock(user, 100)) + return + + if(panel_open) + wires.Interact(user) + if(lockdown) + return user.set_machine(src) interact(user) @@ -135,6 +200,11 @@ if (..()) return + if(smart) + scanner = list("stats", "produce", "soil", "temperature", "light", "pressure") + else + scanner = initial(scanner) + if (!seeds_initialized) for(var/typepath in starting_seeds) var/amount = starting_seeds[typepath] @@ -143,6 +213,13 @@ for (var/i = 1 to amount) var/O = new typepath add(O) + for(var/typepath in contraband_seeds) + var/amount = contraband_seeds[typepath] + if(isnull(amount)) amount = 1 + + for (var/i = 1 to amount) + var/O = new typepath + add(O, 1) seeds_initialized = 1 var/dat = "

Seed storage contents

" @@ -248,6 +325,95 @@ dat += "[S.amount]" dat += "Vend Purge" dat += "" + if(hacked || emagged) + for (var/datum/seed_pile/S in piles_contra) + var/datum/seed/seed = S.seed_type + if(!seed) + continue + dat += "" + dat += "[seed.seed_name]" + dat += "#[seed.uid]" + if ("stats" in scanner) + dat += "[seed.get_trait(TRAIT_ENDURANCE)][seed.get_trait(TRAIT_YIELD)][seed.get_trait(TRAIT_MATURATION)][seed.get_trait(TRAIT_PRODUCTION)][seed.get_trait(TRAIT_POTENCY)]" + if(seed.get_trait(TRAIT_HARVEST_REPEAT)) + dat += "Multiple" + else + dat += "Single" + if ("temperature" in scanner) + dat += "[seed.get_trait(TRAIT_IDEAL_HEAT)] K" + if ("light" in scanner) + dat += "[seed.get_trait(TRAIT_IDEAL_LIGHT)] L" + if ("soil" in scanner) + if(seed.get_trait(TRAIT_REQUIRES_NUTRIENTS)) + if(seed.get_trait(TRAIT_NUTRIENT_CONSUMPTION) < 0.05) + dat += "Low" + else if(seed.get_trait(TRAIT_NUTRIENT_CONSUMPTION) > 0.2) + dat += "High" + else + dat += "Norm" + else + dat += "No" + if(seed.get_trait(TRAIT_REQUIRES_WATER)) + if(seed.get_trait(TRAIT_WATER_CONSUMPTION) < 1) + dat += "Low" + else if(seed.get_trait(TRAIT_WATER_CONSUMPTION) > 5) + dat += "High" + else + dat += "Norm" + else + dat += "No" + + dat += "" + switch(seed.get_trait(TRAIT_CARNIVOROUS)) + if(1) + dat += "CARN " + if(2) + dat += "CARN " + switch(seed.get_trait(TRAIT_SPREAD)) + if(1) + dat += "VINE " + if(2) + dat += "VINE " + if ("pressure" in scanner) + if(seed.get_trait(TRAIT_LOWKPA_TOLERANCE) < 20) + dat += "LP " + if(seed.get_trait(TRAIT_HIGHKPA_TOLERANCE) > 220) + dat += "HP " + if ("temperature" in scanner) + if(seed.get_trait(TRAIT_HEAT_TOLERANCE) > 30) + dat += "TEMRES " + else if(seed.get_trait(TRAIT_HEAT_TOLERANCE) < 10) + dat += "TEMSEN " + if ("light" in scanner) + if(seed.get_trait(TRAIT_LIGHT_TOLERANCE) > 10) + dat += "LIGRES " + else if(seed.get_trait(TRAIT_LIGHT_TOLERANCE) < 3) + dat += "LIGSEN " + if(seed.get_trait(TRAIT_TOXINS_TOLERANCE) < 3) + dat += "TOXSEN " + else if(seed.get_trait(TRAIT_TOXINS_TOLERANCE) > 6) + dat += "TOXRES " + if(seed.get_trait(TRAIT_PEST_TOLERANCE) < 3) + dat += "PESTSEN " + else if(seed.get_trait(TRAIT_PEST_TOLERANCE) > 6) + dat += "PESTRES " + if(seed.get_trait(TRAIT_WEED_TOLERANCE) < 3) + dat += "WEEDSEN " + else if(seed.get_trait(TRAIT_WEED_TOLERANCE) > 6) + dat += "WEEDRES " + if(seed.get_trait(TRAIT_PARASITE)) + dat += "PAR " + if ("temperature" in scanner) + if(seed.get_trait(TRAIT_ALTER_TEMP) > 0) + dat += "TEMP+ " + if(seed.get_trait(TRAIT_ALTER_TEMP) < 0) + dat += "TEMP- " + if(seed.get_trait(TRAIT_BIOLUM)) + dat += "LUM " + dat += "" + dat += "[S.amount]" + dat += "Vend Purge" + dat += "" dat += "" user << browse(dat, "window=seedstorage") @@ -282,11 +448,11 @@ updateUsrDialog() /obj/machinery/seed_storage/attackby(var/obj/item/O as obj, var/mob/user as mob) - if (istype(O, /obj/item/seeds)) + if (istype(O, /obj/item/seeds) && !lockdown) add(O) user.visible_message("[user] puts \the [O.name] into \the [src].", "You put \the [O] into \the [src].") return - else if (istype(O, /obj/item/weapon/storage/bag/plants)) + else if (istype(O, /obj/item/weapon/storage/bag/plants) && !lockdown) var/obj/item/weapon/storage/P = O var/loaded = 0 for(var/obj/item/seeds/G in P.contents) @@ -301,8 +467,17 @@ playsound(loc, O.usesound, 50, 1) anchored = !anchored user << "You [anchored ? "wrench" : "unwrench"] \the [src]." + else if(istype(O, /obj/item/weapon/screwdriver)) + panel_open = !panel_open + to_chat(user, "You [panel_open ? "open" : "close"] the maintenance panel.") + playsound(src, O.usesound, 50, 1) + overlays.Cut() + if(panel_open) + overlays += image(icon, "[initial(icon_state)]-panel") + else if((istype(O, /obj/item/weapon/wirecutters) || istype(O, /obj/item/device/multitool)) && panel_open) + wires.Interact(user) -/obj/machinery/seed_storage/proc/add(var/obj/item/seeds/O as obj) +/obj/machinery/seed_storage/proc/add(var/obj/item/seeds/O as obj, var/contraband = 0) if (istype(O.loc, /mob)) var/mob/user = O.loc user.remove_from_mob(O) @@ -313,6 +488,17 @@ O.loc = src var/newID = 0 + if(contraband) + for (var/datum/seed_pile/N in piles_contra) + if (N.matches(O)) + ++N.amount + N.seeds += (O) + return + else if(N.ID >= newID) + newID = N.ID + 1 + piles_contra += new /datum/seed_pile(O, newID) + return + for (var/datum/seed_pile/N in piles) if (N.matches(O)) ++N.amount @@ -322,4 +508,5 @@ newID = N.ID + 1 piles += new /datum/seed_pile(O, newID) + return diff --git a/html/changelogs/Mechoid - Seedvendorhack.yml b/html/changelogs/Mechoid - Seedvendorhack.yml new file mode 100644 index 0000000000..e115c57fa8 --- /dev/null +++ b/html/changelogs/Mechoid - Seedvendorhack.yml @@ -0,0 +1,7 @@ + +author: Mechoid + +delete-after: True + +changes: + - rscadd: "Seed Storage Vendors are now hackable. Can choose from various lists of concerning plants." diff --git a/polaris.dme b/polaris.dme index f6f0390f1b..87c6cc081d 100644 --- a/polaris.dme +++ b/polaris.dme @@ -329,6 +329,7 @@ #include "code\datums\wires\particle_accelerator.dm" #include "code\datums\wires\radio.dm" #include "code\datums\wires\robot.dm" +#include "code\datums\wires\seedstorage.dm" #include "code\datums\wires\smartfridge.dm" #include "code\datums\wires\smes.dm" #include "code\datums\wires\suit_storage_unit.dm"