Skip to content

Commit

Permalink
tgui: DNA Console Overhaul Project (tgstation#50225)
Browse files Browse the repository at this point in the history
* Initial work on tgui conversion for DNA Consoles

* Some initial button logic complete

TODO: Scanner Open button should disable while scanner is locked
TODO: Scramble DNA should disable while on cooldown

* Tabs for the tab God

* Dropdown changes, genetic sequencer modifications

* Mutation and genetic sequencer functionality

Almost complete. Need to implement Advanced Injectors still.

* Mostly done, converted most of genetic makeup code

* Tactical pocket linting

* More changes

* Everything except advanced injectors complete

* First complete alpha version

* Fixed debug/testing change

* Removal of more debugging code

* Fix pulse bug

* Bugbusters

* Fix for accidental changes

* Fix broken genetics disk changes, fix list of lists

* Squash tgui tab-key bugs and clean up attackby

* Code documenting, refactoring, bugfixing, spellcheck

* Documentation and misc bug squashes and runtime error fixes

* Fixes, features and tweaks

* Special check for those who have shuffled off this mortal coil

* New interface concept for console storage

* Mini code refactor

* Massive refactoring of DnaConsole interface (WIP)

- De-spaghettifying of LawyerCode
- Fixed the flex-basis bug, and removed ForcedBox since it's no
longer needed.
- Added a Divider component.

* Implemented requested changes.

Removed list() versions of strings.
Removed used TGUI-exclusive constants from data object. Currently unused ones still remain, can be removed if they're no longer necessary.
Fixed other DM data structures to serialise as JS Arrays instead of Objects.
Minor TGUI logic fixes for various edge cases.
Added some comments in DnaConsole.js outlining some minor notes and TODOs.

* Fixes "Save to X" being disabled.

* Included 2px outline CSS

* Additional minor logic patches

Don't want certain buttons active unless the mutation relation to them is also active

* Makes these transforms use a timer

* Fixed transformation race condition and stuff.

* Mutation source defined in DM. Conditional formatting improvements.

* Custom cache directory with BYOND_CACHE env var

* Fix gene cycler on index of -1

* Framework and TODO for next interface element. Cleared TODO list a bit.

* Fix 1px shift in gene cycle buttons

* Pass raw event with GeneCycler

* More robust combining logic

* Fix some cycler bugs, start working on enzymes

* Conditional highlighting for unsolved mutations and X'd genes.

* Lint for the Lint God

* Enzyme UI and more refactoring incoming

* Finish tgui refactoring, enzymes injectors done

* Whack-a-Bug

* Unlinted. Advanced injectors moved and improved. Implemented disk genetic data readout.

* Partial linting

* Assorted bug fixes

* Remove debugging code

* DNA Consoles are now more conversational. Initial state set.

* Final tweaks, implemented mutation combining, complete?

* Fixes tooltop, re-enables delayed enzyme transfer, cleans up some data params

* 10 Fix a bug, 20 make a bug, 30 goto 10

* The definition of irony

* Don't drink and derive, kids || How I learned to stop coding while drunk and rely on stylemistake to Flex on my formatting.

* uniqBy

* Add support for dropdowns with disabilities.

* Cleanup

* Remove current mutation from combinations

* Dividing

* Document BYOND_CACHE env var

* Outline cleanup

* Declare radiation constants since they were removed in DM

* Combine mutations only after checking for null

* Advanced Injectors actually work now.

* Comment cleanup, DMDOC, stard and end processing at appropriate times

* Pressing Ctrl-S occasionally helps things

* Fix enzyme mutator timeout bug, added injector timeout display.

* Rebuild tgui

* Rebuild tgui

Co-authored-by: Aleksej Komarov <[email protected]>
Co-authored-by: spookydonut <[email protected]>
  • Loading branch information
3 people authored Apr 6, 2020
1 parent 1fd8692 commit bf60392
Show file tree
Hide file tree
Showing 37 changed files with 3,718 additions and 1,087 deletions.
4 changes: 2 additions & 2 deletions _maps/RandomZLevels/research.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@
/obj/structure/closet/crate,
/obj/item/disk/data{
desc = "A data disk used to store cloning and genetic records. The name on the label appears to be scratched off.";
fields = list("label" = "Buffer1:Kr-$$@##", "UI" = "f8f603857000f930127c4", "SE" = "414401462231053131010241514651403453121613263463440351136366", "UE" = "340008485c321e542aed4df7032ac04d", "name" = "Krystal Symers", "blood_type" = "A+");
genetic_makeup_buffer = list("label" = "Buffer1:Kr-$$@##", "UI" = "f8f603857000f930127c4", "SE" = "414401462231053131010241514651403453121613263463440351136366", "UE" = "340008485c321e542aed4df7032ac04d", "name" = "Krystal Symers", "blood_type" = "A+");
name = "dusty genetics data disk";
read_only = 1
},
Expand Down Expand Up @@ -1611,7 +1611,7 @@
/obj/structure/closet/crate,
/obj/item/disk/data{
desc = "A data disk used to store cloning and genetic records. The name on the label appears to be scratched off with the words 'DO NOT CLONE' hastily written over it.";
fields = list("label" = "Buffer1:George Melons", "UI" = "3c300f11b5421ca7014d8", "SE" = "430431205660551642142504334461413202111310233445620533134255", "UE" = "6893e6a0b0076a41897776b10cc2b324", "name" = "George Melons", "blood_type" = "B+");
genetic_makeup_buffer = list("label" = "Buffer1:George Melons", "UI" = "3c300f11b5421ca7014d8", "SE" = "430431205660551642142504334461413202111310233445620533134255", "UE" = "6893e6a0b0076a41897776b10cc2b324", "name" = "George Melons", "blood_type" = "B+");
name = "old genetics data disk"
},
/obj/item/disk/data{
Expand Down
15 changes: 14 additions & 1 deletion code/datums/dna.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
var/list/previous = list() //For temporary name/ui/ue/blood_type modifications
var/mob/living/holder
var/mutation_index[DNA_MUTATION_BLOCKS] //List of which mutations this carbon has and its assigned block
var/default_mutation_genes[DNA_MUTATION_BLOCKS] //List of the default genes from this mutation to allow DNA Scanner highlighting
var/stability = 100
var/scrambled = FALSE //Did we take something like mutagen? In that case we cant get our genes scanned to instantly cheese all the powers.

Expand Down Expand Up @@ -46,10 +47,12 @@
destination.dna.temporary_mutations = temporary_mutations.Copy()
if(transfer_SE)
destination.dna.mutation_index = mutation_index
destination.dna.default_mutation_genes = default_mutation_genes

/datum/dna/proc/copy_dna(datum/dna/new_dna)
new_dna.unique_enzymes = unique_enzymes
new_dna.mutation_index = mutation_index
new_dna.default_mutation_genes = default_mutation_genes
new_dna.uni_identity = uni_identity
new_dna.blood_type = blood_type
new_dna.features = features.Copy()
Expand Down Expand Up @@ -123,15 +126,18 @@
if(!LAZYLEN(mutations_temp))
return
mutation_index.Cut()
default_mutation_genes.Cut()
shuffle_inplace(mutations_temp)
if(ismonkey(holder))
mutations |= new RACEMUT(MUT_NORMAL)
mutation_index[RACEMUT] = GET_SEQUENCE(RACEMUT)
else
mutation_index[RACEMUT] = create_sequence(RACEMUT, FALSE)
default_mutation_genes[RACEMUT] = mutation_index[RACEMUT]
for(var/i in 2 to DNA_MUTATION_BLOCKS)
var/datum/mutation/human/M = mutations_temp[i]
mutation_index[M.type] = create_sequence(M.type, FALSE, M.difficulty)
default_mutation_genes[M.type] = mutation_index[M.type]
shuffle_inplace(mutation_index)

//Used to generate original gene sequences for every mutation
Expand Down Expand Up @@ -325,7 +331,7 @@
return dna


/mob/living/carbon/human/proc/hardset_dna(ui, list/mutation_index, newreal_name, newblood_type, datum/species/mrace, newfeatures, list/mutations, force_transfer_mutations)
/mob/living/carbon/human/proc/hardset_dna(ui, list/mutation_index, list/default_mutation_genes, newreal_name, newblood_type, datum/species/mrace, newfeatures, list/mutations, force_transfer_mutations)
//Do not use force_transfer_mutations for stuff like cloners without some precautions, otherwise some conditional mutations could break (timers, drill hat etc)
if(newfeatures)
dna.features = newfeatures
Expand All @@ -348,6 +354,10 @@

if(LAZYLEN(mutation_index))
dna.mutation_index = mutation_index.Copy()
if(LAZYLEN(default_mutation_genes))
dna.default_mutation_genes = default_mutation_genes.Copy()
else
dna.default_mutation_genes = mutation_index.Copy()
domutcheck()

if(mrace || newfeatures || ui)
Expand Down Expand Up @@ -440,8 +450,11 @@
. = TRUE
if(on)
mutation_index[HM.type] = GET_SEQUENCE(HM.type)
default_mutation_genes[HM.type] = mutation_index[HM.type]
else if(GET_SEQUENCE(HM.type) == mutation_index[HM.type])
mutation_index[HM.type] = create_sequence(HM.type, FALSE, HM.difficulty)
default_mutation_genes[HM.type] = mutation_index[HM.type]


/datum/dna/proc/activate_mutation(mutation) //note that this returns a boolean and not a new mob
if(!mutation)
Expand Down
18 changes: 9 additions & 9 deletions code/datums/mutations/_mutations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -176,23 +176,23 @@
power.panel = "Genetic"
owner.AddSpell(power)
return TRUE

// Runs through all the coefficients and uses this to determine which chromosomes the
// mutation can take. Stores these as text strings in a list.
/datum/mutation/human/proc/update_valid_chromosome_list()
valid_chrom_list.Cut()

if(can_chromosome == CHROMOSOME_NEVER)
valid_chrom_list += "none"
return
valid_chrom_list += "reinforcement"

valid_chrom_list += "Reinforcement"

if(stabilizer_coeff != -1)
valid_chrom_list += "stabilizer"
valid_chrom_list += "Stabilizer"
if(synchronizer_coeff != -1)
valid_chrom_list += "synchronizer"
valid_chrom_list += "Synchronizer"
if(power_coeff != -1)
valid_chrom_list += "power"
valid_chrom_list += "Power"
if(energy_coeff != -1)
valid_chrom_list += "energetic"
valid_chrom_list += "Energetic"
Loading

0 comments on commit bf60392

Please sign in to comment.