M1: build shared 2-tread bot; rewire TreadPart to seat-based gating

- Rewrote TreadPart: seat-based input gating (was mis-wired to NetworkObject
  IsOwner, which needs per-tread ownership that NGO forbids for nested
  NetworkObjects). Both treads now share the chassis NetworkObject; a client
  drives the tread whose SeatManager seat it holds, host re-validates OwnsSeat
  on a RequireOwnership=false RPC. Also swapped to Keyboard.current (New input).
- Moved SeatManager OnGUI below the connectivity panel (was overlapping).
- M1_Arena: in-scene Bot NetworkObject = chassis (Rigidbody 60kg + NetworkObject
  + NetworkTransform + NetworkRigidbody + SeatManager) + Tread_L/Tread_R children
  (TreadPart, world offset +/-1.2 X for differential drive).
- Solo-verified: bot auto-spawns in-scene, seat claim + input gating wired.

Controls: W/Up throttle, Shift pivot, A/D lean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
megaproxy 2026-07-11 00:13:41 +01:00
parent d42b42f269
commit e8d72e4649
3 changed files with 615 additions and 121 deletions

View file

@ -161,19 +161,21 @@ namespace Jankenbots.Prototype
Seat? mine = LocalSeat();
string held = mine.HasValue ? mine.Value.ToString() : "none (spectator)";
const int w = 260, h = 78;
GUI.Box(new Rect(10, 10, w, h), "JANKENBOTS · seat");
GUI.Label(new Rect(20, 32, w - 20, 20), $"You hold: {held}");
GUI.Label(new Rect(20, 52, w - 20, 20),
// Sits BELOW the NetworkBootstrap connectivity panel (which occupies the
// top-left ~260px) so the Claim button isn't hidden behind it.
const int x = 10, y = 300, w = 260, h = 78;
GUI.Box(new Rect(x, y, w, h), "JANKENBOTS · seat");
GUI.Label(new Rect(x + 10, y + 22, w - 20, 20), $"You hold: {held}");
GUI.Label(new Rect(x + 10, y + 42, w - 20, 20),
$"Left: {SeatLabel(LeftPilot.Value)} Right: {SeatLabel(RightPilot.Value)}");
// Client-side ask/release buttons (they just fire the ServerRpc).
if (!mine.HasValue)
{
if (GUI.Button(new Rect(w - 70, 30, 55, 20), "Claim"))
if (GUI.Button(new Rect(x + w - 70, y + 20, 55, 20), "Claim"))
ClaimSeatRpc();
}
else if (GUI.Button(new Rect(w - 70, 30, 55, 20), "Leave"))
else if (GUI.Button(new Rect(x + w - 70, y + 20, 55, 20), "Leave"))
{
ReleaseSeatRpc();
}