I wanted to make everyone aware of some of the patch changes that will affect how your mods are structured so you can be ready with new versions when patch day hits. This isn't an exhaustive list, and I may be able to get a few new features in before we freeze the patch, but this should get you started.
- Hooked files are now concatenated together instead of loaded in to the same environment. This means you can access local variables from your mods. Note that the search path method of finding files has been replaced with a "mount" method, which is much cleaner and more versatile.
- You no longer need to rename your packed mods from zip to scd
- Locals are now available to all hooked mods. This also means you can't have two locals of the same name in the same scope. For example if you have
Code:
local oldModBlueprints = ModBlueprints
function ModBlueprints(all_bps)
oldModBlueprints(all_bps)
end
and another mod uses the same local name, they'll conflict. You can solve this by changing the scope of your mod by creating a new block with do and end:
Code:
do
local oldModBlueprints = ModBlueprints
function ModBlueprints(all_bps)
oldModBlueprints(all_bps)
end
end
- You shouldn't have a "mods" folder in your packed, the mod_info.lua and hooks should be at the root, as that's where
mods get mounted.
- All mods must have a uid field, which is a string. This uid should be unique for every mod (and every version of a mod.) Search the internet for "generate guid" to find some handy guid generators.
- The exclusive flag now works
- The before, after, conflicts and requires lists now work, they are based on the UID
- Mods may be put in to My Documents\My Games\Supreme Commander\mods
- An OpenURL(string) function has been added. This uses the ShellExecute command, so it will do whatever the appropriate behavior for the protocol is according to the shell registry setup. The only protocols we allow are: http, https, mailto, ventrillo, teamspeak, dapp, im. If you would like us to add a new protocol, you can post here and we'll consider it (with security in mind.) You can find the current list of acceptable protocols in SupComDataPath.lua.
- Some bad news: shadowing via the mod manager is unfortunately not going to be available in this patch. It requires some major changes to our file system that we were unable to complete in time for this patch. My goal is to have this in place for the next full integration patch.