Make loadout restore requests submit-only
This commit is contained in:
parent
3e1a9d029c
commit
cd50732b29
2 changed files with 20 additions and 7 deletions
|
|
@ -9714,7 +9714,7 @@ static void RequireInventoryLoadoutRestoreRequestAuthority(string root)
|
|||
var requiredSymbols = new[]
|
||||
{
|
||||
"RequestRuntimeLoadoutRestore",
|
||||
"TryRequestDaemonLoadoutRestore",
|
||||
"RequestDaemonLoadoutRestore",
|
||||
"Operations.RestoreLoadout"
|
||||
};
|
||||
|
||||
|
|
@ -9735,6 +9735,21 @@ static void RequireInventoryLoadoutRestoreRequestAuthority(string root)
|
|||
"Unity loadout restore still rejects requests through renderer-local credits instead of daemon acceptance.");
|
||||
}
|
||||
|
||||
var forbiddenActionSymbols = new[]
|
||||
{
|
||||
"TryRequestDaemonLoadoutRestore",
|
||||
"private bool TryRequestDaemonLoadoutRestore("
|
||||
};
|
||||
var forbiddenActionHits = forbiddenActionSymbols
|
||||
.Where(symbol => actionGameManager.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (forbiddenActionHits.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Unity loadout restore still exposes daemon request submission as local acceptance state: " +
|
||||
string.Join(", ", forbiddenActionHits));
|
||||
}
|
||||
|
||||
var daemonOperationsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonOperations.cs");
|
||||
var daemonOperations = File.Exists(daemonOperationsPath)
|
||||
? File.ReadAllText(daemonOperationsPath)
|
||||
|
|
|
|||
|
|
@ -901,11 +901,11 @@ public class ActionGameManager : MonoBehaviour
|
|||
var observer = ResolveDaemonObserver();
|
||||
if (observer != null && observer.HasAuthoritativeState)
|
||||
{
|
||||
TryRequestDaemonLoadoutRestore(observer, template, price);
|
||||
RequestDaemonLoadoutRestore(observer, template, price);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryRequestDaemonLoadoutRestore(
|
||||
private void RequestDaemonLoadoutRestore(
|
||||
AetheriaDaemonObserver observer,
|
||||
AetheriaRuntimeLoadoutTemplateSnapshot template,
|
||||
int price)
|
||||
|
|
@ -916,24 +916,22 @@ public class ActionGameManager : MonoBehaviour
|
|||
string.IsNullOrWhiteSpace(template.Name) ||
|
||||
price < 0)
|
||||
{
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
var dockedEntityKey = ResolveEntityRecordKey(DockedEntity);
|
||||
if (string.IsNullOrWhiteSpace(dockedEntityKey))
|
||||
{
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
observer.Operations.RestoreLoadout(dockedEntityKey, template.Name, price);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"Failed to send Aetheria daemon loadout restore operation: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue