feat(pixel-office): show temp-worker stools on seat and randomize subagent seating

This commit is contained in:
xmanrui
2026-03-04 16:06:58 +08:00
parent 94eb6cd679
commit aab74f6f1c
4 changed files with 27 additions and 6 deletions
+6 -5
View File
@@ -706,12 +706,13 @@ export class OfficeState {
Math.abs(c - parentCol) + Math.abs(r - parentRow)
let bestSeatId: string | null = null
for (const seatId of SUBAGENT_PRIORITY_SEAT_IDS) {
const availablePrioritySeats = SUBAGENT_PRIORITY_SEAT_IDS.filter((seatId) => {
const seat = this.seats.get(seatId)
if (seat && !seat.assigned) {
bestSeatId = seatId
break
}
return !!seat && !seat.assigned
})
if (availablePrioritySeats.length > 0) {
const randomIdx = Math.floor(Math.random() * availablePrioritySeats.length)
bestSeatId = availablePrioritySeats[randomIdx]
}
if (!bestSeatId) {
let bestDist = Infinity
+10
View File
@@ -236,6 +236,13 @@ export function renderScene(
const laptopUpwardSpinRad = -Math.PI / 12
const laptopTiltScaleY = Math.max(0.22, Math.abs(Math.cos(laptopXTiltRad)))
const laptopTiltSkewX = -Math.sin(laptopXTiltRad) * 0.35
const visibleSubagentStoolIds = new Set<string>()
for (const ch of characters) {
if (!ch.isSubagent || ch.state !== CharacterState.TYPE || !ch.seatId) continue
if (!ch.seatId.startsWith('stool-r')) continue
if (ch.matrixEffect === 'despawn') continue
visibleSubagentStoolIds.add(ch.seatId)
}
// Wall decorations as z-sorted drawables (zY just above row 0 walls so they render on top of walls but below characters)
const wallDecoZY = TILE_SIZE + 0.5
@@ -252,6 +259,9 @@ export function renderScene(
// Furniture
for (const f of furniture) {
if (f.uid?.startsWith('stool-r') && !visibleSubagentStoolIds.has(f.uid)) {
continue
}
const fx = offsetX + f.x * zoom
const fy = offsetY + f.y * zoom
if (f.emoji) {
+10 -1
View File
@@ -73,7 +73,16 @@ export function layoutToFurnitureInstances(furniture: PlacedFurniture[]): Furnit
sprite = getColorizedSprite(`furn-${item.type}-${h}-${s}-${bv}-${cv}-${item.color.colorize ? 1 : 0}`, entry.sprite, item.color)
}
instances.push({ sprite, x, y, zY, ...(entry.emoji ? { emoji: entry.emoji } : {}), ...(item.rotation ? { rotation: item.rotation } : {}), ...(entry.emojiScale ? { emojiScale: entry.emojiScale } : {}) })
instances.push({
uid: item.uid,
sprite,
x,
y,
zY,
...(entry.emoji ? { emoji: entry.emoji } : {}),
...(item.rotation ? { rotation: item.rotation } : {}),
...(entry.emojiScale ? { emojiScale: entry.emojiScale } : {}),
})
}
return instances
}
+1
View File
@@ -64,6 +64,7 @@ export interface Seat {
}
export interface FurnitureInstance {
uid?: string
sprite: SpriteData
/** Pixel x (top-left) */
x: number