- Finished most of LuaCsSetup top-level functionality.
- Removed some unneeded interface definitions. - Clean-slated some Services that need to be re-written.
This commit is contained in:
@@ -13,6 +13,7 @@ using System.Xml.Linq;
|
||||
using MoonSharp.Interpreter;
|
||||
using System.Net;
|
||||
using Barotrauma.Extensions;
|
||||
using Barotrauma.LuaCs.Events;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -34,7 +35,8 @@ namespace Barotrauma
|
||||
set { world = value; }
|
||||
}
|
||||
|
||||
public static LuaCsSetup LuaCs;
|
||||
private static LuaCsSetup _luaCs;
|
||||
public static LuaCsSetup LuaCs => _luaCs ??= new LuaCsSetup();
|
||||
|
||||
public static GameServer Server;
|
||||
public static NetworkMember NetworkMember
|
||||
@@ -364,7 +366,7 @@ namespace Barotrauma
|
||||
TaskPool.Update();
|
||||
CoroutineManager.Update(paused: false, (float)Timing.Step);
|
||||
|
||||
GameMain.LuaCs.Update();
|
||||
LuaCs.EventService.PublishEvent<IEventUpdate>(sub => sub.OnUpdate(Timing.Step));
|
||||
performanceCounterTimer.Stop();
|
||||
if (GameMain.LuaCs.PerformanceCounter.EnablePerformanceCounter)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using Barotrauma.Networking;
|
||||
|
||||
namespace Barotrauma;
|
||||
|
||||
partial class LuaCsSetup
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles changes in game states tracked by screen changes.
|
||||
/// </summary>
|
||||
/// <param name="screen">The new game screen.</param>
|
||||
public partial void OnScreenSelected(Screen screen)
|
||||
{
|
||||
// the server is always in the running state unless explicitly stopped.
|
||||
if (screen == UnimplementedScreen.Instance)
|
||||
SetRunState(RunState.Unloaded);
|
||||
SetRunState(RunState.Running);
|
||||
}
|
||||
|
||||
private partial bool ShouldRunCs() => IsCsEnabled.Value ||
|
||||
(GetPackage(new SteamWorkshopId(CsForBarotraumaSteamId.Value), false, false) is { }
|
||||
&& GameMain.Server.ServerPeer is LidgrenServerPeer);
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Barotrauma.LuaCs.Services.Processing;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace Barotrauma.LuaCs.Services;
|
||||
|
||||
public partial class PackageService
|
||||
{
|
||||
public PackageService(
|
||||
Lazy<IModConfigCreatorService> configParserService,
|
||||
Lazy<ILuaScriptService> luaScriptService,
|
||||
Lazy<ILocalizationService> localizationService,
|
||||
Lazy<IPluginService> pluginService,
|
||||
Lazy<IConfigService> configService,
|
||||
IPackageManagementService packageManagementService,
|
||||
IStorageService storageService,
|
||||
ILoggerService loggerService)
|
||||
{
|
||||
_configParserService = configParserService;
|
||||
_luaScriptService = luaScriptService;
|
||||
_localizationService = localizationService;
|
||||
_pluginService = pluginService;
|
||||
_configService = configService;
|
||||
_packageManagementService = packageManagementService;
|
||||
_storageService = storageService;
|
||||
_loggerService = loggerService;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user