2021-2-15 更新

文件目录:

 Master
    modoverrides.lua # mod配置
    server.ini # 服务器信息
    server_log.txt # 服务器日志
 Caves
    modoverrides.lua # mod配置
    server.ini # 服务器信息
    server_log.txt # 服务器日志
    worldgenoverride.lua  # 世界配置文件
 cluster.ini     # 服务器信息
 adminlist.txt   # 管理员列表
 whitelist.txt   # 白名单
 blocklist.txt   # 黑名单
 cluster_token.txt   # 开服必备token文件

安装mod

在安装mod的时候为了方便,可以批量安装客户端上边订阅好的,这就需要知道mod对应的创意工坊ID

打开mod文件夹,新建一个文本文档,并将名字改为list.bat,然后编辑该文档,输入以下内容:

@echo off
dir /B > list.txt

然后保存并双击执行该命令,就会得到一个list.txt文本文档,里边就包含了mod的ID,接着用Emeditor打开文档,并用Ctrl+H,分别替换以下内容:

workshop-    替换为     ServerModSetup("
$            替换为            ")              #此处开启正则

然后就得到如下一个完美的mod安装指令:

ServerModSetup("345692228")
ServerModSetup("347079953")
ServerModSetup("351325790")
ServerModSetup("354533909")
ServerModSetup("356930882")
ServerModSetup("358749986")
ServerModSetup("359479220")
ServerModSetup("362175979")
ServerModSetup("367546858")
ServerModSetup("370373189")
ServerModSetup("375850593")
ServerModSetup("375859599")
ServerModSetup("376333686")
...

然后将所有内容拷贝到服务器上的dedicated_server_mods_setup.lua里边,然后执行启动就可以自动下载mod了。

dedicated_server_mods_setup.lua文件备份:

--There are two functions that will install mods, ServerModSetup and ServerModCollectionSetup. Put the calls to the functions in this file and they will be executed on boot.

--ServerModSetup takes a string of a specific mod's Workshop id. It will download and install the mod to your mod directory on boot.
    --The Workshop id can be found at the end of the url to the mod's Workshop page.
    --Example: http://steamcommunity.com/sharedfiles/filedetails/?id=350811795
    --ServerModSetup("350811795")
    ServerModSetup("1079538195")
    ServerModSetup("1207269058")
    ServerModSetup("1309401477")
    ServerModSetup("1349799880")
    ServerModSetup("1898292532")
    ServerModSetup("1951468597")
    ServerModSetup("2289662010")
    ServerModSetup("345692228")
    ServerModSetup("347079953")
    ServerModSetup("351325790")
    ServerModSetup("354533909")
    ServerModSetup("356930882")
    ServerModSetup("358749986")
    ServerModSetup("359479220")
    ServerModSetup("362175979")
    ServerModSetup("367546858")
    ServerModSetup("370373189")
    ServerModSetup("375850593")
    ServerModSetup("375859599")
    ServerModSetup("376333686")
    ServerModSetup("378160973")
    ServerModSetup("380079744")
    ServerModSetup("380122571")
    ServerModSetup("380423963")
    ServerModSetup("382177939")
    ServerModSetup("387716835")
    ServerModSetup("388109833")
    ServerModSetup("396026892")
    ServerModSetup("398570591")
    ServerModSetup("409184357")
    ServerModSetup("410902908")
    ServerModSetup("437711916")
    ServerModSetup("439115156")
    ServerModSetup("441024679")
    ServerModSetup("444235588")
    ServerModSetup("447092740")
    ServerModSetup("454781545")
    ServerModSetup("458587300")
    ServerModSetup("458940297")
    ServerModSetup("460972875")
    ServerModSetup("462372013")
    ServerModSetup("462434129")
    ServerModSetup("462469447")
    ServerModSetup("463740026")
    ServerModSetup("466732225")
    ServerModSetup("482125281")
    ServerModSetup("485291255")
    ServerModSetup("490153236")
    ServerModSetup("501385076")
    ServerModSetup("519266302")
    ServerModSetup("528613635")
    ServerModSetup("532171178")
    ServerModSetup("541537428")
    ServerModSetup("569043634")
    ServerModSetup("572538624")
    ServerModSetup("599498678")
    ServerModSetup("604761020")
    ServerModSetup("620716967")
    ServerModSetup("623749604")
    ServerModSetup("632082897")
    ServerModSetup("637526073")
    ServerModSetup("643023105")
    ServerModSetup("647370020")
    ServerModSetup("656256171")
    ServerModSetup("660788832")
    ServerModSetup("661253977")
    ServerModSetup("676503184")
    ServerModSetup("684041335")
    ServerModSetup("684098549")
    ServerModSetup("693891462")
    ServerModSetup("704471544")
    ServerModSetup("782961570")
    ServerModSetup("786556008")
    ServerModSetup("791838548")
    ServerModSetup("836583293")
    ServerModSetup("857226244")

--ServerModCollectionSetup takes a string of a specific mod's Workshop id. It will download all the mods in the collection and install them to the mod directory on boot.
    --The Workshop id can be found at the end of the url to the collection's Workshop page.
    --Example: http://steamcommunity.com/sharedfiles/filedetails/?id=379114180
    --ServerModCollectionSetup("379114180")

开启洞穴

之前怎样就不管了,现在只需要添加一份配置就行了。

首先,新增洞穴启动文件:

~/linuxgsm.sh dstserver

会提示:

./dstserver-2 details  # 生成配置

执行过后会在/home/xxx/lgsm/config-lgsm/dstserver/目录下边生成dstserver-2.cfg配置文件。

主世界

打开默认的dstserver.cfg配置文件,添加以下内容,作主世界配置:

# Installation Variables
sharding="true"
master="true"
shard="Master" 
cluster="Cluster_1"
cave="false"

同时找到或者新建主世界服务器配置文件~/.klei/DoNotStarveTogether/Cluster_1/Master/server.ini

# server.ini (LGSM 161118)


[NETWORK]
server_port = 11000


[SHARD]
is_master = true


[STEAM]
authentication_port = 8768
master_server_port = 27018


[ACCOUNT]
encode_user_path = true

洞穴

打开dstserver-2.cfg配置文件,添加以下内容,作洞穴世界配置:

# Installation Variables
sharding="true"
master="false"
shard="Caves" 
cluster="Cluster_1"
cave="true"

同时找到或者新建洞穴世界服务器配置文件~/.klei/DoNotStarveTogether/Cluster_1/Caves/server.ini

# server.ini (LGSM 161118)


[NETWORK]
server_port = 11001


[SHARD]
is_master = false
name = Caves
id = 4119577360 # 此栏不填自动生成


[STEAM]
authentication_port = 8769
master_server_port = 27019


[ACCOUNT]
encode_user_path = true

服务器信息配置

# cluster.ini (LGSM 161118)
[GAMEPLAY]
game_mode = endless
max_players = 16
pause_when_empty = true
pvp = false
vote_enabled = true


[MISC]
console_enabled = true
max_snapshots = 6


[NETWORK]
cluster_description = QQ群111653231
cluster_name = 橙子的无尽空间
cluster_intention = cooperative
cluster_password = xxxxxxx
tick_rate = 15


[SHARD]
shard_enabled = true         # 此处开启多世界
bind_ip = 127.0.0.1
master_ip = 127.0.0.1
master_port = 10888
cluster_key = xxxxxx

最后分别执行./dstserver-2 st 启动主世界,以及./dstserver st启动洞穴就可以了。

只需要保留server.ini文件即可,其他内容全部覆盖。