Files
Bubberstation/code/game/objects/items/devices/scanners/sequence_scanner.dm
T
carlarctg 721fd30837 Heavily reworks and resprites first aid analyzers. (#76533)
## About The Pull Request

Heavily reworks and resprites first aid analyzers. They now display if
they're happy, sad, angry, or warning you! Also a 'pricking' animation.

First aid analyzers are now found in all basic and specialized medkits.
Toxin medkits get a new* disease analyzer. Miners get a miner-colored
one in their box.

Scanning yourself with a first aid analyzer will 'create a holo-image
with treatment instructions next to your wounds', doubling the speed of
treatment of scanned wounds!

Health analyzers now have a scanning sound, courtesy of CM.

Refactored some wound code to make treatment duration changes and
changes in the description of wounds easier.

Fixed a dummy parent feature of the health analyzer (Verbose mode)
showing up, uselessly, on the disease and first aid subtypes.

Surgical processors and slime scanners have recieved a similar resprite.
## Why It's Good For The Game

> Heavily reworks and resprites first aid analyzers. They now display if
they're happy, sad, angry, or warning you! Also a 'pricking' animation.

These things have long, long needed some sprite love. Displaying emotion
will make them have a lot more 'weight' to them, same with the prick.
The old, shitty spectrometer sprites have gone directly into the
dumpster.

> First aid analyzers are now found in all basic and specialized
medkits. Toxin medkits get a new* disease analyzer. Miners get a
miner-colored one in their box.

They have also needed some gameplay love! Placing them in these kits is
not going to be a massive game-changer when they were already easily
found around the station in emergency medkits, but it will fill up that
awkward empty slot.

> Scanning yourself with a first aid analyzer will 'create a holo-image
with treatment instructions next to your wounds', doubling the speed of
treatment of scanned wounds!

The biggest gameplay-impacting change in this PR, I *sincerely* believe
this is the perfect solution to first aid analyzers being completely
redundant with eyesight. This lets you/someone else scan your wounds to
speed up treatment, with a neat in-character reason for it -
'holo-images' appearing on your body, like penlights.

This will speed up wound treatment, but I believe that is for the best,
as currently treating wounds is so slow that half the time it's not
worth it (or more accurately, it doesn't feel worth it in comparison to
the effort you're putting in) and you're better off shrugging off minor
wounds. It will do so in a way that requires a modicum of effort, so
it's not just a flat buff across the land.

> Health analyzers and gene scanners now have a scanning sound, courtesy
of CM.

It's a neat sound that will make medbay feel more alive. First aid
analyzers get a beeboop instead.

> Surgical processors and slime scanners have recieved a similar
resprite.

IT'S SPRITE MANIA IN HERE
## Changelog
🆑
Carlarc, Weird Orb
image: Heavily reworks and resprites first aid analyzers. They now
display if they're happy, sad, angry, or warning you! Also a 'pricking'
animation.
add: First aid analyzers are now found in all basic and specialized
medkits. Toxin medkits get a new* disease analyzer. Miners get a
miner-colored one in their box.
balance: Scanning yourself with a first aid analyzer will 'create a
holo-image with treatment instructions next to your wounds', doubling
the speed of treatment of scanned wounds!
sound: Health analyzers and gene scanners now have a scanning sound,
courtesy of CM.
refactor: Refactored some wound code to make treatment duration changes
and changes in the description of wounds easier.
fix: Fixed a dummy parent feature of the health analyzer (Verbose mode)
showing up, uselessly, on the disease and first aid subtypes.
image: Surgical processors and slime scanners have recieved a similar
resprite.
/🆑

---------

Co-authored-by: Jacquerel <hnevard@gmail.com>
2023-07-07 23:19:55 +01:00

118 lines
4.2 KiB
Plaintext

/obj/item/sequence_scanner
name = "genetic sequence scanner"
icon = 'icons/obj/device.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."
flags_1 = CONDUCT_1
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)
var/list/discovered = list() //hit a dna console to update the scanners database
var/list/buffer
var/ready = TRUE
var/cooldown = 200
/obj/item/sequence_scanner/attack(mob/living/target, mob/living/carbon/human/user)
add_fingerprint(user)
//no scanning if its a husk or DNA-less Species
if (!HAS_TRAIT(target, TRAIT_GENELESS) && !HAS_TRAIT(target, TRAIT_BADDNA))
user.visible_message(span_notice("[user] analyzes [target]'s genetic sequence."))
balloon_alert(user, "sequence analyzed")
playsound(user.loc, 'sound/items/healthanalyzer.ogg', 50) // close enough
gene_scan(target, user)
else
user.visible_message(span_notice("[user] fails to analyze [target]'s genetic sequence."), span_warning("[target] has no readable genetic sequence!"))
/obj/item/sequence_scanner/attack_self(mob/user)
display_sequence(user)
/obj/item/sequence_scanner/attack_self_tk(mob/user)
return
/obj/item/sequence_scanner/afterattack(obj/object, mob/user, proximity)
. = ..()
if(!istype(object) || !proximity)
return
if(istype(object, /obj/machinery/computer/scan_consolenew))
var/obj/machinery/computer/scan_consolenew/console = object
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."))
/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/human/mutation in target.dna.mutations)
LAZYOR(buffer, 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)]"))
/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/human/human_mutation = GET_INITIALIZED_MUTATION(mutation)
if(!human_mutation)
return "ERROR"
if(mutation in discovered)
return "[human_mutation.name] ([human_mutation.alias])"
else
return human_mutation.alias