Author Topic: problems uninstalling subcomponents with Require_Predicate  (Read 628 times)

Offline subtledoctor

  • Planewalker
  • *****
  • Posts: 131
problems uninstalling subcomponents with Require_Predicate
« on: February 20, 2022, 07:09:49 PM »
As the title says. I have something like this:

Code: [Select]
Component A

Component B1
Subcomponent B
Require_Predicate (Mod_Is_Installed ~theMod~ ~Component A~) ~necessary stuff~

Component B2
Subcomponent B
So my weidu.log might look like this:
  • Component A
  • Component B2
The problem is when I try to uninstall. I run the mod installer, tell it to uninstall Component A, and then, because the predicate for both subcomponents of Component B is not met, it does not offer me the chance to interact with it. But, neither does it uninstall the subcomponent. So B2 remains installed - at least, as far as Weidu is concerned, anyway - even though the requirement for it to be installed is not met.

With normal mod components, if I uninstall the first component, it will uninstall all subsequent components. Then because the requirement is not met for the later component, it will be skipped and will not be installed. Which is as it should be. For some reason, subcomponents do not seem to behave this way.

The only way I can seem to uninstall them is this:
- Uninstall Component A - this leaves Component B2 installed. Close the Terminal.
- Install Component A - now it is installed out of order, my weidu log looks like this:
  • Component B2
  • Component A
That should be impossible, but there it is. Anyway now it allows me to:
- Uninstall Component B2, then uninstall Component A.

This is annoying enough to test mods, but my real fear is that it will wreak havoc with players who are less adept at managing their mods. Right now I am resorting to removing all predicates and using them to wrap the entire Component B1/B2 in an ACTION_IF condition so that nothing will happen if the requirement is not met. But this means players will see it even if they shouldn't. Not ideal.

Any suggestions? Or thoughts about improving this behavior to be consistent with non-SUB components with Require_Predicate?

EDIT - on searching, I see that there has been some development in this area recently. Sounds like it is probably devilishly difficult and involves a lot of complex permutations. I guess the improvement that seems ideal here would be: when an earlier component is uninstalled, usually all later components get uninstalled too. Here, this subcomponent is somehow left installed when the earlier component gets uninstalled. If the subcomponent were uninstalled (not currently happening), then the predicate will prevent user interaction to reinstall it (this part is currently working) and all would be well. So maybe (?) it's an easy-ish fix.
« Last Edit: September 20, 2022, 02:03:03 PM by subtledoctor »

Offline subtledoctor

  • Planewalker
  • *****
  • Posts: 131
Re: problems uninstalling subcomponents with Require_Predicate
« Reply #1 on: February 22, 2022, 09:49:02 AM »
I've monkeyed around a bit more, and I have more info as well as an easy means to reproduce the problem.

It seems that if you uninstall the earlier component, it does uninstall the later component; the normal behavior for Weidu after this is to reinstall the later component if there is no further user input (the user presses 'Q' or 'N'). However the reinstallation of the later components should still be subject to any REQUIRE_PREDICATE clauses. So if they require the first component, or a marker file from it, they should not be reinstalled.

In the case of subcomponents, the first subcomponent behaves as expected. But the second subcomponent ignores its REQUIRE_PREDICATE conditions and reinstalls anyway. In other words the predicate conditions appropriately prevent the user from giving any input (the log says "SKIPPING etc."), but then in the absence of user input the subcomponent is reinstalled, and this reinstallation ignores the predicate conditions.

I've written up a little test mod that demonstrates this behavior. If you install component A and Subcomponent B1, then uninstallation works perfectly. If you install component A and subcomponent B2, then it goes awry.
« Last Edit: February 23, 2022, 10:16:20 AM by subtledoctor »

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: