Currently Online

Latest Posts

Topic: Order of addons

MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 20:06
Posts: 340
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2024-05-13, 09:54

I have made several dependent addons for the European tribe. Including Craft Addon, Food Addon, Terraforming Addon and Trading Addon. All these addons require the basic European tribe as I have not included all the basic definitions in each addon.

The problem now is that the addons in the manager are sometimes sorted before and sometimes after the main addon. The ones behind it function completely normally. Those in front of it are not, due to the dependencies. How is the order of the addons decided in the manager and how can I influence this as an addon developer?


My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 17:07
Posts: 2006
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2024-05-13, 16:20

That's what the "requires" key in the addon file is for. If the add-on "extended.wad" sets requires="base.wad", then Widelands will demand that if "extended.wad" is enabled, then "base.wad" must be enabled too and sort earlier in the list of add-ons than "extended.wad".


Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 20:06
Posts: 340
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2024-05-13, 17:43

Nordfriese wrote:

That's what the "requires" key in the addon file is for. If the add-on "extended.wad" sets requires="base.wad", then Widelands will demand that if "extended.wad" is enabled, then "base.wad" must be enabled too and sort earlier in the list of add-ons than "extended.wad".

It works for two (terraforming, trading) of them, but not for craft and food addon.


My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 20:06
Posts: 340
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: 2024-05-14, 13:24

Manuell sorting solved the problem.


My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote
SandJ
Avatar
Joined: 2015-05-08, 21:46
Posts: 9
OS: Linux
Ranking
Pry about Widelands
Posted at: 2024-09-25, 07:17

I am confused by what the wiki says on this.

Link: https://www.widelands.org/documentation/add-ons/#restrictions

"The order of add-ons matters. Add-ons can be reordered in the in-game add-ons manager. Enabled add-ons are executed from top to bottom. If, for example, you enable one add-on A that adds a new worker type that requires experience and below another add-on B that modifies all workers’ experience thresholds, the new worker’s experience is modified by B because B is loaded later than A. If B is listed above A, the new worker’s experience is not modified by B."

Should it say:

"...If, for example, you enable one add-on A that adds a new worker type that requires experience and above another add-on B that modifies all workers’ experience thresholds, the new worker’s experience is modified by B because B is loaded later than A..."

?


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 22:16
Posts: 2714
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2024-09-25, 08:53

the wik is correct. the addons are enabled from top to down.
so first addon A is enabled as it is above addon b and introduces the worker with experience X.
then Addon B below Addon A is enabled and Modifies the experience X to experince Y.


Top Quote
SandJ
Avatar
Joined: 2015-05-08, 21:46
Posts: 9
OS: Linux
Ranking
Pry about Widelands
Posted at: 2024-09-25, 20:33

hessenfarmer wrote:

the wik is correct. the addons are enabled from top to down.
so first addon A is enabled as it is above addon b and introduces the worker with experience X.
then Addon B below Addon A is enabled and Modifies the experience X to experince Y.

After much puzzlement, twice over, I see the cause of my confusion. The sentence is ambiguous.

I read it as:

  • If, for example, you enable one add-on A that adds a new worker type that requires experience and so it will appear below another add-on B that was already there that modifies all workers’ experience thresholds, the new worker’s experience is modified by B because B is loaded later than A.

which makes no sense, rather than:

  • If, for example, you enable one add-on A that adds a new worker type that requires experience and below that one you add another add-on B that modifies all workers’ experience thresholds, the new worker’s experience is modified by B because B is loaded later than A.

It's one of those cases where if you know what it is trying to say, you will read it to say what you expect, but a newbie can misinterpret it. Perhaps better wording might be:

  • If, for example, you have one add-on A that adds a new worker type that requires experience and then add another add-on B that modifies all workers’ experience thresholds, the new worker’s experience is modified by B because B is loaded later than A. If B is listed above A, the new worker’s experience is not modified by B.

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 19:48
Posts: 2497
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2024-09-26, 07:01

Because add-ons can modify widelands a lot, can this just be generalized?

The order of add-ons matters. Enabled add-ons are executed from top to bottom, so each add-on which is executed later will overwrite settings form an earlier executed add-on. Therefor add-ons can be reordered in the in-game add-ons manager.


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote