Files
LuaCsForBarotraumaEP/Barotrauma/BarotraumaServer/ServerSource/LuaCs/LuaCsSetup.cs
MapleWheels 055a508901 - Deleted unused service IPackageListRetrievalService.cs
- Added caching function to LuaScriptLoader.cs
- Added sample async code to LuaScriptManagementService.cs
- Removed most of the State functions in LuaCsSetup.cs (requires rewrite).
- Fixed CsEnabled check.
- Moved IsRunningWorkshop check to client-only project.
2026-02-07 20:10:54 -05:00

31 lines
1.2 KiB
C#

using System;
using System.IO;
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);
// ReSharper disable once InconsistentNaming
private static readonly Lazy<bool> isRunningInsideWorkshop = new Lazy<bool>(() =>
Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly()!.Location) !=
Directory.GetCurrentDirectory());
public static bool IsRunningInsideWorkshop => isRunningInsideWorkshop.Value;
}