The ModController can perform operations on DataTables which help when modding. Allowing you to make changes in a DataTable without having to modify the DataTable directly. This is essential as it allows multiple mods to make changes to the same DataTable rather than mods trying to overwrite it.
See here for a run-down of how ModControllers work Mod Controller basics
The following functions can be called in the Mod Data Table Operations function of a ModController blueprint.
Remove entries from a datatable with the corresponding row names.
Remove all entries from a datatable
This will Merge a DataTable into another DataTable. Both DataTables must have the same row struct. Any rows in the ToBeAddedDataTable that exist in the MergeIntoDataTable will be overwritten. Any which do not exist will be added.
If you want to add new recipes, items, feats or work with any other table, you will need to make a new table of the same type. This new data-table will then (by the power of the mod-controller) be merged into the basegame table and give access to all of your entries.
This will Merge a DataTable into another DataTable using a control table. The control table can be used to specify which Columns of the Datatable should be merged, it can also be used to specify different rules based on the RowName.
When merging each row of the ToBeAddedDataTable the row name will be looked for in the Control Table, if it does not exist we will use the MergeControl_Default row to specify which columns. If the default row does not exist it will simply merge normally.
Usage :
First we start by creating the DataTable we want to be added, as we would for the normal Merge Data Tables . Next we create a DataTable with the row struct Data Table Merge Control Row . This will be our Control Table which determines the rules of how the merge will happen.
Next we add a row to our Control Table, with the name “ MergeControl_Default “, this will be what we use to merge if we have not specified a particular row. If we want our ToBeAddedDataTable to use the same rule for every entry, we only need this default row. In this case we can simply add to the array ColumnsToOverride with the names of the columns which we want to be merged. Then every entry will only have those columns merged.
If we have a particular row in our ToBeAddedDataTable where we want different columns to the default we provided, we create a new row in the Control Table with the row name matching, this way we can add custom rules per row. This combination means we can specifiy for each row which column will be merged into the data table.
For example : We want to merge into DT_MonsterXP , but we only want to merge the Difficulty column for all the rows in our table. Except for the Alpha_Elephant row, where we also want to merge the XP column and the Alpha_Snake where we only want to merge the XP column not the Difficulty . The Merge Control Table would look like :
By doing it this way we maintain compatibility with other mods which might edit the XP of rows we have changed the difficulty for.
The Data Table Merge Control Row now has two new columns which can be used for array manipulation. This allows to insert or remove from arrays, rather than completely overriding the entry.
By adding the Column name to ColumnsWithRowsToInsert it will insert all elements into the target array, and by using ColumnsWithRowsToRemove it will remove all matching elements in the target array. For example if we wanted to add a IconLayer to each row we’re merging, and remove some ItemTags , we can setup the table as so :