Lua is automatically initialized when entering singleplayer campaigns (doesn't include submarine editor) and roundStart && roundEnd hooks now work in CL Lua
This commit is contained in:
@@ -1101,6 +1101,7 @@ namespace Barotrauma
|
|||||||
MainMenuScreen.Select();
|
MainMenuScreen.Select();
|
||||||
GameSession = null;
|
GameSession = null;
|
||||||
|
|
||||||
|
GameMain.Lua.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowCampaignDisclaimer(Action onContinue = null)
|
public void ShowCampaignDisclaimer(Action onContinue = null)
|
||||||
|
|||||||
@@ -1761,8 +1761,6 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
AddChatMessage($"ServerMessage.HowToCommunicate~[chatbutton]={GameMain.Config.KeyBindText(InputType.Chat)}~[radiobutton]={GameMain.Config.KeyBindText(InputType.RadioChat)}", ChatMessageType.Server);
|
AddChatMessage($"ServerMessage.HowToCommunicate~[chatbutton]={GameMain.Config.KeyBindText(InputType.Chat)}~[radiobutton]={GameMain.Config.KeyBindText(InputType.RadioChat)}", ChatMessageType.Server);
|
||||||
|
|
||||||
GameMain.Lua.hook.Call("roundStart", new object[] { });
|
|
||||||
|
|
||||||
yield return CoroutineStatus.Success;
|
yield return CoroutineStatus.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1202,6 +1202,8 @@ namespace Barotrauma
|
|||||||
GameMain.GameSession.CrewManager.AddCharacterInfo(characterInfo);
|
GameMain.GameSession.CrewManager.AddCharacterInfo(characterInfo);
|
||||||
}
|
}
|
||||||
((SinglePlayerCampaign)GameMain.GameSession.GameMode).LoadNewLevel();
|
((SinglePlayerCampaign)GameMain.GameSession.GameMode).LoadNewLevel();
|
||||||
|
|
||||||
|
GameMain.Lua.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadGame(string saveFile)
|
private void LoadGame(string saveFile)
|
||||||
@@ -1220,6 +1222,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
//GameMain.LobbyScreen.Select();
|
//GameMain.LobbyScreen.Select();
|
||||||
|
|
||||||
|
GameMain.Lua.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region UI Methods
|
#region UI Methods
|
||||||
|
|||||||
@@ -91,4 +91,8 @@ end
|
|||||||
|
|
||||||
setmodulepaths(modulePaths)
|
setmodulepaths(modulePaths)
|
||||||
|
|
||||||
|
Hook.Add("stop", "luaSetup.stop", function ()
|
||||||
|
print("Stopping Lua...")
|
||||||
|
end)
|
||||||
|
|
||||||
Hook.Call("loaded")
|
Hook.Call("loaded")
|
||||||
@@ -460,6 +460,8 @@ namespace Barotrauma
|
|||||||
GUI.PreventPauseMenuToggle = false;
|
GUI.PreventPauseMenuToggle = false;
|
||||||
|
|
||||||
HintManager.OnRoundStarted();
|
HintManager.OnRoundStarted();
|
||||||
|
|
||||||
|
GameMain.Lua.hook.Call("roundStart");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -686,6 +688,10 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
RoundEnding = true;
|
RoundEnding = true;
|
||||||
|
|
||||||
|
#if CLIENT
|
||||||
|
GameMain.Lua.hook.Call("roundEnd");
|
||||||
|
#endif
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IEnumerable<Character> crewCharacters = GetSessionCrewCharacters();
|
IEnumerable<Character> crewCharacters = GetSessionCrewCharacters();
|
||||||
|
|||||||
Reference in New Issue
Block a user