-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathSubnauticaServerConfig.cs
More file actions
133 lines (98 loc) · 5.09 KB
/
SubnauticaServerConfig.cs
File metadata and controls
133 lines (98 loc) · 5.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
using NitroxModel.DataStructures.GameLogic;
using NitroxModel.Helper;
using NitroxModel.Server;
namespace NitroxModel.Serialization
{
[PropertyDescription("Server settings can be changed here")]
public class SubnauticaServerConfig : NitroxConfig<SubnauticaServerConfig>
{
private int maxConnectionsSetting = 100;
private int initialSyncTimeoutSetting = 300000;
[PropertyDescription("Set to true to Cache entities for the whole map on next run. \nWARNING! Will make server load take longer on the cache run but players will gain a performance boost when entering new areas.")]
public bool CreateFullEntityCache { get; set; } = false;
private int saveIntervalSetting = 120000;
private int maxBackupsSetting = 10;
private string postSaveCommandPath = string.Empty;
public override string FileName => "server.cfg";
[PropertyDescription("Leave blank for a random spawn position")]
public string Seed { get; set; }
public int ServerPort { get; set; } = ServerList.DEFAULT_PORT;
[PropertyDescription("Prevents players from losing items on death")]
public bool KeepInventoryOnDeath { get; set; } = false;
[PropertyDescription("Places a beacon where players die")]
public bool MarkDeathPointsWithBeacon { get; set; } = true;
[PropertyDescription("Measured in milliseconds")]
public int SaveInterval
{
get => saveIntervalSetting;
set
{
Validate.IsTrue(value >= 1000, "SaveInterval must be greater than 1000");
saveIntervalSetting = value;
}
}
public int MaxBackups
{
get => maxBackupsSetting;
set
{
Validate.IsTrue(value >= 0, "MaxBackups must be greater than or equal to 0");
maxBackupsSetting = value;
}
}
[PropertyDescription("Command to run following a successful world save (e.g. .exe, .bat, or PowerShell script). ")]
public string PostSaveCommandPath
{
get => postSaveCommandPath;
set => postSaveCommandPath = value?.Trim('"').Trim();
}
public int MaxConnections
{
get => maxConnectionsSetting;
set
{
Validate.IsTrue(value > 0, "MaxConnections must be greater than 0");
maxConnectionsSetting = value;
}
}
public int InitialSyncTimeout
{
get => initialSyncTimeoutSetting;
set
{
Validate.IsTrue(value > 30000, "InitialSyncTimeout must be greater than 30 seconds");
initialSyncTimeoutSetting = value;
}
}
public bool DisableConsole { get; set; }
public bool DisableAutoSave { get; set; }
public bool DisableAutoBackup { get; set; }
public string ServerPassword { get; set; } = string.Empty;
public string AdminPassword { get; set; } = StringHelper.GenerateRandomString(12);
[PropertyDescription("Possible values:", typeof(NitroxGameMode))]
public NitroxGameMode GameMode { get; set; } = NitroxGameMode.SURVIVAL;
[PropertyDescription("Possible values:", typeof(ServerSerializerMode))]
public ServerSerializerMode SerializerMode { get; set; } = ServerSerializerMode.JSON;
[PropertyDescription("Possible values:", typeof(Perms))]
public Perms DefaultPlayerPerm { get; set; } = Perms.PLAYER;
[PropertyDescription("\nDefault player stats below here")]
public float DefaultOxygenValue { get; set; } = 45;
public float DefaultMaxOxygenValue { get; set; } = 45;
public float DefaultHealthValue { get; set; } = 80;
public float DefaultHungerValue { get; set; } = 50.5f;
public float DefaultThirstValue { get; set; } = 90.5f;
[PropertyDescription("Recommended to keep at 0.1f which is the default starting value. If set to 0 then new players are cured by default.")]
public float DefaultInfectionValue { get; set; } = 0.1f;
public PlayerStatsData DefaultPlayerStats => new(DefaultOxygenValue, DefaultMaxOxygenValue, DefaultHealthValue, DefaultHungerValue, DefaultThirstValue, DefaultInfectionValue);
[PropertyDescription("If set to true, the server will try to open port on your router via UPnP")]
public bool AutoPortForward { get; set; } = true;
[PropertyDescription("Determines whether the server will listen for and reply to LAN discovery requests.")]
public bool LANDiscoveryEnabled { get; set; } = true;
[PropertyDescription("When true, will reject any build actions detected as desynced")]
public bool SafeBuilding { get; set; } = true;
[PropertyDescription("When true and started in launcher, will use launcher UI as opposed to external window")]
public bool IsEmbedded { get; set; } = true;
[PropertyDescription("Activates/Deactivates Player versus Player damage/interactions")]
public bool PvPEnabled { get; set; } = true;
}
}