Make everything in NetConfig static instead of constant so mods can change it

This commit is contained in:
EvilFactory
2024-08-27 22:16:38 -03:00
parent 03b8efc95f
commit a823eabea2
3 changed files with 26 additions and 24 deletions
@@ -56,6 +56,7 @@ defaultLib["TraitorEvent"] = CreateStatic("Barotrauma.TraitorEvent", true)
defaultLib["EventSet"] = CreateStatic("Barotrauma.EventSet", true) defaultLib["EventSet"] = CreateStatic("Barotrauma.EventSet", true)
defaultLib["EventManagerSettings"] = CreateStatic("Barotrauma.EventManagerSettings", true) defaultLib["EventManagerSettings"] = CreateStatic("Barotrauma.EventManagerSettings", true)
defaultLib["NetConfig"] = CreateStatic("Barotrauma.Networking.NetConfig")
defaultLib["Inventory"] = CreateStatic("Barotrauma.Inventory", true) defaultLib["Inventory"] = CreateStatic("Barotrauma.Inventory", true)
defaultLib["CharacterInventory"] = CreateStatic("Barotrauma.CharacterInventory", true) defaultLib["CharacterInventory"] = CreateStatic("Barotrauma.CharacterInventory", true)
defaultLib["ItemInventory"] = CreateStatic("Barotrauma.ItemInventory", true) defaultLib["ItemInventory"] = CreateStatic("Barotrauma.ItemInventory", true)
@@ -379,6 +379,7 @@ RegisterBarotrauma("MalfunctionEvent")
RegisterBarotrauma("EventSet") RegisterBarotrauma("EventSet")
RegisterBarotrauma("EventPrefab") RegisterBarotrauma("EventPrefab")
RegisterBarotrauma("Networking.NetConfig")
RegisterBarotrauma("Networking.IWriteMessage") RegisterBarotrauma("Networking.IWriteMessage")
RegisterBarotrauma("Networking.IReadMessage") RegisterBarotrauma("Networking.IReadMessage")
RegisterBarotrauma("Networking.NetEntityEvent") RegisterBarotrauma("Networking.NetEntityEvent")
@@ -5,59 +5,59 @@ namespace Barotrauma.Networking
{ {
static class NetConfig static class NetConfig
{ {
public const int DefaultPort = 27015; public static int DefaultPort = 27015;
public const int DefaultQueryPort = 27016; public static int DefaultQueryPort = 27016;
public const int MaxPlayers = 256; public static int MaxPlayers = 256;
public const int ServerNameMaxLength = 60; public static int ServerNameMaxLength = 60;
public const int ServerMessageMaxLength = 2000; public static int ServerMessageMaxLength = 2000;
public const float MaxPhysicsBodyVelocity = 64.0f; public const float MaxPhysicsBodyVelocity = 64.0f;
public const float MaxPhysicsBodyAngularVelocity = 16.0f; public const float MaxPhysicsBodyAngularVelocity = 16.0f;
public const float MaxHealthUpdateInterval = 2.0f; public static float MaxHealthUpdateInterval = 2.0f;
public const float MaxHealthUpdateIntervalDead = 10.0f; public static float MaxHealthUpdateIntervalDead = 10.0f;
public const float HighPrioCharacterPositionUpdateDistance = 1000.0f; public static float HighPrioCharacterPositionUpdateDistance = 1000.0f;
public const float LowPrioCharacterPositionUpdateDistance = 10000.0f; public static float LowPrioCharacterPositionUpdateDistance = 10000.0f;
public const float HighPrioCharacterPositionUpdateInterval = 0.0f; public static float HighPrioCharacterPositionUpdateInterval = 0.0f;
public const float LowPrioCharacterPositionUpdateInterval = 1.0f; public static float LowPrioCharacterPositionUpdateInterval = 1.0f;
//this should be higher than LowPrioCharacterPositionUpdateInterval, //this should be higher than LowPrioCharacterPositionUpdateInterval,
//otherwise the clients may freeze characters even though the server hasn't actually stopped sending position updates //otherwise the clients may freeze characters even though the server hasn't actually stopped sending position updates
public const float FreezeCharacterIfPositionDataMissingDelay = 2.0f; public static float FreezeCharacterIfPositionDataMissingDelay = 2.0f;
public const float DisableCharacterIfPositionDataMissingDelay = 3.5f; public static float DisableCharacterIfPositionDataMissingDelay = 3.5f;
public const float DeleteDisconnectedTime = 20.0f; public static float DeleteDisconnectedTime = 20.0f;
public const float ItemConditionUpdateInterval = 0.15f; public static float ItemConditionUpdateInterval = 0.15f;
public const float LevelObjectUpdateInterval = 0.5f; public static float LevelObjectUpdateInterval = 0.5f;
public const float HullUpdateInterval = 0.5f; public static float HullUpdateInterval = 0.5f;
public const float SparseHullUpdateInterval = 5.0f; public static float SparseHullUpdateInterval = 5.0f;
public const float HullUpdateDistance = 20000.0f; public static float HullUpdateDistance = 20000.0f;
public const int MaxEventPacketsPerUpdate = 4; public static int MaxEventPacketsPerUpdate = 4;
/// <summary> /// <summary>
/// How long the server waits for the clients to get in sync after the round has started before kicking them /// How long the server waits for the clients to get in sync after the round has started before kicking them
/// </summary> /// </summary>
public const float RoundStartSyncDuration = 60.0f; public static float RoundStartSyncDuration = 60.0f;
/// <summary> /// <summary>
/// How long the server keeps events that everyone currently synced has received /// How long the server keeps events that everyone currently synced has received
/// </summary> /// </summary>
public const float EventRemovalTime = 15.0f; public static float EventRemovalTime = 15.0f;
/// <summary> /// <summary>
/// If a client hasn't received an event that has been succesfully sent to someone within this time, they get kicked /// If a client hasn't received an event that has been succesfully sent to someone within this time, they get kicked
/// </summary> /// </summary>
public const float OldReceivedEventKickTime = 10.0f; public static float OldReceivedEventKickTime = 10.0f;
/// <summary> /// <summary>
/// If a client hasn't received an event after this time, they get kicked /// If a client hasn't received an event after this time, they get kicked
/// </summary> /// </summary>
public const float OldEventKickTime = 30.0f; public static float OldEventKickTime = 30.0f;
/// <summary> /// <summary>
/// Interpolates the positional error of a physics body towards zero. /// Interpolates the positional error of a physics body towards zero.