Mod Example: New Event
This is a mod that shows how to add new events to the game that happen randomly. In this case, a new event is added that spawns a mysterious, large resource-rich asteroid.
About[edit | edit source]
This event spawns a large, resource rich asteroid that despawns after 15 minutes. The event itself is also terminated after 15 minutes, so that other events only happen after this event finished.
eventscheduler.luaExtension to the
eventscheduler.luascript, that tells the event scheduler about the event
mysteryasteroid.luaCore file that spawns the asteroid
mysteryasteroid.lua[edit | edit source]
Player script that spawns the asteroid. On initialization, starts a callback that, after 15 minutes, terminates the script again so that other events can start.
The spawned asteroid gets a
ComponentType.DeletionTimer component, that will delete the asteroid after 15 minutes.
On spawn, the script sends a message to every player in the sector that a mysterious asteroid appeared.
modinfo.lua[edit | edit source]
serverSideOnly = falseThis mod introduces a new Sector script, which the client has to know about. Also: Localization.
clientSideOnly = falseClient side only is impossible, since a new script is added to sectors, which is only possible on the server.
saveGameAltering = trueThe mod adds a new script
data/scripts/events/mysteryasteroid.luawhose path will be saved into the database. Once the mod is disabled, the script is no longer existant and the savegame will be slightly corrupted (not unplayable though).
Localization[edit | edit source]
data/localization/ folder you can find an example for a German localization of texts that appear in the mod.