Closed nvs closed 5 years ago
An alternative option is to simply leverage Wurst. Of course, this depends on the individual project.
This is no longer necessary. A higher level object definition library can be introduced, whose files can simply be included into the war3map.lua
if desired. That library does not need to be part of Map.
Basically, create corresponding Jass files for all object data. This would allow one to generate object data in Lua, and expose it to the Jass files. An example would be.
This would then produce the following Jass:
The reasoning behind a label is that the ability to automatically generate the object id could exist. It would be impossible to guess the id within a Jass file. Thus the need for a label to allow more consistent naming. The label would obviously be specific to each individual object. Clashes should probably raise an error. The prefix would be defined in the global configuration file.
As far as automatic generation of ids, consider looking at https://github.com/wurstscript/WurstStdlib2/blob/master/wurst/objediting/presets/ObjectIdGenerator.wurst. Of particular note is that heroes seem to expect an object id starting with a capitalized letter. Need to look into the details. If this is the case, a list of base objects that have the hero modification flag set by default can be included. Additionally, checking for the hero modification flag will need to be done regardless.
As far as why generation of Jass files is acceptable, any unused globals can simply be ignored when building the map script. Wurst already does this.
But, this may not even be needed. Native Lua support is rumored to be added with Reforged. In such a situation, the above behavior could be used as well. But new natives may be introduced also. This has not been officially announced, so I wouldn't place much stock in the idea yet.