Methods for interacting with TweakDB, the game's internal data store.

TweakDB is like the game’s database for gameplay features. It’s not actually code itself, but very large amounts of data structures, many of which link together, to make coherent gameplay elements.

TweakDB has two main elements: Flats, and Records Flats are just like a single piece of data, like a number, a string, a pointer to a record, etc. Records are like a collection of flats. Records have possible types, like a character record or a clothing record. The type of record determines what set of flats the record has.

An example of these gameplay features nearly entirely contained in TweakDB, would be the damaging quickhacks like Overheat, Contagion, and Short Circuit. The quickhack item to unlock them is in tweakdb, as well as the process of unlocking, making them show up on enemies, the uploading process, the status effect applied, all the special effects possible, as well as the stats to customize all of these things. Almost anything about these quickhacks can be changed in TweakDB.

To transform a TweakDBID into a gameItemID, call ItemId.FromTDBID(tbdID)


Print info about the TweakDB. Displays the number of flats, records, and queries, the size in bytes of flatDataBuffer, and the number of created records.


TweakDB:DebugStats() -> nil

Usage example


GameItemIdTo get a TweakDBId's human-readable record name rather than its hash, use id.value!


Get a TweakDB record by name or ID.


TweakDB:GetRecord(recordName: string) -> TweakDBRecord
TweakDB:GetRecord(recordID: TweakDBID) -> TweakDBRecord

Usage example

sticky_frag = TweakDB:GetRecord("Items.GrenadeFragSticky")


Get a table of all TweakDB records under a given type.


TweakDB:GetRecords(recordTypeName: string) -> table<TweakDBRecord>

Usage example

grenades = TweakDB:GetRecords("gamedataGrenade_Record")


Get a TweakDB query by name or ID. Returns a table of TweakDBIDs.


TweakDB:Query(queryName: string) -> table<TweakDBID>
TweakDB:Query(queryID: TweakDBID) -> table<TweakDBID>

Usage example

grenade_ids = TweakDB:Query("Query.GrenadeNoFaction")


Get a TweakDB flat by name or ID.


TweakDB:GetFlat(flatName: string) -> object
TweakDB:GetFlat(flatID: TweakDBID) -> object

Usage example

jump_stamina_cost = TweakDB:GetFlat("player.staminaCosts.jump")


Set a TweakDB flat by name or ID and update it. Returns whether the flat was successfully set.


TweakDB:SetFlat(flatName: string, newValue: object) -> boolean
TweakDB:SetFlat(flatID: TweakDBID, newValue: object) -> boolean

Usage example

success = TweakDB:SetFlat("player.staminaCosts.jump", 7.5)


Set a TweakDB flat by name or ID without updating it. Returns whether the flat was successfully set.


TweakDB:SetFlatNoUpdate(flatName: string, newValue: object) -> boolean
TweakDB:SetFlatNoUpdate(flatName: TweakDBID, newValue: object) -> boolean

Usage example

success = TweakDB:SetFlatNoUpdate("player.staminaCosts.jump", 7.5)


Update (flush data of) a TweakDB record by name, ID, or handle. Returns whether the update was successful.


TweakDB:Update(recordName: string) -> boolean
TweakDB:Update(recordID: TweakDBID) -> boolean
TweakDB:Update(recordHandle: TweakDBRecord) -> boolean

Usage example

success = TweakDB:Update("player.staminaCosts.jump")


Create a new TweakDB record. Returns whether the record was created successfully.


TweakDB:CreateRecord(recordName: string, recordTypeName: string) -> boolean
TweakDB:CreateRecord(recordID: TweakDBID, recordTypeName: string) -> boolean


Clone an existing record identified by clonedRecordName or clonedRecordID to a new record named recordName or with a TweakDBID of recordID. Returns whether the record was cloned successfully. If a record named recordName or with ID recordID already exists, this method will fail.


TweakDB:CloneRecord(recordName: string, clonedRecordName: string) -> boolean
TweakDB:CloneRecord(recordName: string, clonedRecordID: TweakDBID) -> boolean
TweakDB:CloneRecord(recordID: TweakDBID,  clonedRecordName: string) -> boolean
TweakDB:CloneRecord(recordID: TweakDBID,  clonedRecordID: TweakDBID) -> boolean


Delete an existing TweakDB record. Returns whether the record was deleted successfully.


TweakDB:DeleteRecord(recordName: string) -> boolean
TweakDB:DeleteRecord(recordID: TweakDBID) -> boolean

Last updated