mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 06:00:16 +01:00
## About The Pull Request In similar fashion to what was done with crafting recipes last year, this year it's time for techweb designs and printed items to be audited. This is mostly just about consistency, we've a lot of items that can be printed by protolathes, autolathes, circuit printers and techfab etc. However they almost all (except most stacks, mainly) have custom materials that do not match in one way or another with the materials used by the design, which is what this PR is for. "But items printed from lathes etc. already get the mats used to make them." Yes, they do, however that isn't the case for items of the same type that were spawned in some other way (cargo shuttle, space/maints loot, mapped, admins), this create a subtle discrepancy. It isn't a huge deal (in spite of the size of this PR, ton of designs), but given that I have done something similar with crafting recipes before, I may as well give it a second arc of some sort and bring things to completion. And fix a few possible oversights. TL;DR consistency and stuff ## Why It's Good For The Game Consistency, unit test checks to make it harder not to be consistent in the future. Still has a few TODOs like: - [x] Fixed newly printed, fully charged RCDs costing less than the RCD cartridges required to fully charge one. EDIT: I had to tweak the newly added RDD as well because it suffered from the same fundamental issue. - [x] Fixed plates being made of iron and yet shattering like ceramic ones. A new subtype for metallic ones has been made. ## Changelog 🆑 refactor: Refactored a few things with techweb designs (the ones for autolathes, protolathes, circuit printers, mechfabs etc.) to make sure that the materials of items that can be made from these designs more closely match the materials used to make them. fix: Lizard fries no longer need a plate to be made, like all other treats that used to require plates in a distant past. balance: Tweaked the materials cost of RCD, RDD and RCD cartridges. image: Oven trays now have a more metallic hue. balance: Plates printed printed from lathes won't shatter like ceramic ones, in virtue of them being made out of iron instead. /🆑
172 lines
6.8 KiB
Plaintext
172 lines
6.8 KiB
Plaintext
/obj/item/sequence_scanner
|
|
name = "genetic sequence scanner"
|
|
icon = 'icons/obj/devices/scanner.dmi'
|
|
icon_state = "gene"
|
|
inhand_icon_state = "healthanalyzer"
|
|
worn_icon_state = "healthanalyzer"
|
|
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
|
|
desc = "A hand-held scanner for analyzing someones gene sequence on the fly. Use on a DNA console to update the internal database."
|
|
obj_flags = CONDUCTS_ELECTRICITY
|
|
item_flags = NOBLUDGEON
|
|
slot_flags = ITEM_SLOT_BELT
|
|
throwforce = 3
|
|
w_class = WEIGHT_CLASS_TINY
|
|
throw_speed = 3
|
|
throw_range = 7
|
|
custom_materials = list(/datum/material/iron=SMALL_MATERIAL_AMOUNT*2)
|
|
sound_vary = TRUE
|
|
pickup_sound = SFX_GENERIC_DEVICE_PICKUP
|
|
drop_sound = SFX_GENERIC_DEVICE_DROP
|
|
custom_materials = list(/datum/material/iron = HALF_SHEET_MATERIAL_AMOUNT, /datum/material/glass = HALF_SHEET_MATERIAL_AMOUNT)
|
|
|
|
var/list/discovered = list() //hit a dna console to update the scanners database
|
|
var/list/buffer
|
|
var/ready = TRUE
|
|
var/cooldown = (20 SECONDS)
|
|
/// genetic makeup data that's scanned
|
|
var/list/genetic_makeup_buffer = list()
|
|
|
|
/obj/item/sequence_scanner/examine(mob/user)
|
|
. = ..()
|
|
. += span_notice("Use primary attack to scan mutations, Secondary attack to scan genetic makeup")
|
|
if(LAZYLEN(genetic_makeup_buffer) > 0)
|
|
. += span_notice("It has the genetic makeup of \"[genetic_makeup_buffer["name"]]\" stored inside its buffer")
|
|
|
|
/obj/item/sequence_scanner/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
|
|
if(istype(interacting_with, /obj/machinery/computer/dna_console))
|
|
var/obj/machinery/computer/dna_console/console = interacting_with
|
|
if(console.stored_research)
|
|
to_chat(user, span_notice("[name] linked to central research database."))
|
|
discovered = console.stored_research.discovered_mutations
|
|
else
|
|
to_chat(user,span_warning("No database to update from."))
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
if(!isliving(interacting_with))
|
|
return NONE
|
|
|
|
add_fingerprint(user)
|
|
|
|
//no scanning if its a husk or DNA-less Species
|
|
if (!HAS_TRAIT(interacting_with, TRAIT_GENELESS) && !HAS_TRAIT(interacting_with, TRAIT_BADDNA))
|
|
user.visible_message(span_notice("[user] analyzes [interacting_with]'s genetic sequence."))
|
|
balloon_alert(user, "sequence analyzed")
|
|
playsound(user, 'sound/items/healthanalyzer.ogg', 50) // close enough
|
|
gene_scan(interacting_with, user)
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
user.visible_message(span_notice("[user] fails to analyze [interacting_with]'s genetic sequence."), span_warning("[interacting_with] has no readable genetic sequence!"))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
/obj/item/sequence_scanner/interact_with_atom_secondary(atom/interacting_with, mob/living/user, list/modifiers)
|
|
if(istype(interacting_with, /obj/machinery/computer/dna_console))
|
|
var/obj/machinery/computer/dna_console/console = interacting_with
|
|
var/buffer_index = tgui_input_number(user, "Slot:", "Which slot to export:", 1, LAZYLEN(console.genetic_makeup_buffer), 1)
|
|
console.genetic_makeup_buffer[buffer_index] = genetic_makeup_buffer
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
if(!isliving(interacting_with))
|
|
return NONE
|
|
|
|
add_fingerprint(user)
|
|
|
|
//no scanning if its a husk, DNA-less Species or DNA that isn't able to be copied by a changeling/disease
|
|
if (!HAS_TRAIT(interacting_with, TRAIT_GENELESS) && !HAS_TRAIT(interacting_with, TRAIT_BADDNA) && !HAS_TRAIT(interacting_with, TRAIT_NO_DNA_COPY))
|
|
user.visible_message(span_warning("[user] is scanning [interacting_with]'s genetic makeup."))
|
|
if(!do_after(user, 3 SECONDS, interacting_with))
|
|
balloon_alert(user, "scan failed!")
|
|
user.visible_message(span_warning("[user] fails to scan [interacting_with]'s genetic makeup."))
|
|
return ITEM_INTERACT_BLOCKING
|
|
makeup_scan(interacting_with, user)
|
|
balloon_alert(user, "makeup scanned")
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
user.visible_message(span_notice("[user] fails to analyze [interacting_with]'s genetic makeup."), span_warning("[interacting_with] has no readable genetic makeup!"))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
/obj/item/sequence_scanner/attack_self(mob/user)
|
|
display_sequence(user)
|
|
|
|
/obj/item/sequence_scanner/attack_self_tk(mob/user)
|
|
return
|
|
|
|
///proc for scanning someone's mutations
|
|
/obj/item/sequence_scanner/proc/gene_scan(mob/living/carbon/target, mob/living/user)
|
|
if(!iscarbon(target) || !target.has_dna())
|
|
return
|
|
|
|
//add target mutations to list as well as extra mutations.
|
|
//dupe list as scanner could modify target data
|
|
buffer = LAZYLISTDUPLICATE(target.dna.mutation_index)
|
|
var/list/active_mutations = list()
|
|
for(var/datum/mutation/mutation in target.dna.mutations)
|
|
LAZYSET(buffer, mutation.type, GET_SEQUENCE(mutation.type))
|
|
active_mutations.Add(mutation.type)
|
|
|
|
to_chat(user, span_notice("Subject [target.name]'s DNA sequence has been saved to buffer."))
|
|
for(var/mutation in buffer)
|
|
//highlight activated mutations
|
|
if(LAZYFIND(active_mutations, mutation))
|
|
to_chat(user, span_boldnotice("[get_display_name(mutation)]"))
|
|
else
|
|
to_chat(user, span_notice("[get_display_name(mutation)]"))
|
|
|
|
///proc for scanning someone's genetic makeup
|
|
/obj/item/sequence_scanner/proc/makeup_scan(mob/living/carbon/target, mob/living/user)
|
|
if(!iscarbon(target) || !target.has_dna())
|
|
return
|
|
|
|
genetic_makeup_buffer = list(
|
|
"label"="Analyzer Slot:[target.real_name]",
|
|
"UI"=target.dna.unique_identity,
|
|
"UE"=target.dna.unique_enzymes,
|
|
"UF"=target.dna.unique_features,
|
|
"name"=target.real_name,
|
|
"blood_type"=target.get_bloodtype())
|
|
|
|
/obj/item/sequence_scanner/proc/display_sequence(mob/living/user)
|
|
if(!LAZYLEN(buffer) || !ready)
|
|
return
|
|
var/list/options = list()
|
|
for(var/mutation in buffer)
|
|
options += get_display_name(mutation)
|
|
|
|
var/answer = tgui_input_list(user, "Analyze Potential", "Sequence Analyzer", sort_list(options))
|
|
if(isnull(answer))
|
|
return
|
|
if(!ready || !user.can_perform_action(src, NEED_LITERACY|NEED_LIGHT|FORBID_TELEKINESIS_REACH))
|
|
return
|
|
|
|
var/sequence
|
|
for(var/mutation in buffer) //this physically hurts but i dont know what anything else short of an assoc list
|
|
if(get_display_name(mutation) == answer)
|
|
sequence = buffer[mutation]
|
|
break
|
|
|
|
if(sequence)
|
|
var/display
|
|
for(var/i in 0 to length_char(sequence) / DNA_MUTATION_BLOCKS-1)
|
|
if(i)
|
|
display += "-"
|
|
display += copytext_char(sequence, 1 + i*DNA_MUTATION_BLOCKS, DNA_MUTATION_BLOCKS*(1+i) + 1)
|
|
|
|
to_chat(user, "[span_boldnotice("[display]")]<br>")
|
|
|
|
ready = FALSE
|
|
icon_state = "[icon_state]_recharging"
|
|
addtimer(CALLBACK(src, PROC_REF(recharge)), cooldown, TIMER_UNIQUE)
|
|
|
|
/obj/item/sequence_scanner/proc/recharge()
|
|
icon_state = initial(icon_state)
|
|
ready = TRUE
|
|
|
|
/obj/item/sequence_scanner/proc/get_display_name(mutation)
|
|
var/datum/mutation/mutation_instance = GET_INITIALIZED_MUTATION(mutation)
|
|
if(!mutation_instance)
|
|
return "ERROR"
|
|
if(mutation in discovered)
|
|
return "[mutation_instance.name] ([mutation_instance.alias])"
|
|
else
|
|
return mutation_instance.alias
|