Draft: Move actor IDs from numbers to UUID

Description and notes

This is an early draft. There is definitely still way more to do and likely many bugs to iron out. I just wanted to get this merge request started so that more eyes can be on it and people can let me know if I have done something stupid. This seems to work with new games, but the patch isn't done yet to support existing saves. I definitely need to split some of these changes into their own merge requests

I also messed something up with git and my branch is currently in conflict. I am currently using my laptop which isn't powerful enough to do a lot of the things I would like to do so fixing the problem will have to wait until I have my desktop available again (around 5-6 days from now)

Merge Checklist
  • I have read CONTRIBUTING.md
    • and
      • my code editor has
        • ESLint support enabled
        • TypeScript support enabled
        • some form of spell checker
          • We suggest using a spell checker compatible with cSpell if possible
      • my changes compile successfully and seem to work properly
      • I am using the simple compiler (simple-compiler.[bat or sh])
      • I am using the normal compiler (compile.[bat or sh])
      • this is my first merge request
      • the changes in this merge request comply with the coding style defined in CONTRIBUTING.md
Changes made
  • Many, many minor changes, type def additions, and fixes
  • JSZip type defs
  • IDs are now UUIDs or special strings. The valid IDs are defined by the FC.ID type def
  • There are now multiple types of IDs which are defined by the FC.IDType type def and the globalThis.IDType object
  • Special IDs are defined by the FC.IDHumanSpecial type def and the globalThis.SpecialIDs object
  • V.genePool and V.missingTable are now maps instead of objects
  • There is a map between legacy IDs and the new UUIDs. This should give us a little grace with our patching. This is handled by V.LegacyIDToUUID and V.UUIDToLegacyID
  • V.heroSlavesPurchased is now a set instead of an array
  • Trinkets now have type defs
  • addTrinket() has been rewritten and hasTrinket() has been added
  • Lays the base groundwork for animal <-> human sexual acts that are tracked to types of animals and/or unique animals
  • generateSlaveID() has been replaced with generateID()
  • Added IDisIDType() which returns true if a given FC.ID is valid for a given FC.IDType
  • Added IDToType() which returns a valid FC.IDType when given a valid FC.ID
  • Added IDisPC(), IDisPCOrElitist(), IDisSlave(), IDisMissingParent(), and IDisAnimal() which return true if the given FC.ID is of the correct type
  • Added convertIDType() which converts all references of a given FC.ID from its original FC.IDType to a new FC.IDType. It does this by recursively traveling V. While this is resource intensive, it does guarantee that all references of to that FC.ID get changed. This is mostly used for when a slave becomes a missing record
  • Added getByRef(), _lastLegacyID, and getRefIDForUUID(). While these don't need to exist I personally like the legacy numbers when debugging/cheating and we are already keeping a record of legacy numbers just in case. So I decided to make these functions to facilitate that. They haven't been connected to anything yet
  • All of the hero slaves have been given their own namespaced IDs
  • Hero slaves no longer get a unique ID assigned to them when they are aquired
  • Other changes I have forgotten to mention

Things left to do

  • image gen and indexDB testing and patching
  • rewrite NG+; Does NG+ even need to shift/change IDs at all?; Handle NG+ slave IDs (1200000+)
  • can we refactor default game variables so that they make more sense and there is no duplication among them? If we refactor them we can redo NG+ to ask about options that it is going to reset instead of just resetting them silently
  • Hero Slaves and App.Intro.cheatModeSlaves; We may want to make hero/cheat mode slaves get registered via a function. This will allow for custom slaves to be registered the same way
  • when new actors are added to any pool we need to update V.LegacyHumanIDToUUID and V.UUIDToLegacyHumanID
  • redo how IDs are displayed when Debug/Cheat mode is enabled
  • bought hero slave detection and conversion
  • patch to convert slave pools
  • patch to convert detached slaves
  • slave importing/exporting should no longer change or remove any IDs
  • code review (this is done by one or more people other than you)
  • final tests
  • let Pregmodder know that this is ready for merging
Edited by Frankly George

Merge request reports

Loading