lua now runs on sub editor, added Game.GetEnabledContentPackages back for compatibility and printerror
This commit is contained in:
@@ -523,6 +523,8 @@ namespace Barotrauma
|
||||
#region Selection
|
||||
public override void Select()
|
||||
{
|
||||
GameMain.Lua.Stop();
|
||||
|
||||
if (WorkshopItemsToUpdate.Any())
|
||||
{
|
||||
while (WorkshopItemsToUpdate.TryDequeue(out ulong workshopId))
|
||||
|
||||
@@ -1042,12 +1042,15 @@ namespace Barotrauma
|
||||
|
||||
GameSession gameSession = new GameSession(backedUpSubInfo, "", GameModePreset.TestMode, CampaignSettings.Empty, null);
|
||||
gameSession.StartRound(null, false);
|
||||
|
||||
(gameSession.GameMode as TestGameMode).OnRoundEnd = () =>
|
||||
{
|
||||
Submarine.Unload();
|
||||
GameMain.SubEditorScreen.Select();
|
||||
};
|
||||
|
||||
GameMain.Lua.Initialize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1316,6 +1319,8 @@ namespace Barotrauma
|
||||
|
||||
public void Select(bool enableAutoSave = true)
|
||||
{
|
||||
GameMain.Lua.Stop();
|
||||
|
||||
base.Select();
|
||||
|
||||
GUI.PreventPauseMenuToggle = false;
|
||||
|
||||
@@ -51,8 +51,11 @@ local function runFolder(folder, rootFolder, package)
|
||||
local s = search[i]:gsub("\\", "/")
|
||||
|
||||
if endsWith(s, ".lua") then
|
||||
executeProtected(s, rootFolder)
|
||||
print(string.format("%s: Executing %s", package.Name, getFileName(s)))
|
||||
local ok, result = pcall(executeProtected, s, rootFolder)
|
||||
if not ok then
|
||||
printerror(result)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -103,7 +106,6 @@ for package in allPackages do
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
setmodulepaths(modulePaths)
|
||||
|
||||
Hook.Add("stop", "luaSetup.stop", function ()
|
||||
|
||||
@@ -211,6 +211,11 @@ namespace Barotrauma
|
||||
return error;
|
||||
}
|
||||
|
||||
public static ContentPackage[] GetEnabledContentPackages()
|
||||
{
|
||||
return ContentPackageManager.EnabledPackages.All.ToArray();
|
||||
}
|
||||
|
||||
public static ItemPrefab GetItemPrefab(string itemNameOrId)
|
||||
{
|
||||
ItemPrefab itemPrefab =
|
||||
|
||||
@@ -282,6 +282,8 @@ namespace Barotrauma
|
||||
UserData.RegisterType<LuaUserData>();
|
||||
UserData.RegisterType<IUserDataDescriptor>();
|
||||
|
||||
lua.Globals["printerror"] = (Action<object>)PrintError;
|
||||
|
||||
lua.Globals["setmodulepaths"] = (Action<string[]>)SetModulePaths;
|
||||
|
||||
lua.Globals["dofile"] = (Func<string, Table, string, DynValue>)DoFile;
|
||||
|
||||
Reference in New Issue
Block a user