Jump to content
Toggle menu
  • 64 articles
  • 37 files
  • 9 users
  • 4.6K edits
Shroudforge
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Modding with Lua: Difference between revisions

From Shroudforge
Create English ShroudForge Wiki article
 
Marked this version for translation
Line 10: Line 10:
<translate>
<translate>


<!--T:1-->
ShroudForge loads each Lua mod as an independent package. A package uses <code>mod.json</code> for its identity, requested capabilities, and process targets. Its <code>src/mod.lua</code> contains the mod logic. An optional <code>extended.mod.json</code> declares player-facing settings, action buttons, and links.
ShroudForge loads each Lua mod as an independent package. A package uses <code>mod.json</code> for its identity, requested capabilities, and process targets. Its <code>src/mod.lua</code> contains the mod logic. An optional <code>extended.mod.json</code> declares player-facing settings, action buttons, and links.


== Start with a working package ==
== Start with a working package == <!--T:2-->


<!--T:3-->
Follow [[Build your first mod]] to create the package folders, write a minimal manifest, and confirm that ShroudForge can find the mod. Read [[mod.json]] before requesting capabilities. Ask for only what the mod needs and explain why it needs it.
Follow [[Build your first mod]] to create the package folders, write a minimal manifest, and confirm that ShroudForge can find the mod. Read [[mod.json]] before requesting capabilities. Ask for only what the mod needs and explain why it needs it.


== Choose the process that owns the behavior ==
== Choose the process that owns the behavior == <!--T:4-->


<!--T:5-->
A mod's target determines which Enshrouded process loads its code. A client mod runs on that player's game. A server-targeted mod runs on the Dedicated Server or the host process. Target selection does not synchronize client changes or grant server authority. A feature that changes shared world state must execute in the process that owns that state.
A mod's target determines which Enshrouded process loads its code. A client mod runs on that player's game. A server-targeted mod runs on the Dedicated Server or the host process. Target selection does not synchronize client changes or grant server authority. A feature that changes shared world state must execute in the process that owns that state.


<!--T:6-->
Install a multiplayer mod in every process required by its design and package declaration. Read [[Quickstart: Shroudforge]] and the mod's own installation notes before changing a server installation.
Install a multiplayer mod in every process required by its design and package declaration. Read [[Quickstart: Shroudforge]] and the mod's own installation notes before changing a server installation.


== Add settings and diagnose loading ==
== Add settings and diagnose loading == <!--T:7-->


<!--T:8-->
Declare player-facing values in [[extended.mod.json]]. Give each setting a stable key, a useful label, a safe starting value, and limits that match the behavior. Keep Modloader preferences separate from settings owned by an individual mod.
Declare player-facing values in [[extended.mod.json]]. Give each setting a stable key, a useful label, a safe starting value, and limits that match the behavior. Keep Modloader preferences separate from settings owned by an individual mod.


<!--T:9-->
Open the ShroudForge Mods window with <kbd>F9</kbd>. Use <kbd>F10</kbd> to read loader and mod messages. If a mod does not appear, check its folder, manifest, targets, dependencies, and declared capabilities. Some changes need a game restart. The manifest and settings articles explain those conditions.
Open the ShroudForge Mods window with <kbd>F9</kbd>. Use <kbd>F10</kbd> to read loader and mod messages. If a mod does not appear, check its folder, manifest, targets, dependencies, and declared capabilities. Some changes need a game restart. The manifest and settings articles explain those conditions.


== Look up exact Lua functions separately ==
== Look up exact Lua functions separately == <!--T:10-->


<!--T:11-->
This article explains the package and runtime concepts. The complete searchable Lua, native, game-type, and resource reference remains on the [https://bonsaibauer.github.io/shroudforge/en/#api ShroudForge API reference]. Its function signatures and support data are maintained there. The Wiki does not copy its API-symbol pages.
This article explains the package and runtime concepts. The complete searchable Lua, native, game-type, and resource reference remains on the [https://bonsaibauer.github.io/shroudforge/en/#api ShroudForge API reference]. Its function signatures and support data are maintained there. The Wiki does not copy its API-symbol pages.



Revision as of 00:15, 18 November 2026


ShroudForge loads each Lua mod as an independent package. A package uses mod.json for its identity, requested capabilities, and process targets. Its src/mod.lua contains the mod logic. An optional extended.mod.json declares player-facing settings, action buttons, and links.

Start with a working package

Follow Build your first mod to create the package folders, write a minimal manifest, and confirm that ShroudForge can find the mod. Read mod.json before requesting capabilities. Ask for only what the mod needs and explain why it needs it.

Choose the process that owns the behavior

A mod's target determines which Enshrouded process loads its code. A client mod runs on that player's game. A server-targeted mod runs on the Dedicated Server or the host process. Target selection does not synchronize client changes or grant server authority. A feature that changes shared world state must execute in the process that owns that state.

Install a multiplayer mod in every process required by its design and package declaration. Read Quickstart: Shroudforge and the mod's own installation notes before changing a server installation.

Add settings and diagnose loading

Declare player-facing values in extended.mod.json. Give each setting a stable key, a useful label, a safe starting value, and limits that match the behavior. Keep Modloader preferences separate from settings owned by an individual mod.

Open the ShroudForge Mods window with F9. Use F10 to read loader and mod messages. If a mod does not appear, check its folder, manifest, targets, dependencies, and declared capabilities. Some changes need a game restart. The manifest and settings articles explain those conditions.

Look up exact Lua functions separately

This article explains the package and runtime concepts. The complete searchable Lua, native, game-type, and resource reference remains on the ShroudForge API reference. Its function signatures and support data are maintained there. The Wiki does not copy its API-symbol pages.