Add mods to a Don't Starve Together server
Have a Don't Starve Together server download Workshop mods with dedicated_server_mods_setup.lua, enable them in modoverrides.lua and set their options.
A Don't Starve Together dedicated server downloads its own Steam Workshop mods. Two files decide what it runs: one in the server's program folder says which mods to download, and one in each world's folder says which to turn on and with what settings.
Tell the server what to download
In the server's install folder, list each mod in mods/dedicated_server_mods_setup.lua by its Workshop ID, the id= at the end of its Workshop page address:
ServerModSetup("378160973")
ServerModSetup("376333686") At its next start the server queries the Workshop and downloads them; its log shows [Workshop] ModQuery queued to download IDs. With -ugc_directory on the launch line, the mods go to that folder.
Turn them on in each world
Each world (shard), the surface and the Caves, has its own modoverrides.lua in its folder of the cluster, for example Cluster_1/Master/modoverrides.lua:
return {
["workshop-378160973"] = {
enabled = true,
configuration_options = { SHOWPLAYERSOPTIONS = 2 },
},
["workshop-376333686"] = { enabled = true },
} Both worlds must run the same mods, so give the Caves the same file. The log shows Loading mod: workshop-378160973 (Global Positions) for each mod a world loads.
Mod settings
configuration_options holds a mod's settings. The names and allowed values are in the mod's own modinfo.lua, in its configuration_options list. A setting left out takes the mod's default.
What players need
A mod's modinfo.lua says whether everyone needs it: all_clients_require_mod = true means players' games fetch it from the Workshop to join. A mod marked client_only_mod = true runs only in a player's own game and does nothing on a server.
Mods from the server page
Search the Workshop on the Mods tab and add a mod; the mods it needs come with it. HostForge writes the download list and turns the server's mods on in modoverrides.lua at every start, keeping the settings you set there, and gives the Caves the same file. Edit modoverrides.lua on the Configuration files tab to change a mod's settings.
See setting up a Don't Starve Together server, and the Don't Starve Together server hosting page for plans.