# RF 4.55: feature request: load server modules from Lua scripts (`scripts\modules\*.lua`)
Game: RF 4.55 (Dragonborn), server v0.2.0, Windows build (stock gameserver.exe, SHA-256 96452fbd…).
Summary
The gameserver already has a module system, but every module has to be written in Go and compiled into
gameserver.exe. The server's Lua runtime can only declare dungeons. A server owner who wants a small server-side
feature (an autoloot, a boss alert, a system notice) has no way to add one without a new build.
I'd like gamemodule to also load modules written in Lua, through the gopher-lua runtime the server already
ships for dungeons.
What's there today (read from the v0.2.0 binary's Go symbols)
gommo/pkg/gamemodule.(*Set):Register,Settings,Commands,EnsureTables,Start,Stop,Run, withCommandSpecfor%commands. A module implementsKey,Settings,Requirements,Commands,EnsureTables,StartandStop.- The only module is
rfmodule/season. Nothing loads a module from disk. gommo/games/rfscript(gopher-lua) has one verb, the dungeon (declareDungeon,parseMission,parseSpawnList). Inside a run a script can spawn, morph, count kills and grant rewards, but it has no hooks outside a dungeon run.
Request
Let gamemodule load Lua modules from scripts\modules\*.lua:
- Lifecycle: the same as a Go module: a key, settings in
server_config,%commands with GM levels (gm.command_levels), tables, start and stop. - Events (a script registers handlers for these):
- player login and logout;
- monster spawned and killed (the killer, the monster, the map);
- player killed by a player (PvP);
- Chip War start, end and result;
- item dropped and looted;
- chat (each channel);
- auction listing;
- level up;
- enhance/upgrade result;
- a timer.
- Actions (what a handler can call):
- announce and system notice;
- mail;
- give an item or currency;
- apply a buff;
- warp.
- Safety: a module that fails validation is refused at load time, with the same checks and did-you-mean hints the dungeon scripts get, so a broken script can't take the server down.
What it would allow
Each of these is a small server-side feature that today needs a GoMMO build:
| Feature | Needs |
|---|---|
| Autoloot | monster killed, item dropped, give item |
| Global message, system notice | chat, timer, announce |
| Pit boss alert | monster killed / spawned, announce |
| New-player informer, staff presence | login, announce |
| Auction max price, cross-race auction | auction listing |
| PvP penalty | player killed |
| Cash regen, level bonus | timer, level up, give currency/item |
| Enhance notify | enhance result, announce |
| Chip War random/cash reward, bonus buff | Chip War events, give item/currency, buff |