-
Notifications
You must be signed in to change notification settings - Fork 2
Extensions
Extensions are "plug-and-play" components that expand or customize the game.
The files in an extension are as follows:
-
Required file containing the definition of the extension: its name, version, author, dependencies
-
Optional configuration options for your extension, default values and UI display information is defined here.
-
Optional configuration demands placed on dependencies.
-
Files containing locale information for translating UI options for users.
-
File containing the information to be displayed when a user clicks on your extension in the GUI.
-
Optional lua file containing, when present, at least the following:
return {
enable = function(self, config) end,
disable = function(self, config) end,
}
The function enable
is called when the main process is starting.
This function generally speaking runs available lua
functions, either provided by other extensions or provided by the framework itself.
Any (sub)folders are allowed
Plugins can have a resources folder containing AI, maps, graphics, sound files, etcetera.
Modules are the only type of extension that can modify game code.
Therefore, they have access to the functions specified in core.lua
, these are available when init.lua
is executed.
Because of this reason, modules can contain DLL files that help out with executing code (highly performant code).
Note that the enable
function in init.lua
should be responsible for setting up the link between the game and such a DLL.
The easiest way to achieve this is to have a luaopen_dllname
C function in the DLL that returns pointers to the DLL's functions.
From the lua side, the pointers to these functions can then be used to set up hooks, detours, etc.
The DLL thus depends on at least one library: the same lua
version as the modding framework. And the DLL can depend on the ucp.dll
itself for quick access to some functionalities.