Skip to content

Commit

Permalink
Genetics QoL + Nullifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Joker66613 committed Feb 29, 2024
1 parent 4f1e620 commit 75081c6
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 8 deletions.
2 changes: 1 addition & 1 deletion code/datums/dna.dm
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@

//Return the active mutation of a type if there is one
/datum/dna/proc/get_mutation(A)
for(var/datum/mutation/HM as() in mutations)
for(var/datum/mutation/HM in mutations)
if(HM.type == A)
return HM

Expand Down
19 changes: 19 additions & 0 deletions code/game/machinery/computer/dna_console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,25 @@
if(!HM)
return

// nullifier part
// this exists earlier before activator part because "activator" items doesn't work as nullifier because of inject() proc does
var/is_nullifier = text2num(params["is_nullifier"])
if(is_nullifier)
var/obj/item/dnainjector/I = new /obj/item/dnainjector(loc)
I.remove_mutations += HM.type // this should accept a typepath, not an actual type reference
I.name = "DNA nullifier"
I.desc = "Removes a specific mutation on injection."
I.icon_state = "dnanullifier"
I.base_icon_state = "dnanullifier"
// printing nullifiers a lot wouldn't be good, so it has some cooldown
if(scanner_operational())
I.damage_coeff = connected_scanner.damage_coeff
injectorready = world.time + INJECTOR_TIMEOUT * 3 * (1 - 0.1 * connected_scanner.precision_coeff)
else
injectorready = world.time + INJECTOR_TIMEOUT * 3
return


// Create a new DNA Injector and add the appropriate mutations to it
var/obj/item/dnainjector/activator/I = new /obj/item/dnainjector/activator(loc)
I.add_mutations += new HM.type(copymut = HM)
Expand Down
25 changes: 19 additions & 6 deletions code/game/objects/items/devices/scanners.dm
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,22 @@ GENE SCANNER
return
buffer = C.dna.mutation_index
to_chat(user, "<span class='notice'>Subject [C.name]'s DNA sequence has been saved to buffer.</span>")
if(LAZYLEN(buffer))
for(var/A in buffer)
to_chat(user, "<span class='notice'>[get_display_name(A)]</span>")
var/list/full_list_mutations = list()
for(var/each in buffer) // get inherent mutations first
full_list_mutations[each] = FALSE
for(var/datum/mutation/each_mutation in C.dna.mutations)
if(each_mutation.type in buffer) // active inherent mutation
full_list_mutations[each_mutation.type] = "Activated"
else // active artificial mutation
full_list_mutations[each_mutation.type] = "Injected"
for(var/datum/mutation/each_mutation in C.dna.temporary_mutations)
full_list_mutations[each_mutation.type] = "Temporary"

for(var/A in full_list_mutations)
to_chat(user, "\t<span class='notice'>[get_display_name(A)]</span>") // if you want to make the scanner tell which mutation is active, put "full_list_mutations[A]" to the second parameter of get_display_name() proc.
to_chat(user, "\t<span class='info'>Genetic Stability: [C.dna.stability]%.</span>")
if(C.has_status_effect(STATUS_EFFECT_LING_TRANSFORMATION))
to_chat(user, "\t<span class='info'>Subject's DNA appears to be in an unstable state.</span>")


/obj/item/sequence_scanner/proc/display_sequence(mob/living/user)
Expand Down Expand Up @@ -879,14 +892,14 @@ GENE SCANNER
icon_state = initial(icon_state)
ready = TRUE

/obj/item/sequence_scanner/proc/get_display_name(mutation)
/obj/item/sequence_scanner/proc/get_display_name(mutation, active_detail=FALSE)
var/datum/mutation/HM = GET_INITIALIZED_MUTATION(mutation)
if(!HM)
return "ERROR"
if(discovered[mutation])
return "[HM.name] ([HM.alias])"
return !active_detail ? "[HM.name] ([HM.alias])" : "<span class='green'>[HM.name] ([HM.alias]) - [active_detail]</span>"
else
return HM.alias
return !active_detail ? HM.alias : "<span class='green'>[HM.alias] - [active_detail]</span>"

/obj/item/extrapolator
name = "virus extrapolator"
Expand Down
5 changes: 4 additions & 1 deletion code/game/objects/items/dna_injector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
desc = "A cheap single use autoinjector that injects the user with DNA."
icon = 'icons/obj/syringe.dmi'
icon_state = "dnainjector"
base_icon_state = "dnainjector"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
throw_speed = 3
Expand All @@ -25,6 +26,7 @@
var/log_msg = "[key_name(user)] injected [key_name(M)] with the [name]"
for(var/HM in remove_mutations)
M.dna.remove_mutation(HM)
log_msg += "(mutation removal: [english_list(remove_mutations)])"
for(var/HM in add_mutations)
if(HM == RACEMUT)
message_admins("[ADMIN_LOOKUPFLW(user)] injected [key_name_admin(M)] with the [name] <span class='danger'>(MONKEY)</span>")
Expand Down Expand Up @@ -74,7 +76,7 @@
to_chat(user, "<span class='notice'>It appears that [target] does not have compatible DNA.</span>")

used = TRUE
icon_state = "dnainjector0"
icon_state = "[base_icon_state]0"
desc += " This one is spent, you better recycle it!"


Expand Down Expand Up @@ -480,6 +482,7 @@
name = "\improper DNA injector (Anti-Medieval)"
remove_mutations = list(MEDIEVAL)

// note: this is not functional. mutation is not added to temporary_mutation list - it becomes permanent.
/obj/item/dnainjector/timed
var/duration = 600

Expand Down
Binary file modified icons/obj/syringe.dmi
Binary file not shown.
12 changes: 12 additions & 0 deletions tgui/packages/tgui/interfaces/DnaConsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,18 @@ const MutationInfo = (props, context) => {
is_activator: 0,
source: mutation.Source,
})} />
<Button
icon="syringe"
disabled={!isInjectorReady || !mutation.Active}
content="Print Nullifier"
onClick={() =>
act('print_injector', {
mutref: mutation.ByondRef,
is_nullifier: 1,
source: mutation.Source,
})
}
/>
</Fragment>
)}
</Box>
Expand Down

0 comments on commit 75081c6

Please sign in to comment.