Fix WeatherTimeSync option

This commit is contained in:
Sardelka 2022-07-12 17:10:16 +08:00
parent edca1e2b98
commit cf8b54a3b5
2 changed files with 11 additions and 11 deletions

View File

@ -10,6 +10,8 @@ namespace RageCoop.Server.Scripting
{
internal class BaseScript:ServerScript
{
private readonly Server Server;
public BaseScript(Server server) { Server=server; }
public override void OnStart()
{
API.RegisterCustomEventHandler(CustomEvents.NativeResponse, NativeResponse);
@ -23,13 +25,16 @@ namespace RageCoop.Server.Scripting
});
API.RegisterCustomEventHandler(CustomEvents.WeatherTimeSync, (e) =>
{
foreach(var c in API.GetAllClients().Values)
if (Server.Settings.WeatherTimeSync)
{
if (c==e.Sender)
foreach (var c in API.GetAllClients().Values)
{
continue;
if (c==e.Sender)
{
continue;
}
c.SendCustomEventQueued(CustomEvents.WeatherTimeSync, e.Args);
}
c.SendCustomEventQueued(CustomEvents.WeatherTimeSync,e.Args);
}
});
}

View File

@ -76,13 +76,8 @@
public float PlayerStreamingDistance { get; set; } = -1;
/// <summary>
/// If enabled, all clients will have same weather as host
/// If enabled, all clients will have same weather and time as host
/// </summary>
public bool WeatherSync { get; set; } = true;
/// <summary>
/// If enabled, all clients will have same time as host
/// </summary>
public bool TimeSync { get; set; } = true;
public bool WeatherTimeSync { get; set; } = true;
}
}