-
Notifications
You must be signed in to change notification settings - Fork 92
AddIfNotThere ModOp #28
Comments
This old issue has become relevant again today - as we found out, mods from different creators are incompatible because of doubled nodes which Anno expects to be unique. The problem is adding the same unique node with different Child Nodes from two mods. In our case
Which in the end results in:
Anno always uses the last one, which means only BuildingReplacements from the mod that was loaded last will be applied ingame, which can result in serious trouble with the Ai. What I would prefer for full manual control is having a CheckPath seperate from Path. If CheckPath returns null, the content of the ModOp gets added in the specified Path. That way, all mods adding BuildingReplacements could use this structure:
Optional: We could have an Argument to negate CheckPath Results to not add stuff if CheckPath returns zero. |
Yea, I am currently looking into adding this. As for having certain setup steps separate, I am currently also investigating a mod description format where you can specify dependencies, that will also ensure a certain load order without having to rely on the name with the alphabetical loading like it is right now (that should have been something from the start, but oh well) |
https://github.com/taubenangriff/Modinfo I am planning to include ModDependencies in the modinfo files that will be added in the next spice it up update, in case you want to use those. |
ah, this request is similiar to mine, while my suggested "merge_add" is superior, if it is possible to implement: |
Do you guys think thank having some separate condition attrs or nodes could be more useful/flexible, as I proposed in discord? IfPathExists/ IfPathNotExists/ IfGuidExists/ IfGuidNotExists
In particular, Alternatively, maybe we could introduce a more extensible system with
This also could make it very interoperable with this mod config issue, if we had for example some kind of setting value check for conditional operator execution. Edit: Looking at the structure of the XmlOperations class, maybe it could be easier to extend the current Ops with a new type like
|
I face this issue with build menus. I add buildings to the menu and place a fallback add in case there's a mod messing up the build menu (e.g. replacing townhall with a townhall menu). I can solve the issue with "not()" in XPath, but it has its flaws: Option 1: Two ModOps, either of them will work. The other produces a warning. <ModOp Type="addNextSibling" GUID='500944,25000191' Path="/Values/ConstructionCategory/BuildingList/Item[Building='100415']">
<Item>
<Building>1500010021</Building>
</Item>
</ModOp>
<ModOp Type="addNextSibling" GUID='500944,25000191' Path="/Values/ConstructionCategory/BuildingList[not(Item[Building='1500010021'])]/Item[last()]">
<Item>
<Building>1500010021</Building>
</Item>
</ModOp> Option 2: Use XPath or-statement. But that doesn't work with speculative lookup, hence takes 150ms+ per ModOp. <ModOp Type="addNextSibling" Path="//Asset[Values/Standard/GUID='500944' or Values/Standard/GUID='25000191']/Values/ConstructionCategory/BuildingList/Item[Building='100415'] | //Asset[Values/Standard/GUID='500944' or Values/Standard/GUID='25000191']/Values/ConstructionCategory/BuildingList[not(Item[Building='100415'])]/Item[last()]">
<Item>
<Building>1500010021</Building>
</Item>
</ModOp> I'd be super happy if we can suppress warnings for ModOps where we expect a node not to be found (and maybe also suppressing non-speculative fallback in that case). It would also cover a lot of addIfNotThere use cases. Nevertheless, allowing or-statements for speculative look up would be also great. |
Add with two fallbacks, fast GUID lookup and no warnings (1st fallback is before, 2nd fallback is at the end)!
|
should exactly work like an add, but with a precheck if the added content is already there on the same level, in which case it does not add it.
Useful for making mods modular with building menu.
Example:
Mod A and Mod B should insert Buildings into the modded category 9000.
For no dependency between both mods the building category 9000 needs to be created and set up, and also added to the construction menu in both.
Problem is, if I add the category to the construction menu in both mods, it appears twice. But I only want to add it once even though both mods add buildings to the category 9000.
The text was updated successfully, but these errors were encountered: