mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-20 19:44:46 +01:00
Seed Vendors are hackable.
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
/datum/wires/seedstorage
|
||||
holder_type = /obj/machinery/seed_storage
|
||||
wire_count = 4
|
||||
random = 1
|
||||
|
||||
var/const/SEED_WIRE_SMART = 1
|
||||
var/const/SEED_WIRE_CONTRABAND = 2
|
||||
var/const/SEED_WIRE_ELECTRIFY = 4
|
||||
var/const/SEED_WIRE_LOCKDOWN = 8
|
||||
|
||||
/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
|
||||
. += ..()
|
||||
. += "<BR>The orange light is [V.seconds_electrified ? "off" : "on"].<BR>"
|
||||
. += "The red light is [V.smart ? "off" : "blinking"].<BR>"
|
||||
. += "The green light is [(V.hacked || V.emagged) ? "on" : "off"].<BR>"
|
||||
. += "The keypad lock is [V.lockdown ? "deployed" : "retracted"].<BR>"
|
||||
|
||||
/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)
|
||||
@@ -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 = "<center><h1>Seed storage contents</h1></center>"
|
||||
@@ -248,6 +325,95 @@
|
||||
dat += "<td>[S.amount]</td>"
|
||||
dat += "<td><a href='byond://?src=\ref[src];task=vend;id=[S.ID]'>Vend</a> <a href='byond://?src=\ref[src];task=purge;id=[S.ID]'>Purge</a></td>"
|
||||
dat += "</tr>"
|
||||
if(hacked || emagged)
|
||||
for (var/datum/seed_pile/S in piles_contra)
|
||||
var/datum/seed/seed = S.seed_type
|
||||
if(!seed)
|
||||
continue
|
||||
dat += "<tr>"
|
||||
dat += "<td>[seed.seed_name]</td>"
|
||||
dat += "<td>#[seed.uid]</td>"
|
||||
if ("stats" in scanner)
|
||||
dat += "<td>[seed.get_trait(TRAIT_ENDURANCE)]</td><td>[seed.get_trait(TRAIT_YIELD)]</td><td>[seed.get_trait(TRAIT_MATURATION)]</td><td>[seed.get_trait(TRAIT_PRODUCTION)]</td><td>[seed.get_trait(TRAIT_POTENCY)]</td>"
|
||||
if(seed.get_trait(TRAIT_HARVEST_REPEAT))
|
||||
dat += "<td>Multiple</td>"
|
||||
else
|
||||
dat += "<td>Single</td>"
|
||||
if ("temperature" in scanner)
|
||||
dat += "<td>[seed.get_trait(TRAIT_IDEAL_HEAT)] K</td>"
|
||||
if ("light" in scanner)
|
||||
dat += "<td>[seed.get_trait(TRAIT_IDEAL_LIGHT)] L</td>"
|
||||
if ("soil" in scanner)
|
||||
if(seed.get_trait(TRAIT_REQUIRES_NUTRIENTS))
|
||||
if(seed.get_trait(TRAIT_NUTRIENT_CONSUMPTION) < 0.05)
|
||||
dat += "<td>Low</td>"
|
||||
else if(seed.get_trait(TRAIT_NUTRIENT_CONSUMPTION) > 0.2)
|
||||
dat += "<td>High</td>"
|
||||
else
|
||||
dat += "<td>Norm</td>"
|
||||
else
|
||||
dat += "<td>No</td>"
|
||||
if(seed.get_trait(TRAIT_REQUIRES_WATER))
|
||||
if(seed.get_trait(TRAIT_WATER_CONSUMPTION) < 1)
|
||||
dat += "<td>Low</td>"
|
||||
else if(seed.get_trait(TRAIT_WATER_CONSUMPTION) > 5)
|
||||
dat += "<td>High</td>"
|
||||
else
|
||||
dat += "<td>Norm</td>"
|
||||
else
|
||||
dat += "<td>No</td>"
|
||||
|
||||
dat += "<td>"
|
||||
switch(seed.get_trait(TRAIT_CARNIVOROUS))
|
||||
if(1)
|
||||
dat += "CARN "
|
||||
if(2)
|
||||
dat += "<font color='red'>CARN </font>"
|
||||
switch(seed.get_trait(TRAIT_SPREAD))
|
||||
if(1)
|
||||
dat += "VINE "
|
||||
if(2)
|
||||
dat += "<font color='red'>VINE </font>"
|
||||
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 += "</td>"
|
||||
dat += "<td>[S.amount]</td>"
|
||||
dat += "<td><a href='byond://?src=\ref[src];task=vend;id=[S.ID]'>Vend</a> <a href='byond://?src=\ref[src];task=purge;id=[S.ID]'>Purge</a></td>"
|
||||
dat += "</tr>"
|
||||
dat += "</table>"
|
||||
|
||||
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
|
||||
|
||||
@@ -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."
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user