Run Re-Do

This commit is contained in:
2026-07-02 20:41:43 -07:00
parent 86575dd5bc
commit 16e396841e
188 changed files with 8291 additions and 2429 deletions
@@ -0,0 +1,49 @@
using ProjectM.Simulation;
using Unity.Entities;
using Unity.NetCode;
using UnityEngine;
namespace ProjectM.Client
{
/// <summary>
/// Client-side boon-pick sender: a static enqueue (the Step-14 3-card modal / execute_code) drained into
/// <see cref="BoonPickRequest"/> RPCs. Carries only the option INDEX — the server resolves it against the
/// sender's own authoritative <c>BoonOffer</c> and validates lifecycle/pending, so a stale or forged pick is
/// simply dropped. Statics reset on play-enter (the stale-bridge hazard).
/// </summary>
[WorldSystemFilter(WorldSystemFilterFlags.ClientSimulation)]
public partial class BoonSendSystem : SystemBase
{
static int s_Pending;
static byte s_PendingIndex;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
static void ResetStatics()
{
s_Pending = 0;
s_PendingIndex = 0;
}
/// <summary>Queue a boon pick (0/1/2). The HUD card click + execute_code drive this.</summary>
public static void PickBoon(byte optionIndex)
{
s_PendingIndex = optionIndex;
s_Pending++;
}
protected override void OnCreate()
{
RequireForUpdate<NetworkId>();
}
protected override void OnUpdate()
{
while (s_Pending > 0)
{
s_Pending--;
var req = EntityManager.CreateEntity(typeof(BoonPickRequest), typeof(SendRpcCommandRequest));
EntityManager.SetComponentData(req, new BoonPickRequest { Index = s_PendingIndex });
}
}
}
}