Replace sandbox wrapper scripts.

This commit is contained in:
Matthias Mailänder
2023-05-08 21:04:45 +02:00
committed by abcdefg30
parent e8dd85419f
commit 445b736885
15 changed files with 188 additions and 763 deletions

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Scripting
public class LuaScript : ITick, IWorldLoaded, INotifyActorDisposing
{
readonly LuaScriptInfo info;
ScriptContext context;
public ScriptContext Context;
bool disposed;
public LuaScript(LuaScriptInfo info)
@@ -40,13 +40,13 @@ namespace OpenRA.Mods.Common.Scripting
void IWorldLoaded.WorldLoaded(World world, WorldRenderer worldRenderer)
{
var scripts = info.Scripts ?? Enumerable.Empty<string>();
context = new ScriptContext(world, worldRenderer, scripts);
context.WorldLoaded();
Context = new ScriptContext(world, worldRenderer, scripts);
Context.WorldLoaded();
}
void ITick.Tick(Actor self)
{
context.Tick();
Context.Tick();
}
void INotifyActorDisposing.Disposing(Actor self)
@@ -54,11 +54,11 @@ namespace OpenRA.Mods.Common.Scripting
if (disposed)
return;
context?.Dispose();
Context?.Dispose();
disposed = true;
}
public bool FatalErrorOccurred => context.FatalErrorOccurred;
public bool FatalErrorOccurred => Context.FatalErrorOccurred;
}
}