[units] vs [+units] tag

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
Smok
Posts: 53
Joined: June 14th, 2016, 11:52 am

[units] vs [+units] tag

Post by Smok »

Documetation (https://wiki.wesnoth.org/AddonStructure) says I should use [+ units] instead of [units] tag, becouse "it's very important", without giving clear reason. What is the difference? Additional question, will may sound stupid but I want make it clear: Why tags like [UNIT_TYPE] are subtags of [units]? Why they can not be called a top level like scenarios and eras? What design decision lays before this?
User avatar
The_Gnat
Posts: 2234
Joined: October 10th, 2016, 3:06 am
Contact:

Re: [units] vs [+units] tag

Post by The_Gnat »

Smok wrote:Documetation (https://wiki.wesnoth.org/AddonStructure) says I should use [+ units] instead of [units] tag, becouse "it's very important", without giving clear reason. What is the difference? Additional question, will may sound stupid but I want make it clear: Why tags like [UNIT_TYPE] are subtags of [units]? Why they can not be called a top level like scenarios and eras? What design decision lays before this?
For your first question it is [+units] is used to load your units files. For example you would put:

Code: Select all

[+units]
   {~add-ons/SOME_DIRECTORY/}
[/units]
In your add-on's main.cfg file this then would load all the [unit_type] [movetype] [race] tags in that folder (but not that folders sub directories).

Also [unit_type] are subtags of [units] because [unit_type] creates new units where [units] load units that are already created.

Hopefully this helps! :D

(note: i unfortunately am not super experienced at wml so if anyone has anything to add or if i made a mistake in this explanation please comment)
User avatar
James_The_Invisible
Posts: 543
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces
Contact:

Re: [units] vs [+units] tag

Post by James_The_Invisible »

[+tag] is used to append something to the last tag of that name. E. g. you can modify a unit created via a macro with this syntax. But in your case with [units] it is not really needed, it will work just fine without the + sign.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: [units] vs [+units] tag

Post by zookeeper »

Before, [units] wouldn't have worked because there could only be one [units] tag (which you'd have to append to using [+units]), but now apparently multiple [units] tags are recognized so you can just use [units].
Post Reply