Compare commits

...
4 Commits
3 changed files with 12 additions and 3 deletions

No files matched your search

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 96 KiB

+7 -2
View File
@@ -11,7 +11,8 @@ namespace Cthangover.Mods.Rpg
/// they are on a Russian or any other layout; the arrows work too. /// they are on a Russian or any other layout; the arrows work too.
/// <para/> /// <para/>
/// The world must not walk while something else owns the keyboard or the /// The world must not walk while something else owns the keyboard or the
/// player's attention: a dialog, a toolbar panel (inventory, journal), a /// player's attention: a dialog, a toolbar panel (inventory, journal) or a
/// window-like overlay opened by a scenario (a trade window, a workbench), a
/// focused editor window or text field, a paused tree, a scene transition. /// focused editor window or text field, a paused tree, a scene transition.
/// <see cref="IsWalkBlocked"/> collects those checks in one place. /// <see cref="IsWalkBlocked"/> collects those checks in one place.
/// </summary> /// </summary>
@@ -61,13 +62,17 @@ namespace Cthangover.Mods.Rpg
return IsPanelOpen(); return IsPanelOpen();
} }
// Panels and "once" overlays opened on demand are window-like entries on the
// host layer. Overlays shown from the start (a HUD strip) do not block walking.
private static bool IsPanelOpen() private static bool IsPanelOpen()
{ {
var host = UiHost.Instance; var host = UiHost.Instance;
if (host == null) if (host == null)
return false; return false;
foreach (var entry in UiRegistry.PanelEntries) foreach (var entry in UiRegistry.Entries)
{ {
if (!UiRegistry.IsPanel(entry) && !(entry.Once && !entry.ShowOnStart))
continue;
if (host.TryGetInstance(entry.Id, out var panel) && panel.IsVisibleInTree()) if (host.TryGetInstance(entry.Id, out var panel) && panel.IsVisibleInTree())
return true; return true;
} }
+5 -1
View File
@@ -7,6 +7,7 @@ using Cthangover.Core.Games;
using Cthangover.Core.Scenes; using Cthangover.Core.Scenes;
using Cthangover.Core.Settings; using Cthangover.Core.Settings;
using Cthangover.Core.Utils; using Cthangover.Core.Utils;
using Cthangover.Mods.Interface.View;
using Godot; using Godot;
namespace Cthangover.Mods.Rpg.Tests namespace Cthangover.Mods.Rpg.Tests
@@ -176,6 +177,9 @@ namespace Cthangover.Mods.Rpg.Tests
// core waits for the player, take the platform's victory path. // core waits for the player, take the platform's victory path.
if (battle.ActiveBattleCore is not IBattleAutoPlayable auto || !auto.IsWaitingForPlayerInput) if (battle.ActiveBattleCore is not IBattleAutoPlayable auto || !auto.IsWaitingForPlayerInput)
return; return;
// The shot waits for the fade-in too, otherwise it catches the blank transition.
if (GodotSceneService.IsTransitioning)
return;
Shot("battle"); Shot("battle");
battle.ShowWinground(); battle.ShowWinground();
Next(); Next();
@@ -284,7 +288,7 @@ namespace Cthangover.Mods.Rpg.Tests
if (string.IsNullOrEmpty(shotsDir) || DisplayServer.GetName() == "headless") if (string.IsNullOrEmpty(shotsDir) || DisplayServer.GetName() == "headless")
return; return;
DirAccess.MakeDirRecursiveAbsolute(shotsDir); DirAccess.MakeDirRecursiveAbsolute(shotsDir);
GetViewport().GetTexture().GetImage()?.SavePng(shotsDir.TrimEnd('/') + "/rpg_" + name + ".png"); ViewportCapture.SavePng(GetViewport(), shotsDir.TrimEnd('/') + "/rpg_" + name + ".png");
} }
private void Finish() private void Finish()