Lua Plugins
Moongate can load gameplay extensions from a dedicated plugins/ directory without modifying the core moongate_data/scripts tree.
This first version is intentionally simple:
- plugins are Lua-only
- metadata lives in
plugin.lua - the entry script is
init.lua - plugins load after the core scripts
.reload_scriptsreloads core scripts and plugins together- no single-plugin unload or dependency graph exists yet
Plugin Layout
Each plugin lives under:
plugins/<plugin-id>/
plugin.lua
init.lua
Optional folders:
gumps/commands/ai/items/
Example:
plugins/helpplus/
plugin.lua
init.lua
gumps/
helpplus.lua
commands/
helpplus.lua
Manifest
plugin.lua must return a Lua table:
return {
id = "helpplus",
name = "Help Plus",
version = "0.1.0",
entry = "init.lua",
}
Required fields:
identry
If the manifest is invalid, or if another plugin already uses the same id, the plugin is skipped.
Namespaced Requires
Plugin modules use the namespace:
plugin.<plugin-id>.*
Examples:
local help_gump = require("plugin.helpplus.gumps.helpplus")
local help_command = require("plugin.helpplus.commands.helpplus")
This avoids collisions with core modules such as gumps.*, items.*, and ai.*.
Entry Script
init.lua is the plugin entry point. It should require the modules it needs and register behavior using the existing script APIs.
Example:
local help_gump = require("plugin.helpplus.gumps.helpplus")
command.register("helpplus", function(ctx)
if ctx.session_id ~= nil and ctx.character_id ~= nil then
help_gump.open(ctx.session_id, ctx.character_id)
end
end, {
description = "Open the Help Plus gump.",
minimum_account_type = "GameMaster"
})
Supported Extension Types
Plugins can officially register:
- GM commands
- custom gumps and gump callbacks
- event hook functions
- NPC behaviors / brains
- item scripts
They use the same Lua modules and game-facing APIs as core scripts.
Current Limitations
Not supported in v1:
- single-plugin unload
- per-plugin dependency ordering
- sandboxing or capability restrictions
- remote installation or version negotiation
Operational Note
Lua plugins live under the same centralized script watcher as the core script tree. Changing a plugin Lua file invalidates that file's compiled chunk, but there is still no single-plugin unload lifecycle or dependency-aware plugin reload.