LuaGame legacy service
This commit is contained in:
@@ -49,6 +49,7 @@ namespace Barotrauma
|
||||
_servicesProvider.RegisterServiceType<IPackageManagementService, PackageManagementService>(ServiceLifetime.Singleton);
|
||||
_servicesProvider.RegisterServiceType<IPluginManagementService, PluginManagementService>(ServiceLifetime.Singleton);
|
||||
_servicesProvider.RegisterServiceType<ILuaScriptManagementService, LuaScriptManagementService>(ServiceLifetime.Singleton);
|
||||
_servicesProvider.RegisterServiceType<LuaGame, LuaGame>(ServiceLifetime.Singleton);
|
||||
// TODO: ILocalizationService
|
||||
// TODO: IConfigService
|
||||
// TODO: INetworkingService
|
||||
@@ -109,6 +110,8 @@ namespace Barotrauma
|
||||
? svc : throw new NullReferenceException("Networking Manager service not found!");
|
||||
public IEventService EventService => _servicesProvider.TryGetService<IEventService>(out var svc)
|
||||
? svc : throw new NullReferenceException("Networking Manager service not found!");
|
||||
public LuaGame Game => _servicesProvider.TryGetService<LuaGame>(out var svc)
|
||||
? svc : throw new NullReferenceException("LuaGame service not found!");
|
||||
|
||||
/*
|
||||
* === Config Vars
|
||||
@@ -175,8 +178,7 @@ namespace Barotrauma
|
||||
|
||||
#region LegacyRedirects
|
||||
|
||||
public ILuaCsHook Hook => this.EventService;
|
||||
|
||||
public ILuaCsHook Hook => this.EventService;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -3,14 +3,15 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Barotrauma.Items.Components;
|
||||
using Barotrauma.LuaCs.Services;
|
||||
using Barotrauma.Networking;
|
||||
using FarseerPhysics.Dynamics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Barotrauma
|
||||
namespace Barotrauma.LuaCs.Services
|
||||
{
|
||||
partial class LuaGame
|
||||
partial class LuaGame : IReusableService
|
||||
{
|
||||
public bool IsSingleplayer => GameMain.IsSingleplayer;
|
||||
public bool IsMultiplayer => GameMain.IsMultiplayer;
|
||||
@@ -463,6 +464,8 @@ namespace Barotrauma
|
||||
|
||||
public List<DebugConsole.Command> Commands => DebugConsole.Commands;
|
||||
|
||||
public bool IsDisposed => throw new NotImplementedException();
|
||||
|
||||
public void AssignOnExecute(string names, object onExecute) => DebugConsole.AssignOnExecute(names,
|
||||
(string[] a) =>
|
||||
{
|
||||
@@ -529,7 +532,7 @@ namespace Barotrauma
|
||||
GameMain.Server.EndGame();
|
||||
}
|
||||
|
||||
public void AssignOnClientRequestExecute(string names, object onExecute) => DebugConsole.AssignOnClientRequestExecute(names, (Client a, Vector2 b, string[] c) => { GameMain.LuaCs.CallLuaFunction(onExecute, new object[] { a, b, c }); });
|
||||
//public void AssignOnClientRequestExecute(string names, object onExecute) => DebugConsole.AssignOnClientRequestExecute(names, (Client a, Vector2 b, string[] c) => { GameMain.LuaCs.CallLuaFunction(onExecute, new object[] { a, b, c }); });
|
||||
|
||||
#endif
|
||||
|
||||
@@ -543,6 +546,17 @@ namespace Barotrauma
|
||||
DebugConsole.Commands.Remove(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public FluentResults.Result Reset()
|
||||
{
|
||||
Stop();
|
||||
return FluentResults.Result.Ok();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user