Question about preventing a dependency mod from deleting content

DarkAlzara

Chieftain
Joined
Jul 1, 2020
Messages
39
Hey all,

Another question here. So, I'm trying to use the Cree Okihtcitaw as a base for a unique unit in my mod. My mod itself relies on anno domini, which deletes the Type for the Okihtcitaw as shown below:

<Types>
<Delete Type="UNIT_CREE_OKIHTCITAW"/>
</Types>

If I comment this delete out (within the anno domini mod) and use the following insert in my own mod, everything works fine:

INSERT INTO CivilizationTraits
(CivilizationType, TraitType )
VALUES ('CIVILIZATION_NAERALITH_SCARTHIA', 'TRAIT_CIVILIZATION_UNIT_CREE_OKIHTCITAW' );

However, if I leave the anno domini mod as-is (without uncommenting the Type deletion) and try and re-insert the type, nothing works lol.

INSERT INTO Types
(Type, Kind )
VALUES ('UNIT_CREE_OKIHTCITAW', 'KIND_UNIT' );

I even tried all of this code below to restore the unit, but it doesn't seem to work! Any advice?







INSERT OR REPLACE INTO Types
(Type, Kind )
VALUES ('UNIT_CREE_OKIHTCITAW', 'KIND_UNIT' );

INSERT OR REPLACE INTO TypeTags
(Type, Tag )
VALUES ('UNIT_CREE_OKIHTCITAW', 'CLASS_RECON' ),
('UNIT_CREE_OKIHTCITAW', 'CLASS_CREE_OKIHTCITAW' );

INSERT OR REPLACE INTO Units
(UnitType,
BaseMoves,
Cost,
AdvisorType,
BaseSightRange,
ZoneOfControl,
Domain,
FormationClass,
Name,
Description,
PurchaseYield,
PromotionClass,
Combat,
TraitType)
VALUES ('UNIT_CREE_OKIHTCITAW',
3,
40,
'ADVISOR_CONQUEST',
2,
1,
'DOMAIN_LAND',
'FORMATION_CLASS_LAND_COMBAT',
'LOC_UNIT_CREE_OKIHTCITAW_NAME',
'LOC_UNIT_CREE_OKIHTCITAW_DESCRIPTION',
'YIELD_GOLD',
'PROMOTION_CLASS_RECON',
20,
'TRAIT_CIVILIZATION_UNIT_CREE_OKIHTCITAW');

INSERT OR REPLACE INTO UnitAiInfos
(UnitType, AiType )
VALUES ('UNIT_CREE_OKIHTCITAW', 'UNITAI_EXPLORE' ),
('UNIT_CREE_OKIHTCITAW', 'UNITTYPE_LAND_COMBAT' );

INSERT OR REPLACE INTO UnitUpgrades
(Unit, UpgradeUnit )
VALUES ('UNIT_CREE_OKIHTCITAW', 'UNIT_SKIRMISHER' );

INSERT OR REPLACE INTO UnitReplaces
(CivUniqueUnitType, ReplacesUnitType )
VALUES ('UNIT_CREE_OKIHTCITAW', 'UNIT_SCOUT' );

INSERT INTO CivilizationTraits
(CivilizationType, TraitType )
VALUES ('CIVILIZATION_NAERALITH_SCARTHIA', 'TRAIT_CIVILIZATION_UNIT_CREE_OKIHTCITAW' );
 
There are cascading deletes implemented in DB. When you delete something from Types, everything that references that type is deleted. Then other rows referencing those deleted are also deleted, and so on. That way the DB is always ok and constraints are met.
When you reenter something into Types is not enough, you would need to reinsert everything that was deleted.

i don’t think you can go around this issue without modifying anno domini mod.
 
Rob's Anno Domini removes the "Type" in an UpdateDatabase action that has a LoadOrder of "130"
If the code you are attempting does not have a LoadOrder greater than "130" for your UpdateDatabase action, then Rob's code is firing after anything you are doing in your mod.
Code:
    <UpdateDatabase id="AnnoInitialUpdates">
      <Properties>
        <LoadOrder>130</LoadOrder>
      </Properties>
      <File priority="20">AnnoDomini_RemoveData.xml</File>
      <File>Mods/Master Settings/Anno_Domini_Master_Settings.sql</File>
    </UpdateDatabase>
And this code would only work if the unit had already been deleted from the "Types" table
Code:
INSERT INTO Types
(Type, Kind )
VALUES ('UNIT_CREE_OKIHTCITAW', 'KIND_UNIT' );
Because it would cause a unique constraint error otherwise, and nothing further from within the same file would be implemented into the game.

And as @Infixo noted, if you try to re-add the unit into the game, you will need to "rebuild" everything related to it, because if Rob's mod deletes the "Type" then everything else everywhere else in the database related to that Type "cascades" and is removed also .

-------------------------------------------------------------------------------------

To be clear, making your mod depend on Anno Domini (or any other mod) does not in and of itself create an order by which Actions and their attending files load into the game database. Only LoadOrder values in Actions assert a guaranteed order of loading into the game database, and LoadOrder is implemented across all actions from all enabled mods. Actions with higher LoadOrder values load after those with lower LoadOrder values, regardless of which mods the Actions came from and regardless of Dependancy or Reference settings in any modinfo file(s).

When you do not provide a LoadOrder setting for an Action, the game uses a LoadOrder of 0 (zero).
 
Last edited:
Thanks both! The load order thing makes sense to me! But also, I didn't know that the foreign keys actually implemented cascading deletes in civ 6... damn lol!

Is there any way to modify a mod with a mod? lol. Like is there a neat way that I can modify anno domini using my mod without having to manually change the file? I'd like to be able to give my mod quickly and easily to my friends without having them make a bunch of changes manually to anno domini!
 
Also, what exactly is involved in rebuilding an entire unit? Like I tried above to insert all the things I thought that the unit needed. I shouldn't have to insert the art right? At least I hope not lol! Any advice on all the tables I will need to populate to re-introduce the unit?
 
Back
Top Bottom