Fix bullshit Lua issues

This commit is contained in:
Evil Factory
2026-02-12 21:50:13 -03:00
parent 07d838eee0
commit 5f38b4a43a
5 changed files with 22 additions and 14 deletions
@@ -34,7 +34,7 @@ namespace Barotrauma
Script.GlobalOptions.CustomConverters.SetScriptToClrCustomConversion(DataType.Function, typeof(LuaCsAction), v => (LuaCsAction)(args =>
{
if (v.Function.OwnerScript == _luaScriptManagementService)
if (v.Function.OwnerScript == _luaScriptManagementService.InternalScript)
{
Call(v.Function, args);
}
@@ -61,7 +61,7 @@ namespace Barotrauma
public LuaCsTimer(IEventService eventService)
{
_eventService = eventService;
_eventService.Subscribe<IEventUpdate>(this);
SubscribeToEvents();
}
private void AddTimer(TimedAction timedAction)
@@ -101,11 +101,6 @@ namespace Barotrauma
AddTimer(timedAction);
}
public void Dispose()
{
_eventService.Unsubscribe<IEventUpdate>(this);
}
public void OnUpdate(double fixedDeltaTime)
{
lock (timedActions)
@@ -135,6 +130,22 @@ namespace Barotrauma
}
}
private void SubscribeToEvents()
{
_eventService.Subscribe<IEventUpdate>(this);
}
public FluentResults.Result Reset()
{
SubscribeToEvents();
return FluentResults.Result.Ok();
}
public void Dispose()
{
_eventService.Unsubscribe<IEventUpdate>(this);
}
public bool IsDisposed => false;
}
}