RynthSuite as of 2026-11-12 (internal b899791): release 2026.11.12.1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
16b6531ede
commit
b48c49f76e
110 changed files with 12476 additions and 340 deletions
|
|
@ -62,16 +62,21 @@ public static unsafe class PluginExports
|
|||
|
||||
// The same state for RynthAi's own dashboard (2026-10-23): a plugin reads another's exports only
|
||||
// through the engine's RynthPluginGet*Json broker (GetPluginExportJson). {"auto":-1|0|1}, a
|
||||
// literal (nothing to free).
|
||||
// literal (nothing to free). 2026-11-11: "moving":1 while items are being moved (RynthSortPlugin.Moving),
|
||||
// for the key's sorting look; a reader that only looks for "auto" is unchanged.
|
||||
[UnmanagedCallersOnly(EntryPoint = "RynthPluginGetAutoSortJson", CallConvs = new[] { typeof(CallConvCdecl) })]
|
||||
public static IntPtr AutoSortJson()
|
||||
{
|
||||
int state;
|
||||
try { state = Runtime.Plugin?.AutoState ?? -1; } catch { state = -1; }
|
||||
return state switch
|
||||
bool moving;
|
||||
try { state = Runtime.Plugin?.AutoState ?? -1; moving = Runtime.Plugin?.Moving ?? false; }
|
||||
catch { state = -1; moving = false; }
|
||||
return (state, moving) switch
|
||||
{
|
||||
1 => LiteralPointer("{\"auto\":1}"u8),
|
||||
0 => LiteralPointer("{\"auto\":0}"u8),
|
||||
(1, true) => LiteralPointer("{\"auto\":1,\"moving\":1}"u8),
|
||||
(1, false) => LiteralPointer("{\"auto\":1,\"moving\":0}"u8),
|
||||
(0, true) => LiteralPointer("{\"auto\":0,\"moving\":1}"u8),
|
||||
(0, false) => LiteralPointer("{\"auto\":0,\"moving\":0}"u8),
|
||||
_ => LiteralPointer("{\"auto\":-1}"u8),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,10 +56,25 @@ public sealed class RynthSortPlugin : RynthPluginBase
|
|||
private bool _backupOnSave;
|
||||
private readonly List<string> _warnings = new();
|
||||
private volatile int _autoState = -1;
|
||||
private volatile bool _moving;
|
||||
private int _movedSeen;
|
||||
private long _lastMoveMs;
|
||||
|
||||
/// <summary>
|
||||
/// How long after a move lands RynthSort still counts as moving, so a run of moves (a gap of
|
||||
/// up to a second or two between them) reads as one on RynthAi's dashboard key.
|
||||
/// </summary>
|
||||
private const long MovingHoldMs = 1500;
|
||||
|
||||
/// <summary>For the engine's dashboard toggle (RynthSortAutoState): -1 not logged in yet, 0 auto-sort off, 1 on. Any thread.</summary>
|
||||
public int AutoState => _autoState;
|
||||
|
||||
/// <summary>
|
||||
/// RynthSort is moving items: a move is out, or one landed in the last <see cref="MovingHoldMs"/>.
|
||||
/// RynthAi's auto-sort key plays its sorting look while this is true. Any thread.
|
||||
/// </summary>
|
||||
public bool Moving => _moving;
|
||||
|
||||
/// <summary>
|
||||
/// A command from another plugin (RynthPluginApplyRemoteCommand): the /rsort argument when
|
||||
/// <paramref name="action"/> is "rsort" (value "now", "status"...), else null (not ours).
|
||||
|
|
@ -235,6 +250,9 @@ public sealed class RynthSortPlugin : RynthPluginBase
|
|||
}
|
||||
if (_saveDueMs != 0 && now >= _saveDueMs) SaveNow();
|
||||
_autoState = _inWorld && _identityKnown ? (_sort.Data.Settings.Auto ? 1 : 0) : -1;
|
||||
if (_sort.Moved > _movedSeen) _lastMoveMs = now; // a move landed (Moved goes back to 0 on Reset: not a move)
|
||||
_movedSeen = _sort.Moved;
|
||||
_moving = _inWorld && _identityKnown && (_sort.HasMoveOut || (_lastMoveMs != 0 && now - _lastMoveMs < MovingHoldMs));
|
||||
|
||||
if (!Host.HasUi || _window == null || _panel == null) return;
|
||||
Record(_window, now);
|
||||
|
|
|
|||
Loading…
Reference in a new issue