mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-20 10:37:17 +01:00
* TGUI upgrade project: Port initial TGUI 4.0 changes from TG (#23440) * tgui4.0 * bugfix for un-interaction * fix for input not resetting on close * NTOS restore * fix all interfaces having scrollbars, fix colours * bundle update * dep bumps * bumps the deps as much as possible * button regression fix * TGUI test map rev 1 * fix theme and some component regression * fix login screen regression * fixes regression with uplink cart * bundle * fix regressions * fix the input issue, again * regression fixes, stylesheet edition, hash restore * fixes GPS BSOD * draggable control regression * dev server dep regression * byondUI regression fix * section regression fix * fix secure storage weirdness * Fixed mining vendor scrolling * Arthri review pass 1 * mining vendor double-scroll * fix for RPD, AirAlarm, and Radio * arthri review pass 2 * arthri review pass 3 * sanitize var setting, fix colours, delete unused file * adds CI to branch * god damn AI making random changes * I should remember to compile when changes are made * fixes scrollbar issues * fix camera console, fix flexGrow for sections * CI fix * nanomap fix * Update code/modules/atmospherics/machinery/airalarm.dm * restore margin * style semicolon * TGUIv4 - Moves TGUI Window Sizing from DM to JS (#23524) * Initial commit * Transferring the remaining windows to JS * Resizing part 1 * Resizing part 2 * Some reverts and polish * Forgot that * undeployed nuke window size --------- Co-authored-by: Aylong <alexanderkitsa@gmail.com> * TGUIv4: Remove force_open (#23537) * First state fixes * Removes "force_open" * TGUIv4 - TGUI Version 4.1 (#23547) * Reduced Logging Changes * setSharedState early return for non-interactive UI * TGUI version bump to 4.1 * Fix sending updates for non-interactive UIs * Scalablue UI Stylesheet Changes * CSS Tgui Bundle * JavaScript TGUI Style Changes * Update tgui/packages/tgui/styles/base.scss Co-authored-by: Aylong <69762909+Aylong220@users.noreply.github.com> * Additional changes to Input and Button scalability * TGUI logging proc update * Indentation fix for logging proc * Update code/__HELPERS/_logging.dm Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> * Additional log_tgui changes --------- Co-authored-by: Aylong <69762909+Aylong220@users.noreply.github.com> Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> * dev server hotfix (#23584) * ui_interact object constructor argument check (#23594) * feat: add smart asset cache, add CDN support for assets, properly group assets (#23585) * feat: add smart asset cache, add CDN support for assets, properly group assets * fix: make tgui actually work * fix: keeping local name for `tgui.bundle.js` and `tgui.bundle.css` for debug and dev server functioning * fix: make `fontawesome` assets finally work * fix: make proper identation for `if` * fix: add `resolveAsset` to `NanoMap.js` * refactor: update `claw_game` and `chess` to new asset framework * refactor/tweak: don't use string concatenation for browser `content` and `head_content`, use list instead. Don't use `common.css` for paper UI, keep local name for stamp image assets, replace hard ref of browser to `atom` (rare case) to `UID` * refactor: remove redundant debug logs * refactor: remove space betwee `if` and `(` * refactor: remove one more redundant log, properly reload UI resources * rafactor: change names of asset files * fix: adjust existing UIs to properly use assets * fix: properly pass args to to `onclose` proc * Update code/modules/asset_cache/transports/asset_transport.dm Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> * Update code/modules/asset_cache/transports/asset_transport.dm Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> --------- Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> * TGUI 4.2: TGchat + Refactor Asset Delivery + Yarn Berry (#23643) * tgchat * Little cleanup * Refactor Asset Delivery (Part 2) * Little tweaks * fix code styling issues * fix file name duplications * Browser window options fix @gaxeer * transfer valve fixes * yarn berry initial * vsc tasks * yarn berry working * node 20 * fix dev server (lol wrong yarn) * bloody regressions * fixes that damn scrolltracking bug * Some tweaks and flexGrow deletions It still doesn't work as it should, which makes me nervous * remove unneeded deps * 514 regression fix * change stuff to not conflict with other servers * name it as requested --------- Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> * revert test_TGUI map addition * TGUI 4.3: Stack, Webpack 5 & UI Tweaks, Yarn 3.6.4, TS support, Jest (#23677) * Stack & UI's Refactor Almost final, polish required Stack & UI's Refactor (Part 1) Stack & UI's Refactor (Part 2) Stack & UI's Refactor (Part 3) * Prettier Maybe bad * ClearChat & some tweaks * Adds a Chat Reliability Layer https://github.com/tgstation/tgstation/pull/79479 * Fix chat BSOD https://github.com/tgstation/tgstation/pull/79821 * WebPack 5 (Didn't work) I hate this shit * Yarn 3.6.4 * make it all work * revert snowflake fix * Stories * adds TS support * re-enable test and prettier * update yarn sdk's * Fix some box regression * ping/reply * Fixes regressions and some things * Zebra and Fix chat button transfer +rebuild * make VSC use the proper local typescript lib * Popper Tooltips https://github.com/tgstation/tgstation/pull/58980 * Popper Tooltips performancy fixes * Dropdown v2 https://github.com/tgstation/tgstation/pull/75164 Without Icon.tsx * BB test map * run build --------- Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> * we moved these * change test values * ignore scss files * change hash function * TGUIv4: TGchat fix traitor codeword highlighting (#23720) * Codeword highlighting for TGUIv4 * null safeties * Apply suggestions from code review Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> --------- Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> * TGUIv4 - updates standalone build tooling (#23721) * swap `xxhash64` for `md4` * remove hash function * remove old file * TGUI 4.3+4.4: Newscaster fix, `inline-block` replacements and other fixes (#23722) * TGUI 4.3 fixes Newscaster fix + inline-blocks * Be gone Box * Mod Chat -> Mentor Chat * Some warning filters * Rebuild * Delete tgui-common.bundle.js * please work * try it like this * 4.3.1 * 4.3.2 * fix * i forgot to build * 4.4.0 * give me more diff details please so I can fix you * its not binary pls git * test without svgs * removes an un-needed SVG file * inlined SVGs test * fix code styling * comment these --------- Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> * TGUIv4 - Removes resizable and improves drag code (#23719) * Initial commit * bundle rebuild * Fixes Radio Sizing * Updates Radio sizing to fix wrapping issues * fix dev server --------- Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> * fix hotkeys not being passed to BYOND * Apply suggestions from code review * bump deps * forgot these deps * ci fix * ChemDispenser fixes and HoloControl cooldown * Station Traits TGUI +Rebuild * CI * fix CI for real this time * I have no idea * fix station trait panel * Update code/controllers/subsystem/SSping.dm Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> * Update code/controllers/subsystem/SSticker.dm Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> * Update code/controllers/subsystem/SSping.dm Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> * deterministic module IDs * TGUI fixes. Again... (#23762) * TGUI Fixes: Part 1 ORM icon for reinforced glass now showing correctly Mining vendor moved to Stack Exofab UI buttons descended from the heavens to the earth * TGUI Fixes: Part 2 DestTagger now works, forgot import LabeledList PowerMonitor graph displays correct Request Console updated to 2.0, BUT, problem with message priority, it was there before the changes, maybe even before the project, I'll have to check it out * TGUI Fixes: Part 2 Fixed `onEnter` input Fixed Cloning Console storage (Im dumbass) Some windows resizing Fixed bad picture in security and medical records console Fixed scrollable dropdown Added translucent color for buttons * Fucking uplink DONE, and Button.Input fix * NT Recruiter and Uplink polish * Del LabeledList from dest. tagger * ChemMaster and OreRedemption log deletion * Update test_tiny.dmm * Translucent button story * Filter for SQL error * del: `log_debug` in `hear_say.dm` * Some little fixes and SpecMenu Stack * Panel.js: mx -> mr * fix ghost spawners * null check --------- Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> * fix material name in protolathe * fix various UI interacts * card machine runtime fix * remove legacy folders * TGUIv4 - TGchat Theme Adjustments (#23772) * Initial commit * Changes rule grouping * Robot class style changes and webpack config * Reverts webpack/font changes and subs robot font * revert a state changed in error * fix uninteractable UIs due to chunky fingers * TGUIv4: More fixes, tweaks and fixes for tweaks (#23781) * I fuckin hate PDA * Vending * Add `|` to highlight splitters and some light mode tweaks * Teleporter rewrite * APC and AiAirlock (God forgive me) * clarify highlight syntax --------- Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> * TGUIv4 - Abductor Experiment Machine TGUI (#23776) * Experiment Console TGUI * Update for TGUIv4 * UI Size adjustment * ui state and ghost attack update * remove this --------- Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> * fix * TGUIv4 - Adjustments, Fixes, and Tweaks (#23785) * Photocopier layout adjustments * Autolathe Text and Button spacing adjustment * Hotkey fix for moving bug * Removes rule sets for visited links * Fixes ordering multiples on cargo console * fix possible wonky json payloads * fix admin log input list stuff * TGUIv4: Reconnect fix and some other fixes + tweaks (#23790) * Fix reconnecting and transfer it to TSX * RPD polish * RCD, AccessList, GuestPass * Focus reset fix when camera switched. God forgive me again... * Purple box and identation fixes For votes and health scanner * ChemMaster and ChemDispenser ChemMaster - translucent pills buttons and no grow produce section ChemDuspenser - dynamic height * ShuttleManipulator Tabs * RCD buttons * make input bar mode more prominent * fix chem master icons * tab fix * Properly sanitizes loaded messages in tgui chat * TGUIv4 - Adjustments, Fixes, and Tweaks v2 (#23795) * Fixes icon spacing for nanobank tabs * Tweaks Dropdown styling * Fixes sending stuff to old chat * OpenDream TGUI fix * Resizes Station Traits window * Adjusts health analyzer messages for chat tabs * Revert "Properly sanitizes loaded messages in tgui chat" This reverts commit4c32a7094a. * Revert "Revert "Properly sanitizes loaded messages in tgui chat"" This reverts commit24afa55922. * Changes how tgui handles static data * Reenable no-undef rule. Enable Format On Save for VSCode (#23803) * Enable Format On Save for VSCode * Re-enable and fix no-undef --------- Co-authored-by: Arthri <41360489+a@users.noreply.github.com> * pda scanner message improvements * fix mentor/admin PMs being sent to the "unsorted" category * fix garbled custom vote messages * moves cyborg analyser to use chatboxes * fixes regression * Prevent F5 reload * TGUIv4: Themes polish and some new ones + misc fixes (#23814) * Little themes tweaks * NTOS chat theme * Update tgui-panel.bundle.js * Capitalize themes * Paradise theme v1.0 * Little StationTraitsPanel cleanup * Update member_content.dmi * NoCapitalize * Rebuild * Delete Paradise.scss * Create paradise.scss * Forgot * Rewritten Security Records Console For Jesus fucking christ... * Vending and Wires sizes tweaks * ThermoMachine * Syndicate Theme * Little darker * Rewritten Medical Records Console * PDA Nanobank fix * Syndicate Theme Darker * Rebuild TGUI * Wires section grow fix * fixes the enshittified paradise icon * Sirryan+Warrior reviews * bloody define comments * comment correction * unprivate these * errant . begone (how did this not cause a compiler error) * TGUIv4 - Adjustments, Fixes, and Tweaks v3 (#23807) * Fixes ERT Manager silenced message function * Adjusts progress bar on ExosuitFabricator * Sets Dropdown selected to align left * Removes the use of self_state select interfaces * Exosuit Fabricator style adjustments * fix sextractor UI * remove empty tochat string * fix human air alarm interactions * fix modals * add F12/IEChooser --------- Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com> --------- Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Co-authored-by: Aylong <alexanderkitsa@gmail.com> Co-authored-by: Aylong <69762909+Aylong220@users.noreply.github.com> Co-authored-by: Gaxeer <44334376+Gaxeer@users.noreply.github.com> Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Co-authored-by: Arthri <41360489+Arthri@users.noreply.github.com> Co-authored-by: Arthri <41360489+a@users.noreply.github.com>
457 lines
13 KiB
Plaintext
457 lines
13 KiB
Plaintext
/obj/machinery/plantgenes
|
|
name = "plant DNA manipulator"
|
|
desc = "An advanced device designed to manipulate plant genetic makeup."
|
|
icon = 'icons/obj/hydroponics/equipment.dmi'
|
|
pass_flags = PASSTABLE
|
|
icon_state = "dnamod"
|
|
density = TRUE
|
|
anchored = TRUE
|
|
|
|
var/obj/item/seeds/seed
|
|
var/obj/item/disk/plantgene/disk
|
|
|
|
var/list/core_genes = list()
|
|
var/list/reagent_genes = list()
|
|
var/list/trait_genes = list()
|
|
|
|
var/datum/plant_gene/target
|
|
var/max_potency = 50 // See RefreshParts() for how these work
|
|
var/max_yield = 2
|
|
var/min_production = 12
|
|
var/max_endurance = 10 // IMPT: ALSO AFFECTS LIFESPAN
|
|
var/min_weed_chance = 67
|
|
var/min_weed_rate = 10
|
|
|
|
/obj/machinery/plantgenes/Initialize(mapload)
|
|
. = ..()
|
|
component_parts = list()
|
|
component_parts += new /obj/item/circuitboard/plantgenes(null)
|
|
component_parts += new /obj/item/stack/sheet/glass(null)
|
|
component_parts += new /obj/item/stock_parts/scanning_module(null)
|
|
component_parts += new /obj/item/stock_parts/micro_laser(null)
|
|
component_parts += new /obj/item/stock_parts/manipulator(null)
|
|
RefreshParts()
|
|
|
|
/obj/machinery/plantgenes/seedvault/Initialize(mapload)
|
|
. = ..()
|
|
component_parts = list()
|
|
component_parts += new /obj/item/circuitboard/plantgenes/vault(null)
|
|
component_parts += new /obj/item/stack/sheet/glass(null)
|
|
component_parts += new /obj/item/stock_parts/scanning_module(null)
|
|
component_parts += new /obj/item/stock_parts/micro_laser(null)
|
|
component_parts += new /obj/item/stock_parts/manipulator(null)
|
|
RefreshParts()
|
|
|
|
/obj/machinery/plantgenes/Destroy()
|
|
core_genes.Cut()
|
|
reagent_genes.Cut()
|
|
trait_genes.Cut()
|
|
target = null
|
|
QDEL_NULL(seed)
|
|
QDEL_NULL(disk)
|
|
return ..()
|
|
|
|
/obj/machinery/plantgenes/RefreshParts() // Comments represent the max you can set per tier, respectively. seeds.dm [219] clamps these for us but we don't want to mislead the viewer.
|
|
for(var/obj/item/stock_parts/manipulator/M in component_parts)
|
|
if(M.rating > 3)
|
|
max_potency = 95
|
|
else
|
|
max_potency = initial(max_potency) + (M.rating**3) // 51,58,77,95 Clamps at 100
|
|
|
|
max_yield = initial(max_yield) + (M.rating*2) // 4,6,8,10 Clamps at 10
|
|
|
|
for(var/obj/item/stock_parts/scanning_module/SM in component_parts)
|
|
if(SM.rating > 3) //If you create t5 parts I'm a step ahead mwahahaha!
|
|
min_production = 1
|
|
else
|
|
min_production = 12 - (SM.rating * 3) //9,6,3,1. Requires if to avoid going below clamp [1]
|
|
|
|
max_endurance = initial(max_endurance) + (SM.rating * 25) // 35,60,85,100 Clamps at 10min 100max
|
|
|
|
for(var/obj/item/stock_parts/micro_laser/ML in component_parts)
|
|
var/weed_rate_mod = ML.rating * 2.5
|
|
min_weed_rate = FLOOR(10-weed_rate_mod, 1) // 7,5,2,0 Clamps at 0 and 10 You want this low
|
|
min_weed_chance = 67-(ML.rating*16) // 48,35,19,3 Clamps at 0 and 67 You want this low
|
|
|
|
for(var/obj/item/circuitboard/plantgenes/vaultcheck in component_parts)
|
|
if(istype(vaultcheck, /obj/item/circuitboard/plantgenes/vault)) // TRAIT_DUMB BOTANY TUTS
|
|
max_potency = 100
|
|
max_yield = 10
|
|
min_production = 1
|
|
max_endurance = 100
|
|
min_weed_chance = 0
|
|
min_weed_rate = 0
|
|
|
|
/obj/machinery/plantgenes/update_icon_state()
|
|
if((stat & (BROKEN|NOPOWER)))
|
|
icon_state = "dnamod-off"
|
|
else
|
|
icon_state = "dnamod"
|
|
|
|
/obj/machinery/plantgenes/update_overlays()
|
|
. = ..()
|
|
if(seed)
|
|
. += "dnamod-dna"
|
|
if(panel_open)
|
|
. += "dnamod-open"
|
|
|
|
/obj/machinery/plantgenes/attackby(obj/item/I, mob/user, params)
|
|
if(default_deconstruction_screwdriver(user, "dnamod", "dnamod", I))
|
|
update_icon(UPDATE_OVERLAYS)
|
|
return
|
|
if(exchange_parts(user, I))
|
|
return
|
|
if(default_deconstruction_crowbar(user, I))
|
|
return
|
|
if(isrobot(user))
|
|
return
|
|
|
|
if(istype(I, /obj/item/seeds))
|
|
add_seed(I, user)
|
|
else if(istype(I, /obj/item/disk/plantgene))
|
|
add_disk(I, user)
|
|
else
|
|
return ..()
|
|
|
|
/obj/machinery/plantgenes/proc/add_seed(obj/item/seeds/new_seed, mob/user)
|
|
if(seed)
|
|
to_chat(user, "<span class='warning'>A sample is already loaded into the machine!</span>")
|
|
return
|
|
if(!user.drop_item())
|
|
return
|
|
insert_seed(new_seed)
|
|
to_chat(user, "<span class='notice'>You add [new_seed] to the machine.</span>")
|
|
ui_interact(user)
|
|
|
|
/obj/machinery/plantgenes/proc/add_disk(obj/item/disk/plantgene/new_disk, mob/user)
|
|
if(disk)
|
|
to_chat(user, "<span class='warning'>A data disk is already loaded into the machine!</span>")
|
|
return
|
|
if(!user.drop_item())
|
|
return
|
|
disk = new_disk
|
|
disk.forceMove(src)
|
|
to_chat(user, "<span class='notice'>You add [new_disk] to the machine.</span>")
|
|
ui_interact(user)
|
|
|
|
/obj/machinery/plantgenes/attack_hand(mob/user)
|
|
if(..())
|
|
return
|
|
ui_interact(user)
|
|
|
|
/obj/machinery/plantgenes/attack_ghost(mob/user)
|
|
ui_interact(user)
|
|
|
|
/obj/machinery/plantgenes/ui_state(mob/user)
|
|
return GLOB.default_state
|
|
|
|
/obj/machinery/plantgenes/ui_interact(mob/user, datum/tgui/ui = null)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "GeneModder", name)
|
|
ui.open()
|
|
|
|
/obj/machinery/plantgenes/ui_data(mob/user)
|
|
var/list/data = list()
|
|
|
|
data["has_seed"] = seed ? TRUE : FALSE
|
|
data["has_disk"] = disk ? TRUE : FALSE
|
|
|
|
data["core_genes"] = list()
|
|
data["reagent_genes"] = list()
|
|
data["trait_genes"] = list()
|
|
|
|
data["has_reagent"] = FALSE
|
|
data["has_trait"] = FALSE
|
|
|
|
data["seed"] = list()
|
|
|
|
if(seed)
|
|
data["seed"] = list(
|
|
"image" = "[icon2base64(icon(initial(seed.icon), initial(seed.icon_state), SOUTH, 1))]",
|
|
"name" = seed.name,
|
|
"variant" = seed.variant
|
|
)
|
|
|
|
for(var/datum/plant_gene/core/c_gene in core_genes)
|
|
var/list/seed_info = list(
|
|
"name" = c_gene.get_name(),
|
|
"id" = c_gene.UID(),
|
|
"is_type" = disk && istype(disk.gene, c_gene)
|
|
)
|
|
data["core_genes"] += list(seed_info)
|
|
// there will always be core genes, if there isnt, something has gone very wrong
|
|
|
|
for(var/datum/plant_gene/reagent/r_gene in reagent_genes)
|
|
var/list/seed_info = list(
|
|
"name" = r_gene.get_name(),
|
|
"id" = r_gene.UID()
|
|
)
|
|
data["reagent_genes"] += list(seed_info)
|
|
data["has_reagent"] = TRUE
|
|
|
|
for(var/datum/plant_gene/trait/t_gene in trait_genes)
|
|
var/list/seed_info = list(
|
|
"name" = t_gene.get_name(),
|
|
"id" = t_gene.UID()
|
|
)
|
|
data["trait_genes"] += list(seed_info)
|
|
data["has_trait"] = TRUE
|
|
|
|
data["disk"] = list()
|
|
|
|
if(disk)
|
|
var/disk_name = "Empty Disk"
|
|
if(disk.gene)
|
|
disk_name = disk.gene.get_name()
|
|
if(disk.read_only)
|
|
disk_name = "[disk_name] (Read Only)"
|
|
var/can_insert = FALSE
|
|
if(seed)
|
|
can_insert = disk.gene?.can_add(seed)
|
|
data["disk"] = list(
|
|
"name" = disk_name,
|
|
"can_insert" = can_insert,
|
|
"can_extract" = !disk.read_only,
|
|
"is_core" = istype(disk?.gene, /datum/plant_gene/core)
|
|
)
|
|
|
|
data["modal"] = ui_modal_data(src)
|
|
|
|
return data
|
|
|
|
/obj/machinery/plantgenes/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
if(..())
|
|
return
|
|
|
|
. = TRUE
|
|
|
|
// we dont care what we get from modal act, as long as its not null because we only have boolean modals
|
|
if(ui_modal_act(src, action, params))
|
|
return
|
|
|
|
var/mob/user = ui.user
|
|
|
|
target = seed?.get_gene(params["id"])
|
|
|
|
switch(action)
|
|
if("eject_seed")
|
|
if(seed)
|
|
seed.forceMove(loc)
|
|
user.put_in_hands(seed)
|
|
seed = null
|
|
update_genes()
|
|
update_icon(UPDATE_OVERLAYS)
|
|
else
|
|
var/obj/item/I = user.get_active_hand()
|
|
if(istype(I, /obj/item/seeds))
|
|
add_seed(I, user)
|
|
|
|
if("eject_disk")
|
|
if(disk)
|
|
disk.forceMove(loc)
|
|
user.put_in_hands(disk)
|
|
disk = null
|
|
update_genes()
|
|
else
|
|
var/obj/item/I = user.get_active_hand()
|
|
if(istype(I, /obj/item/disk/plantgene))
|
|
add_disk(I, user)
|
|
|
|
if("variant_name")
|
|
seed.variant_prompt(user, src)
|
|
// uses the default byond prompt, but it works
|
|
|
|
if("extract")
|
|
var/dat = "Are you sure you want to extract [target.get_name()] gene from the [seed]? The sample will be destroyed in process!"
|
|
if(istype(target, /datum/plant_gene/core))
|
|
var/datum/plant_gene/core/core_gene = target
|
|
var/genemod_var = core_gene.get_genemod_variable(src) // polymorphism my beloved
|
|
|
|
if((core_gene.use_max && core_gene.value < genemod_var) || (!core_gene.use_max && core_gene.value > genemod_var))
|
|
var/gene_name = lowertext(core_gene.name)
|
|
dat += " This device's extraction capabilities are currently limited to [genemod_var] [gene_name]. \
|
|
Target gene will be degraded to [genemod_var] [gene_name] on extraction."
|
|
|
|
ui_modal_boolean(src, action, dat, yes_text = "Extract", no_text = "Cancel", delegate = PROC_REF(gene_extract))
|
|
|
|
if("replace")
|
|
ui_modal_boolean(src, action, "Are you sure you want to replace [target.get_name()] gene with [disk.gene.get_name()]?", yes_text = "Replace", no_text = "Cancel", delegate = PROC_REF(gene_replace))
|
|
|
|
if("remove")
|
|
ui_modal_boolean(src, action, "Are you sure you want to remove [target.get_name()] gene from the [seed]" , yes_text = "Remove", no_text = "Cancel", delegate = PROC_REF(gene_remove))
|
|
|
|
if("insert")
|
|
if(!istype(disk.gene, /datum/plant_gene/core) && disk.gene.can_add(seed))
|
|
seed.genes += disk.gene.Copy()
|
|
if(istype(disk.gene, /datum/plant_gene/reagent))
|
|
seed.reagents_from_genes()
|
|
update_genes()
|
|
repaint_seed()
|
|
// this doesnt need a modal, its easy enough to just remove the inserted gene
|
|
|
|
|
|
/obj/machinery/plantgenes/proc/gene_remove()
|
|
if(istype(target, /datum/plant_gene/core))
|
|
return
|
|
seed.genes -= target
|
|
if(istype(target, /datum/plant_gene/reagent))
|
|
seed.reagents_from_genes()
|
|
repaint_seed()
|
|
update_genes()
|
|
target = null
|
|
|
|
/obj/machinery/plantgenes/proc/gene_extract()
|
|
if(!disk || disk.read_only)
|
|
return
|
|
disk.gene = target.Copy()
|
|
if(istype(disk.gene, /datum/plant_gene/core))
|
|
var/datum/plant_gene/core/core_gene = disk.gene
|
|
var/genemod_var = core_gene.get_genemod_variable(src)
|
|
if(core_gene.use_max)
|
|
core_gene.value = max(core_gene.value, genemod_var)
|
|
else
|
|
core_gene.value = min(core_gene.value, genemod_var)
|
|
|
|
disk.update_name()
|
|
QDEL_NULL(seed)
|
|
update_icon(UPDATE_OVERLAYS)
|
|
update_genes()
|
|
target = null
|
|
|
|
/obj/machinery/plantgenes/proc/gene_replace()
|
|
if(!disk?.gene)
|
|
return
|
|
if(!istype(target, /datum/plant_gene/core))
|
|
return
|
|
if(!istype(disk.gene, target.type))
|
|
return // you can't replace a endurance gene with a weed chance gene, etc
|
|
seed.genes -= target
|
|
var/datum/plant_gene/core/C = disk.gene.Copy()
|
|
seed.genes += C
|
|
C.apply_stat(seed)
|
|
repaint_seed()
|
|
update_genes()
|
|
target = null
|
|
|
|
/obj/machinery/plantgenes/proc/insert_seed(obj/item/seeds/S)
|
|
if(!istype(S) || seed)
|
|
return
|
|
S.forceMove(src)
|
|
seed = S
|
|
update_genes()
|
|
update_icon(UPDATE_OVERLAYS)
|
|
|
|
/obj/machinery/plantgenes/proc/update_genes()
|
|
core_genes = list()
|
|
reagent_genes = list()
|
|
trait_genes = list()
|
|
|
|
if(seed)
|
|
var/gene_paths = list(
|
|
/datum/plant_gene/core/potency,
|
|
/datum/plant_gene/core/yield,
|
|
/datum/plant_gene/core/production,
|
|
/datum/plant_gene/core/endurance,
|
|
/datum/plant_gene/core/lifespan,
|
|
/datum/plant_gene/core/weed_rate,
|
|
/datum/plant_gene/core/weed_chance
|
|
)
|
|
for(var/a in gene_paths)
|
|
core_genes += seed.get_gene(a)
|
|
|
|
for(var/datum/plant_gene/reagent/G in seed.genes)
|
|
reagent_genes += G
|
|
for(var/datum/plant_gene/trait/G in seed.genes)
|
|
trait_genes += G
|
|
|
|
/obj/machinery/plantgenes/proc/repaint_seed()
|
|
if(!seed)
|
|
return
|
|
if(copytext(seed.name, 1, 13) == "experimental")
|
|
return // Already modded name and icon
|
|
seed.name = "experimental " + seed.name
|
|
seed.icon_state = "seed-x"
|
|
|
|
/*
|
|
* Plant DNA disk
|
|
*/
|
|
|
|
/obj/item/disk/plantgene
|
|
name = "plant data disk"
|
|
desc = "A disk for storing plant genetic data."
|
|
icon_state = "datadisk_hydro"
|
|
materials = list(MAT_METAL=30, MAT_GLASS=10)
|
|
var/datum/plant_gene/gene
|
|
var/read_only = 0 //Well, it's still a floppy disk
|
|
|
|
/obj/item/disk/plantgene/New()
|
|
..()
|
|
update_icon(UPDATE_OVERLAYS)
|
|
|
|
/obj/item/disk/plantgene/Destroy()
|
|
QDEL_NULL(gene)
|
|
return ..()
|
|
|
|
/obj/item/disk/plantgene/attackby(obj/item/W, mob/user, params)
|
|
..()
|
|
if(is_pen(W))
|
|
rename_interactive(user, W)
|
|
|
|
/obj/item/disk/plantgene/update_name()
|
|
. = ..()
|
|
if(HAS_TRAIT(src, TRAIT_CMAGGED))
|
|
name = "nuclear authentication disk"
|
|
return
|
|
if(gene)
|
|
name = "[gene.get_name()] (Plant Data Disk)"
|
|
else
|
|
name = "plant data disk"
|
|
|
|
/obj/item/disk/plantgene/update_desc()
|
|
. = ..()
|
|
if(HAS_TRAIT(src, TRAIT_CMAGGED))
|
|
desc = "Better keep this safe."
|
|
return
|
|
|
|
desc = "A disk for storing plant genetic data."
|
|
|
|
/obj/item/disk/plantgene/update_icon_state()
|
|
. = ..()
|
|
if(HAS_TRAIT(src, TRAIT_CMAGGED))
|
|
icon_state = "nucleardisk"
|
|
return
|
|
|
|
icon_state = "datadisk_hydro"
|
|
|
|
/obj/item/disk/plantgene/update_overlays()
|
|
. = ..()
|
|
if(HAS_TRAIT(src, TRAIT_CMAGGED))
|
|
return
|
|
|
|
. += "datadisk_gene"
|
|
|
|
/obj/item/disk/plantgene/attack_self(mob/user)
|
|
if(HAS_TRAIT(src, TRAIT_CMAGGED))
|
|
return
|
|
read_only = !read_only
|
|
to_chat(user, "<span class='notice'>You flip the write-protect tab to [read_only ? "protected" : "unprotected"].</span>")
|
|
|
|
/obj/item/disk/plantgene/cmag_act(mob/user)
|
|
if(!HAS_TRAIT(src, TRAIT_CMAGGED))
|
|
to_chat(user, "<span class='warning'>The bananium ooze flips a couple bits on the plant disk's display, making it look just like the..!</span>")
|
|
ADD_TRAIT(src, TRAIT_CMAGGED, CLOWN_EMAG)
|
|
update_appearance(UPDATE_NAME|UPDATE_DESC|UPDATE_ICON)
|
|
playsound(src, "sparks", 75, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
|
|
|
|
/obj/item/disk/plantgene/uncmag()
|
|
update_appearance(UPDATE_NAME|UPDATE_DESC|UPDATE_ICON)
|
|
|
|
/obj/item/disk/plantgene/examine(mob/user)
|
|
. = ..()
|
|
if(!HAS_TRAIT(src, TRAIT_CMAGGED))
|
|
. += "The write-protect tab is set to [read_only ? "protected" : "unprotected"]."
|
|
return
|
|
if((user.mind.assigned_role == "Captain" || user.mind.special_role == SPECIAL_ROLE_NUKEOPS) && (user.Adjacent(src)))
|
|
. += "<span class='warning'>... Wait. This isn't the nuclear authentication disk! It's a clever forgery!</span>"
|