@umituz/web-virtual 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,6 +6,19 @@ Build realistic, high-performance, interactive 3D virtual offices, farms, indust
6
6
 
7
7
  All UI strings are **English** so the package drops into any product without locale friction. Consumer-supplied data (entity names, missions, roles) is rendered verbatim.
8
8
 
9
+ ## Architecture vs. data
10
+
11
+ The package ships **architecture only** — buildings, rooms (zones), lighting, and anchor **slots** (where someone *can* sit). All occupant and org data is **yours**, passed in as props:
12
+
13
+ | Package provides | Consumer provides |
14
+ |---|---|
15
+ | 3D engine, camera, raycasting, labels/pins | `entities` — who/what occupies the world |
16
+ | Presets: floorplan geometry, furniture, zones | `departments` — org grouping (else derived from zones) |
17
+ | Anchor `slots` (position, zone, pin number) | `zones` override — localized zone labels |
18
+ | Digital HQ chrome (roster, ops, command center) | Missions, projects, activities, metrics |
19
+
20
+ Entities without an explicit `position` are auto-placed onto preset slots — by `slotId`, by matching `id`, or the next free slot — inheriting position, rotation, zone and pin number from the architecture. You only ever describe **who**, never **where**.
21
+
9
22
  ---
10
23
 
11
24
  ## Features
@@ -16,13 +29,13 @@ All UI strings are **English** so the package drops into any product without loc
16
29
  - **Battery Friendly (1.2.0)**: The render loop pauses automatically while the tab is hidden.
17
30
  - **Locked 60 FPS Performance**: Direct GPU CSS `translate3d` projection for floating labels and pins without React state re-rendering overhead during orbit/zoom.
18
31
  - **Interactive Entities & Raycasting**: Click and hover directly on 3D desks, monitors, robots, or avatars.
19
- - **Architectural Presets**:
20
- - `officePreset`: 17-desk architectural floorplan with executive suite, meeting room, and glass partitions.
21
- - `farmPreset`: Greenhouses, crops, barns, tractors.
22
- - `factoryPreset`: Conveyor belts, robotic arms, storage racks.
23
- - `schoolPreset`: Lecture halls, interactive smartboards, science labs.
24
- - `hospitalPreset`: Triage rooms, consultation suites, patient monitoring.
25
- - **DigitalHQView**: A complete, embeddable "digital headquarters" screen — 3D office floor, operations dashboard, and an AI command center wired through a single `onDispatchMission` callback.
32
+ - **Architectural Presets** (occupant-free — slots only):
33
+ - `officePreset`: 17-desk architectural floorplan with executive suite, meeting room, and glass partitions (`OFFICE_SLOTS`).
34
+ - `farmPreset`: Greenhouses, crops, barns, tractors (`FARM_SLOTS`).
35
+ - `factoryPreset`: Conveyor belts, robotic arms, storage racks (`FACTORY_SLOTS`).
36
+ - `schoolPreset`: Lecture halls, interactive smartboards, science labs (`SCHOOL_SLOTS`).
37
+ - `hospitalPreset`: Triage rooms, consultation suites, patient monitoring (`HOSPITAL_SLOTS`).
38
+ - **DigitalHQView**: A complete, embeddable "digital headquarters" screen — 3D office floor, operations dashboard, and an AI command center wired through a single `onDispatchMission` callback. Departments default to a neutral zone-based grouping when the consumer passes none.
26
39
  - **Contextual Inspector & Profile Drawer**: Role, status, metrics, latest task, and custom application actions.
27
40
  - **Day & Night Simulation**: One-click smooth lighting transitions.
28
41
  - **Pin & Label Modes**: Minimal circular pins (`#1`..`#17`) with status indicators, expandable chips, or hidden mode.
@@ -76,6 +89,24 @@ const world = useMemo(
76
89
  return <VirtualWorld world={world} preset={officePreset} />
77
90
  ```
78
91
 
92
+ ### Your occupants, your language (any preset)
93
+
94
+ Occupants carry no positions — they are auto-placed onto the preset's slots. Pin someone to a specific desk with `slotId`, or let them fill slots in order. Same API for every preset:
95
+
96
+ ```tsx
97
+ import { createEnvironment, farmPreset } from '@umituz/web-virtual'
98
+
99
+ const world = createEnvironment({
100
+ preset: farmPreset,
101
+ name: 'Agromera Çiftlik',
102
+ zones: TurkishZoneLabels, // optional: localize room names
103
+ entities: [
104
+ { slotId: 'slot-1', type: 'person', name: 'Ahmet', role: 'Sera operatörü', status: 'working' },
105
+ { slotId: 'slot-2', type: 'vehicle', name: 'Traktör Alpha', status: 'running' },
106
+ ],
107
+ })
108
+ ```
109
+
79
110
  ### Full digital HQ screen
80
111
 
81
112
  ```tsx
@@ -113,7 +144,7 @@ Ref API (`VirtualWorldRef`): `focusOnEntity`, `setCameraPreset`, `resetCamera`,
113
144
 
114
145
  ### `DigitalHQView`
115
146
 
116
- Everything `VirtualWorld` renders plus an operations dashboard and AI command center. Notable props: `projects`, `activities`, `presetMissions`, `deskCapacity` (defaults to the world's entity count), `getEntityMetrics`, `getEntityLatestTask`, `onDispatchMission({ prompt, targetId, isDemo })`, `onSeedSquad`.
147
+ Everything `VirtualWorld` renders plus an operations dashboard and AI command center. Notable props: `departments` (consumer org data; neutral zone-based groups when omitted), `projects`, `activities`, `presetMissions`, `deskCapacity` (defaults to the world's entity count), `getEntityMetrics`, `getEntityLatestTask`, `onDispatchMission({ prompt, targetId, isDemo })`, `onSeedSquad`.
117
148
 
118
149
  ---
119
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/web-virtual",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "description": "Universal 3D Virtual Environment Engine for Web & React — Offices, Farms, Factories, Schools, Hospitals with 60fps performance, raycasting and interactive entities.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -30,14 +30,15 @@ import {
30
30
  Moon,
31
31
  Sun,
32
32
  RotateCcw,
33
+ Users,
33
34
  } from 'lucide-react'
34
- import type { WorldDefinition, WorldEntity, WorldPreset, PinDisplayMode } from '../core/types'
35
+ import type { WorldDefinition, WorldEntity, WorldPreset, PinDisplayMode, DepartmentInfo } from '../core/types'
36
+ import { deriveDepartmentsFromZones } from '../core/environment'
35
37
  import { VirtualWorld, type VirtualWorldRef } from './VirtualWorld'
36
38
  import { VirtualCommandBar, type PresetMission } from './VirtualCommandBar'
37
39
  import { VirtualRoster } from './VirtualRoster'
38
40
  import { VirtualEntityDrawer, type EntityRunMetrics, type EntityLatestTask } from './VirtualEntityDrawer'
39
41
  import { VirtualReportModal, type VirtualReportData } from './VirtualReportModal'
40
- import { DEFAULT_OFFICE_DEPARTMENTS, type DepartmentInfo } from '../presets/officePreset'
41
42
 
42
43
  export type OperationalMode = 'office' | 'operations' | 'command_center'
43
44
 
@@ -83,7 +84,7 @@ export interface DigitalHQViewProps {
83
84
  export function DigitalHQView({
84
85
  world,
85
86
  preset,
86
- departments = DEFAULT_OFFICE_DEPARTMENTS,
87
+ departments: departmentsProp,
87
88
  presetMissions = [],
88
89
  projects = [],
89
90
  activities = [],
@@ -193,6 +194,13 @@ export function DigitalHQView({
193
194
  return world.entities.filter((e) => e.status === 'running' || e.status === 'working').length
194
195
  }, [world.entities])
195
196
 
197
+ // Departments are consumer org data. When none are supplied, derive a
198
+ // neutral grouping from the preset's architectural zones instead.
199
+ const departments = useMemo<DepartmentInfo[]>(() => {
200
+ if (departmentsProp && departmentsProp.length > 0) return departmentsProp
201
+ return deriveDepartmentsFromZones(world.zones, preset?.slots ?? [])
202
+ }, [departmentsProp, world.zones, preset])
203
+
196
204
  const pendingApprovalsCount = useMemo(() => {
197
205
  return world.entities.filter((e) => e.status === 'awaiting_approval').length
198
206
  }, [world.entities])
@@ -435,6 +443,31 @@ export function DigitalHQView({
435
443
  showControls={false}
436
444
  showInspector={false}
437
445
  >
446
+ {/* Friendly empty state when no occupants are placed yet */}
447
+ {world.entities.length === 0 && (
448
+ <div className="wv-hq-empty-floor">
449
+ <div className="wv-hq-empty-floor-card">
450
+ <Users size={28} />
451
+ <h3>The floor is ready — nobody is in yet</h3>
452
+ <p>
453
+ All {capacity} desks are installed and waiting. Bring your team in and they
454
+ will take their seats here in 3D.
455
+ </p>
456
+ {onSeedSquad && (
457
+ <button
458
+ type="button"
459
+ onClick={onSeedSquad}
460
+ disabled={isSeeding}
461
+ className="wv-hq-empty-floor-btn"
462
+ >
463
+ {isSeeding ? <Loader2 size={14} className="wv-spin" /> : <Sparkles size={14} />}
464
+ <span>Build the squad ({capacity})</span>
465
+ </button>
466
+ )}
467
+ </div>
468
+ </div>
469
+ )}
470
+
438
471
  {/* Floating Bottom Command Bar Overlay */}
439
472
  <VirtualCommandBar
440
473
  presetMissions={presetMissions}
@@ -554,7 +587,7 @@ export function DigitalHQView({
554
587
 
555
588
  <div className="wv-hq-dept-cards-grid">
556
589
  {departments.map((dept) => {
557
- const deptEntities = world.entities.filter((e) => dept.slotIds.includes(e.id))
590
+ const deptEntities = world.entities.filter((e) => (dept.slotIds ?? []).includes(e.id))
558
591
  const isDeptBusy = deptEntities.some((e) => e.status === 'running' || e.status === 'working')
559
592
 
560
593
  return (
@@ -573,7 +606,7 @@ export function DigitalHQView({
573
606
  <button
574
607
  type="button"
575
608
  onClick={() => {
576
- setSelectedCategory(dept.slug)
609
+ setSelectedCategory(dept.slug ?? dept.id)
577
610
  setActiveMode('office')
578
611
  }}
579
612
  className="wv-dept-link-btn"
@@ -10,8 +10,7 @@ import {
10
10
  Globe,
11
11
  Shield,
12
12
  } from 'lucide-react'
13
- import type { WorldEntity } from '../core/types'
14
- import type { DepartmentInfo } from '../presets/officePreset'
13
+ import type { WorldEntity, DepartmentInfo } from '../core/types'
15
14
 
16
15
  export interface VirtualRosterProps {
17
16
  entities: WorldEntity[]
@@ -47,9 +46,9 @@ export function VirtualRoster({
47
46
  if (searchQuery && !nameMatch && !roleMatch) return false
48
47
 
49
48
  if (selectedCategory !== 'all') {
50
- const dept = departments.find((d) => d.slug === selectedCategory)
49
+ const dept = departments.find((d) => (d.slug ?? d.id) === selectedCategory)
51
50
  if (dept) {
52
- if (!dept.slotIds.includes(en.id)) return false
51
+ if (!(dept.slotIds ?? []).includes(en.id)) return false
53
52
  } else if (en.department !== selectedCategory && en.zoneId !== selectedCategory) {
54
53
  return false
55
54
  }
@@ -126,7 +125,7 @@ export function VirtualRoster({
126
125
  <button
127
126
  key={dept.id}
128
127
  type="button"
129
- onClick={() => onSelectCategory(dept.slug)}
128
+ onClick={() => onSelectCategory(dept.slug ?? dept.id)}
130
129
  className={`wv-roster-pill ${selectedCategory === dept.slug ? 'is-active' : ''}`}
131
130
  >
132
131
  {dept.name.split(' ')[0]}
@@ -1,9 +1,15 @@
1
- import { describe, it, expect } from 'vitest'
2
- import { createEnvironment, validateEnvironment } from './environment'
3
- import { officePreset, farmPreset, factoryPreset, schoolPreset, hospitalPreset } from '../presets/index'
1
+ import { describe, it, expect, vi } from 'vitest'
2
+ import {
3
+ createEnvironment,
4
+ validateEnvironment,
5
+ placeEntitiesOnSlots,
6
+ deriveDepartmentsFromZones,
7
+ } from './environment'
8
+ import type { EntityDraft } from './types'
9
+ import { officePreset, farmPreset, factoryPreset, OFFICE_SLOTS, FARM_SLOTS } from '../presets/index'
4
10
 
5
11
  describe('Environment Factory & Presets', () => {
6
- it('creates an environment using officePreset', () => {
12
+ it('creates an office environment with architecture but no occupants', () => {
7
13
  const world = createEnvironment({
8
14
  preset: officePreset,
9
15
  name: 'Nexora Agency HQ',
@@ -13,28 +19,106 @@ describe('Environment Factory & Presets', () => {
13
19
  expect(world.type).toBe('office')
14
20
  expect(world.dimensions.width).toBe(36)
15
21
  expect(world.zones.length).toBe(6)
16
- expect(world.entities.length).toBe(17)
22
+ expect(world.entities).toEqual([])
17
23
  })
18
24
 
19
- it('creates an environment using farmPreset', () => {
25
+ it('auto-places consumer occupants onto preset slots in order', () => {
26
+ const occupants: EntityDraft[] = [
27
+ { id: 'gm', type: 'person', name: 'Ayşe Yıldız', role: 'CEO', status: 'idle' },
28
+ { id: 'dev', type: 'person', name: 'Mehmet Kaya', role: 'Developer', status: 'running' },
29
+ ]
30
+
20
31
  const world = createEnvironment({
21
- preset: farmPreset,
22
- name: 'Organic Farm Valley',
32
+ preset: officePreset,
33
+ name: 'Team HQ',
34
+ entities: occupants,
23
35
  })
24
36
 
25
- expect(world.type).toBe('farm')
26
- expect(world.zones.length).toBe(3)
27
- expect(world.entities.length).toBe(3)
37
+ expect(world.entities).toHaveLength(2)
38
+ expect(world.entities[0]!.slotId).toBe('slot-1')
39
+ expect(world.entities[0]!.position).toEqual(OFFICE_SLOTS[0]!.position)
40
+ expect(world.entities[0]!.zoneId).toBe('executive')
41
+ expect(world.entities[0]!.pinNumber).toBe(1)
42
+ expect(world.entities[0]!.avatarColor).toBe(OFFICE_SLOTS[0]!.avatarColor)
43
+ expect(world.entities[1]!.slotId).toBe('slot-2')
44
+ expect(world.entities[1]!.position).toEqual(OFFICE_SLOTS[1]!.position)
45
+ // Omitted fields inherit the slot's architectural suggestion
46
+ expect(world.entities[1]!.avatarColor).toBe(OFFICE_SLOTS[1]!.avatarColor)
47
+ expect(world.entities[1]!.zoneId).toBe('growth')
28
48
  })
29
49
 
30
- it('creates an environment using factoryPreset', () => {
50
+ it('lets consumer fields override slot suggestions', () => {
31
51
  const world = createEnvironment({
32
- preset: factoryPreset,
33
- name: 'Auto Plant 4',
52
+ preset: officePreset,
53
+ name: 'HQ',
54
+ entities: [{ id: 'slot-1', type: 'person', name: 'GM', avatarColor: '#ff0055', zoneId: 'meeting' }],
34
55
  })
35
56
 
36
- expect(world.type).toBe('factory')
37
- expect(world.entities.length).toBe(3)
57
+ expect(world.entities[0]!.avatarColor).toBe('#ff0055')
58
+ expect(world.entities[0]!.zoneId).toBe('meeting')
59
+ expect(world.entities[0]!.position).toEqual(OFFICE_SLOTS[0]!.position)
60
+ })
61
+
62
+ it('pins an occupant to a specific slot via slotId and keeps explicit positions', () => {
63
+ const occupants: EntityDraft[] = [
64
+ { id: 'founder', slotId: 'slot-17', type: 'person', name: 'Founder' },
65
+ { id: 'visitor', type: 'person', name: 'Visitor', position: [0, 0, 0] },
66
+ ]
67
+
68
+ const world = createEnvironment({ preset: officePreset, name: 'HQ', entities: occupants })
69
+
70
+ expect(world.entities[0]!.slotId).toBe('slot-17')
71
+ expect(world.entities[0]!.position).toEqual(OFFICE_SLOTS[16]!.position)
72
+ // Explicit positions pass through untouched and do not consume a slot
73
+ expect(world.entities[1]!.position).toEqual([0, 0, 0])
74
+ expect(world.entities[1]!.slotId).toBeUndefined()
75
+ })
76
+
77
+ it('skips occupants when no free slot is left and warns', () => {
78
+ const consoleWarn = vi.spyOn(console, 'warn').mockImplementation(() => {})
79
+ try {
80
+ const slots = FARM_SLOTS.slice(0, 1)
81
+ const placed = placeEntitiesOnSlots(
82
+ [
83
+ { id: 'a', type: 'person', name: 'A' },
84
+ { id: 'b', type: 'person', name: 'B' },
85
+ ],
86
+ slots,
87
+ )
88
+ expect(placed).toHaveLength(1)
89
+ expect(placed[0]!.slotId).toBe('slot-1')
90
+ expect(consoleWarn).toHaveBeenCalledTimes(1)
91
+ } finally {
92
+ consoleWarn.mockRestore()
93
+ }
94
+ })
95
+
96
+ it('keeps farm and factory presets slot-based and occupant-free', () => {
97
+ const farm = createEnvironment({ preset: farmPreset, name: 'Agromera Farm' })
98
+ expect(farm.type).toBe('farm')
99
+ expect(farm.zones.length).toBe(3)
100
+ expect(farm.entities).toEqual([])
101
+
102
+ const factory = createEnvironment({ preset: factoryPreset, name: 'Auto Plant 4' })
103
+ expect(factory.type).toBe('factory')
104
+ expect(factory.entities).toEqual([])
105
+ })
106
+
107
+ it('derives neutral departments from zones with their slots', () => {
108
+ const departments = deriveDepartmentsFromZones(
109
+ [
110
+ { id: 'greenhouse', name: 'Greenhouse', color: '#22c55e' },
111
+ { id: 'barn', name: 'Barn' },
112
+ ],
113
+ [
114
+ { id: 'slot-1', label: 'Greenhouse station', position: [0, 0, 0], zoneId: 'greenhouse' },
115
+ { id: 'slot-2', label: 'Barn station', position: [1, 0, 0], zoneId: 'barn' },
116
+ ],
117
+ )
118
+
119
+ expect(departments).toHaveLength(2)
120
+ expect(departments[0]).toMatchObject({ slug: 'greenhouse', name: 'Greenhouse', color: '#22c55e', slotIds: ['slot-1'] })
121
+ expect(departments[1]).toMatchObject({ slug: 'barn', slotIds: ['slot-2'] })
38
122
  })
39
123
 
40
124
  it('validates environment entity ids and positions', () => {
@@ -2,8 +2,93 @@ import type {
2
2
  WorldDefinition,
3
3
  CreateEnvironmentOptions,
4
4
  WorldEntity,
5
+ EntityDraft,
6
+ WorldSlot,
7
+ WorldZone,
8
+ DepartmentInfo,
5
9
  } from './types'
6
10
 
11
+ /**
12
+ * Place entities onto preset anchor slots. Entities that already carry an
13
+ * explicit `position` are kept as-is. Otherwise each entity is matched to a
14
+ * slot by `slotId` (or its own `id`), falling back to the next free slot in
15
+ * declaration order. Slot data (position, rotation, zoneId, pinNumber,
16
+ * avatarColor) fills in any fields the entity left empty, so consumers only
17
+ * describe WHO sits somewhere — never WHERE.
18
+ */
19
+ export function placeEntitiesOnSlots(
20
+ entities: EntityDraft[],
21
+ slots: WorldSlot[],
22
+ ): WorldEntity[] {
23
+ const placed: WorldEntity[] = []
24
+
25
+ if (slots.length === 0) {
26
+ for (const entity of entities) {
27
+ if (!entity.position) {
28
+ console.warn(
29
+ `[web-virtual] Entity "${entity.id}" has no position and the preset has no slots — it was skipped.`,
30
+ )
31
+ continue
32
+ }
33
+ placed.push(entity as WorldEntity)
34
+ }
35
+ return placed
36
+ }
37
+
38
+ const slotsById = new Map(slots.map((s) => [s.id, s]))
39
+ const used = new Set<string>()
40
+
41
+ for (const entity of entities) {
42
+ if (entity.position) {
43
+ placed.push(entity as WorldEntity)
44
+ continue
45
+ }
46
+
47
+ const slot = (entity.slotId && slotsById.get(entity.slotId)) || slotsById.get(entity.id)
48
+ const resolved = slot && !used.has(slot.id) ? slot : slots.find((s) => !used.has(s.id))
49
+
50
+ if (!resolved) {
51
+ console.warn(
52
+ `[web-virtual] No free slot left for entity "${entity.id}" — it was skipped. ` +
53
+ `Pass an explicit position or add more slots to the preset.`,
54
+ )
55
+ continue
56
+ }
57
+
58
+ used.add(resolved.id)
59
+ placed.push({
60
+ ...entity,
61
+ slotId: resolved.id,
62
+ position: resolved.position,
63
+ rotation: entity.rotation ?? resolved.rotation,
64
+ zoneId: entity.zoneId ?? resolved.zoneId,
65
+ pinNumber: entity.pinNumber ?? resolved.pinNumber,
66
+ avatarColor: entity.avatarColor ?? resolved.avatarColor,
67
+ })
68
+ }
69
+
70
+ return placed
71
+ }
72
+
73
+ /**
74
+ * Neutral department grouping derived from preset zones — used when the
75
+ * consumer passes no `departments`. One group per zone, keyed by zone id.
76
+ */
77
+ export function deriveDepartmentsFromZones(
78
+ zones: WorldZone[],
79
+ slots: WorldSlot[] = [],
80
+ ): DepartmentInfo[] {
81
+ return zones.map((zone) => ({
82
+ id: `zone-${zone.id}`,
83
+ name: zone.name,
84
+ slug: zone.id,
85
+ description: zone.description,
86
+ color: zone.color,
87
+ zoneId: zone.id,
88
+ slotIds: slots.filter((s) => s.zoneId === zone.id).map((s) => s.id),
89
+ }))
90
+ }
91
+
7
92
  export function createEnvironment(options: CreateEnvironmentOptions): WorldDefinition {
8
93
  const preset = options.preset
9
94
 
@@ -66,13 +151,14 @@ export function createEnvironment(options: CreateEnvironmentOptions): WorldDefin
66
151
 
67
152
  const zones = options.zones || preset?.zones || []
68
153
 
69
- // If user provided entities, use them; otherwise if preset has defaults, use those
70
- let entities: WorldEntity[] = []
71
- if (options.entities && options.entities.length > 0) {
72
- entities = options.entities
73
- } else if (preset?.defaultEntities) {
74
- entities = preset.defaultEntities
75
- }
154
+ // Occupants come from the consumer. If none are given, an optional preset
155
+ // default may supply demo occupants. Either way, entities without an
156
+ // explicit position are auto-placed onto the preset's architectural slots.
157
+ const sourceEntities: EntityDraft[] =
158
+ options.entities && options.entities.length > 0
159
+ ? options.entities
160
+ : (preset?.defaultEntities ?? [])
161
+ const entities = placeEntitiesOnSlots(sourceEntities, preset?.slots ?? [])
76
162
 
77
163
  const world: WorldDefinition = {
78
164
  id,
package/src/core/types.ts CHANGED
@@ -30,6 +30,10 @@ export interface WorldEntity {
30
30
  zoneId?: string
31
31
  description?: string
32
32
  status?: EntityStatus
33
+ /**
34
+ * Anchor slot this entity was placed on (mirrors `WorldPreset.slots` ids).
35
+ */
36
+ slotId?: string
33
37
  position: Vector3Tuple
34
38
  rotation?: Vector3Tuple
35
39
  scale?: Vector3Tuple
@@ -41,6 +45,34 @@ export interface WorldEntity {
41
45
  metadata?: Record<string, unknown>
42
46
  }
43
47
 
48
+ /**
49
+ * Occupant input accepted by `createEnvironment` — a full `WorldEntity` minus
50
+ * the required placement fields. If `position` is omitted the entity is
51
+ * auto-placed onto a preset slot (by `slotId`, by matching `id`, or the next
52
+ * free slot in order), inheriting the slot's position, rotation, zoneId,
53
+ * pinNumber and suggested avatarColor.
54
+ */
55
+ export type EntityDraft = Omit<WorldEntity, 'position'> & { position?: Vector3Tuple }
56
+
57
+ /**
58
+ * Architectural anchor point on a preset where a consumer entity can be
59
+ * placed — a desk, workstation, field station, machine bay, etc. Slots carry
60
+ * no occupant data: who (or what) sits there always comes from the consumer.
61
+ */
62
+ export interface WorldSlot {
63
+ id: string
64
+ /** Neutral architectural label, e.g. "Executive desk", "Workstation 4". */
65
+ label: string
66
+ position: Vector3Tuple
67
+ rotation?: Vector3Tuple
68
+ zoneId?: string
69
+ pinNumber?: number
70
+ /** Suggested avatar color — consumer entities may override. */
71
+ avatarColor?: string
72
+ /** Free-form architecture hints, e.g. `{ desk: 'workstation', dualMonitor: true }`. */
73
+ metadata?: Record<string, unknown>
74
+ }
75
+
44
76
  export interface WorldZone {
45
77
  id: string
46
78
  name: string
@@ -139,10 +171,26 @@ export interface CreateEnvironmentOptions {
139
171
  lighting?: Partial<LightingConfiguration>
140
172
  theme?: Partial<WorldTheme>
141
173
  zones?: WorldZone[]
142
- entities?: WorldEntity[]
174
+ entities?: EntityDraft[]
143
175
  metadata?: Record<string, unknown>
144
176
  }
145
177
 
178
+ /**
179
+ * Consumer-supplied grouping shown in the roster filter and the operations
180
+ * dashboard. Pure org data — the package never ships defaults; when the
181
+ * consumer passes none, groups are derived neutrally from preset zones.
182
+ */
183
+ export interface DepartmentInfo {
184
+ id: string
185
+ name: string
186
+ slug?: string
187
+ description?: string
188
+ color?: string
189
+ slotIds?: string[]
190
+ zoneId?: string
191
+ iconName?: 'briefcase' | 'palette' | 'megaphone' | 'shield' | 'globe'
192
+ }
193
+
146
194
  export interface WorldPreset {
147
195
  id: string
148
196
  name: string
@@ -157,7 +205,10 @@ export interface WorldPreset {
157
205
  lighting: LightingConfiguration
158
206
  theme: WorldTheme
159
207
  zones: WorldZone[]
160
- defaultEntities?: WorldEntity[]
208
+ /** Architectural anchor points for consumer entities (no occupant data). */
209
+ slots?: WorldSlot[]
210
+ /** Optional demo occupants — shipped presets deliberately leave this empty. */
211
+ defaultEntities?: EntityDraft[]
161
212
  buildScene?: (scene: import('three').Scene, options: { nightMode?: boolean; theme?: WorldTheme }) => void
162
213
  }
163
214
 
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three'
2
- import type { WorldPreset, WorldEntity, WorldZone } from '../core/types'
2
+ import type { WorldPreset, WorldSlot, WorldZone } from '../core/types'
3
3
  import { MaterialPalette } from '../engine/materials'
4
4
 
5
5
  export const DEFAULT_FACTORY_ZONES: WorldZone[] = [
@@ -26,44 +26,13 @@ export const DEFAULT_FACTORY_ZONES: WorldZone[] = [
26
26
  },
27
27
  ]
28
28
 
29
- export const DEFAULT_FACTORY_ENTITIES: WorldEntity[] = [
30
- {
31
- id: 'factory-op-1',
32
- type: 'person',
33
- name: 'Serkan — Line Chief',
34
- role: 'Production flow supervisor',
35
- department: 'Manufacturing',
36
- zoneId: 'assembly_line',
37
- status: 'working',
38
- pinNumber: 1,
39
- position: [-6, 0, 2],
40
- avatarColor: '#0369a1',
41
- },
42
- {
43
- id: 'robot-arm-1',
44
- type: 'equipment',
45
- name: 'Robotic Arm RX-4',
46
- role: 'Precision welding & assembly',
47
- department: 'Robotics',
48
- zoneId: 'assembly_line',
49
- status: 'running',
50
- pinNumber: 2,
51
- position: [-6, 0, -2],
52
- },
53
- {
54
- id: 'factory-inspector',
55
- type: 'person',
56
- name: 'Ebru — Quality Engineer',
57
- role: 'Tolerance verification',
58
- department: 'Quality',
59
- zoneId: 'quality_control',
60
- status: 'idle',
61
- pinNumber: 3,
62
- position: [6, 0, -4],
63
- avatarColor: '#047857',
64
- },
29
+ export const FACTORY_SLOTS: WorldSlot[] = [
30
+ { id: 'slot-1', label: 'Assembly line station', position: [-6, 0, 2], zoneId: 'assembly_line', pinNumber: 1, avatarColor: '#0369a1' },
31
+ { id: 'slot-2', label: 'Robotic arm bay', position: [-6, 0, -2], zoneId: 'assembly_line', pinNumber: 2 },
32
+ { id: 'slot-3', label: 'Quality control station', position: [6, 0, -4], zoneId: 'quality_control', pinNumber: 3, avatarColor: '#047857' },
65
33
  ]
66
34
 
35
+
67
36
  export const factoryPreset: WorldPreset = {
68
37
  id: 'preset-factory',
69
38
  name: 'Smart Industrial Automation Plant',
@@ -97,7 +66,7 @@ export const factoryPreset: WorldPreset = {
97
66
  nightBackgroundColor: '#020617',
98
67
  },
99
68
  zones: DEFAULT_FACTORY_ZONES,
100
- defaultEntities: DEFAULT_FACTORY_ENTITIES,
69
+ slots: FACTORY_SLOTS,
101
70
 
102
71
  buildScene: (scene: THREE.Scene, options) => {
103
72
  const materials = new MaterialPalette()
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three'
2
- import type { WorldPreset, WorldEntity, WorldZone } from '../core/types'
2
+ import type { WorldPreset, WorldSlot, WorldZone } from '../core/types'
3
3
  import { MaterialPalette } from '../engine/materials'
4
4
 
5
5
  export const DEFAULT_FARM_ZONES: WorldZone[] = [
@@ -26,44 +26,13 @@ export const DEFAULT_FARM_ZONES: WorldZone[] = [
26
26
  },
27
27
  ]
28
28
 
29
- export const DEFAULT_FARM_ENTITIES: WorldEntity[] = [
30
- {
31
- id: 'farm-worker-1',
32
- type: 'person',
33
- name: 'Ahmet — Greenhouse Operator',
34
- role: 'Climate control & irrigation',
35
- department: 'Greenhouse Operations',
36
- zoneId: 'greenhouse',
37
- status: 'working',
38
- pinNumber: 1,
39
- position: [-8, 0, -5],
40
- avatarColor: '#15803d',
41
- },
42
- {
43
- id: 'farm-tractor-1',
44
- type: 'vehicle',
45
- name: 'Autonomous Tractor Alpha',
46
- role: 'Plot plowing & crop dusting',
47
- department: 'Fleet Management',
48
- zoneId: 'crop_fields',
49
- status: 'running',
50
- pinNumber: 2,
51
- position: [6, 0, -4],
52
- },
53
- {
54
- id: 'farm-worker-2',
55
- type: 'person',
56
- name: 'Mehmet — Harvest Supervisor',
57
- role: 'Packaging & storage',
58
- department: 'Logistics',
59
- zoneId: 'barn_storage',
60
- status: 'idle',
61
- pinNumber: 3,
62
- position: [0, 0, 6],
63
- avatarColor: '#b45309',
64
- },
29
+ export const FARM_SLOTS: WorldSlot[] = [
30
+ { id: 'slot-1', label: 'Greenhouse station', position: [-8, 0, -5], zoneId: 'greenhouse', pinNumber: 1, avatarColor: '#15803d' },
31
+ { id: 'slot-2', label: 'Crop field unit', position: [6, 0, -4], zoneId: 'crop_fields', pinNumber: 2 },
32
+ { id: 'slot-3', label: 'Barn & logistics station', position: [0, 0, 6], zoneId: 'barn_storage', pinNumber: 3, avatarColor: '#b45309' },
65
33
  ]
66
34
 
35
+
67
36
  export const farmPreset: WorldPreset = {
68
37
  id: 'preset-farm',
69
38
  name: 'Smart Agriculture & Greenhouse Complex',
@@ -100,7 +69,7 @@ export const farmPreset: WorldPreset = {
100
69
  nightBackgroundColor: '#020d04',
101
70
  },
102
71
  zones: DEFAULT_FARM_ZONES,
103
- defaultEntities: DEFAULT_FARM_ENTITIES,
72
+ slots: FARM_SLOTS,
104
73
 
105
74
  buildScene: (scene: THREE.Scene, options) => {
106
75
  const materials = new MaterialPalette()
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three'
2
- import type { WorldPreset, WorldEntity, WorldZone } from '../core/types'
2
+ import type { WorldPreset, WorldSlot, WorldZone } from '../core/types'
3
3
  import { MaterialPalette } from '../engine/materials'
4
4
 
5
5
  export const DEFAULT_HOSPITAL_ZONES: WorldZone[] = [
@@ -26,33 +26,12 @@ export const DEFAULT_HOSPITAL_ZONES: WorldZone[] = [
26
26
  },
27
27
  ]
28
28
 
29
- export const DEFAULT_HOSPITAL_ENTITIES: WorldEntity[] = [
30
- {
31
- id: 'doctor-1',
32
- type: 'person',
33
- name: 'Dr. Selin — Chief Physician',
34
- role: 'Clinical director & medical decisions',
35
- department: 'Surgery',
36
- zoneId: 'consultation',
37
- status: 'working',
38
- pinNumber: 1,
39
- position: [4, 0, -4],
40
- avatarColor: '#0284c7',
41
- },
42
- {
43
- id: 'nurse-1',
44
- type: 'person',
45
- name: 'Nurse Burak — Triage Specialist',
46
- role: 'Patient intake & vitals monitoring',
47
- department: 'Emergency',
48
- zoneId: 'triage_er',
49
- status: 'idle',
50
- pinNumber: 2,
51
- position: [-8, 0, 0],
52
- avatarColor: '#059669',
53
- },
29
+ export const HOSPITAL_SLOTS: WorldSlot[] = [
30
+ { id: 'slot-1', label: 'Triage station', position: [-8, 0, 0], zoneId: 'triage_er', pinNumber: 1, avatarColor: '#059669' },
31
+ { id: 'slot-2', label: 'Consultation room station', position: [4, 0, -4], zoneId: 'consultation', pinNumber: 2, avatarColor: '#0284c7' },
54
32
  ]
55
33
 
34
+
56
35
  export const hospitalPreset: WorldPreset = {
57
36
  id: 'preset-hospital',
58
37
  name: 'Smart Healthcare & Hospital Medical Center',
@@ -85,7 +64,7 @@ export const hospitalPreset: WorldPreset = {
85
64
  backgroundColor: '#042f2e',
86
65
  },
87
66
  zones: DEFAULT_HOSPITAL_ZONES,
88
- defaultEntities: DEFAULT_HOSPITAL_ENTITIES,
67
+ slots: HOSPITAL_SLOTS,
89
68
 
90
69
  buildScene: (scene: THREE.Scene, options) => {
91
70
  const materials = new MaterialPalette()
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three'
2
- import type { WorldPreset, WorldEntity, WorldZone } from '../core/types'
2
+ import type { WorldPreset, WorldSlot, WorldZone } from '../core/types'
3
3
  import { MaterialPalette } from '../engine/materials'
4
4
  import { buildOfficeArchitecture } from '../entities/architecture/OfficeArchitectureBuilder'
5
5
  import { createModernWorkstation, createExecutiveDesk, createConferenceTable } from '../entities/furniture/DeskBuilder'
@@ -51,310 +51,39 @@ export const DEFAULT_OFFICE_ZONES: WorldZone[] = [
51
51
  },
52
52
  ]
53
53
 
54
- export interface DepartmentInfo {
55
- id: string
56
- name: string
57
- slug: string
58
- description: string
59
- managerSlotId: string
60
- managerRole: string
61
- color: string
62
- slotIds: string[]
63
- iconName?: 'briefcase' | 'palette' | 'megaphone' | 'shield' | 'globe'
64
- }
54
+ type OfficeDeskKind = 'executive' | 'workstation' | 'meeting'
65
55
 
66
- export const DEFAULT_OFFICE_DEPARTMENTS: DepartmentInfo[] = [
67
- {
68
- id: 'dept-management',
69
- name: 'General Management & Strategy',
70
- slug: 'management',
71
- description: 'Company vision, department coordination, strategic planning and approval audits.',
72
- managerSlotId: 'slot-1',
73
- managerRole: 'Digital Agency Director (General Manager)',
74
- color: '#3b82f6',
75
- slotIds: ['slot-1', 'slot-13'],
76
- iconName: 'briefcase',
77
- },
78
- {
79
- id: 'dept-creative',
80
- name: 'Content & Creative Design',
81
- slug: 'creative',
82
- description: 'Social media content, visual concepts, ad hooks and viral video production.',
83
- managerSlotId: 'slot-3',
84
- managerRole: 'Creative Visual Director',
85
- color: '#a855f7',
86
- slotIds: ['slot-2', 'slot-3', 'slot-4', 'slot-5'],
87
- iconName: 'palette',
88
- },
89
- {
90
- id: 'dept-marketing',
91
- name: 'Marketing & Growth',
92
- slug: 'marketing',
93
- description: 'Google & Meta ads, organic SEO, email funnel automation and customer relationships (CRM).',
94
- managerSlotId: 'slot-6',
95
- managerRole: 'Performance Marketing & Media Buying',
96
- color: '#10b981',
97
- slotIds: ['slot-6', 'slot-7', 'slot-8', 'slot-9', 'slot-14'],
98
- iconName: 'megaphone',
99
- },
100
- {
101
- id: 'dept-tech',
102
- name: 'Technology, UI/UX & Data',
103
- slug: 'tech',
104
- description: 'Conversion-focused web interfaces, landing page wireframes and campaign growth analytics.',
105
- managerSlotId: 'slot-11',
106
- managerRole: 'UI/UX & Web Interface Designer',
107
- color: '#06b6d4',
108
- slotIds: ['slot-11', 'slot-12'],
109
- iconName: 'globe',
110
- },
111
- {
112
- id: 'dept-operations',
113
- name: 'Operations, Quality & Finance',
114
- slug: 'operations',
115
- description: 'Revenue/expense balance, budget control, quality assurance and the corporate knowledge archive.',
116
- managerSlotId: 'slot-10',
117
- managerRole: 'Agency Accountant & Finance Specialist',
118
- color: '#f59e0b',
119
- slotIds: ['slot-10', 'slot-15', 'slot-16', 'slot-17'],
120
- iconName: 'shield',
121
- },
122
- ]
123
-
124
- // 17 standard desk positions matching the reference architectural layout
125
- export const DEFAULT_OFFICE_ENTITIES: WorldEntity[] = [
126
- // 1. General Manager / Executive Suite
56
+ /**
57
+ * The 17 architectural anchor points of the office floorplan — the single
58
+ * source of truth for BOTH `buildScene` furniture placement and consumer
59
+ * entity auto-placement. Slots describe WHERE someone can sit, never WHO.
60
+ */
61
+ export const OFFICE_SLOTS: WorldSlot[] = [
127
62
  {
128
63
  id: 'slot-1',
129
- type: 'person',
130
- name: 'General Manager (CEO)',
131
- role: 'Company director & orchestrator',
132
- department: 'Management',
64
+ label: 'Executive desk',
65
+ position: [11, 0, -5.5],
133
66
  zoneId: 'executive',
134
- status: 'idle',
135
67
  pinNumber: 1,
136
- position: [11, 0, -5.5],
137
- rotation: [0, 0, 0],
138
68
  avatarColor: '#1e293b',
139
- avatarHair: '#0f172a',
140
- },
141
- // Row 1 (Creative & Ads)
142
- {
143
- id: 'slot-2',
144
- type: 'person',
145
- name: 'Performance Marketing Specialist',
146
- role: 'Ads & campaign optimization',
147
- department: 'Marketing',
148
- zoneId: 'growth',
149
- status: 'idle',
150
- pinNumber: 2,
151
- position: [-13, 0, -6.8],
152
- rotation: [0, 0, 0],
153
- avatarColor: '#0284c7',
154
- },
155
- {
156
- id: 'slot-3',
157
- type: 'person',
158
- name: 'Creative Director',
159
- role: 'Visual identity & design',
160
- department: 'Creative',
161
- zoneId: 'creative',
162
- status: 'idle',
163
- pinNumber: 3,
164
- position: [-9, 0, -6.8],
165
- rotation: [0, 0, 0],
166
- avatarColor: '#db2777',
167
- },
168
- {
169
- id: 'slot-4',
170
- type: 'person',
171
- name: 'Ads Manager',
172
- role: 'Budget & conversion strategy',
173
- department: 'Marketing',
174
- zoneId: 'growth',
175
- status: 'idle',
176
- pinNumber: 4,
177
- position: [-5, 0, -6.8],
178
- rotation: [0, 0, 0],
179
- avatarColor: '#2563eb',
180
- },
181
- {
182
- id: 'slot-5',
183
- type: 'person',
184
- name: 'Email Marketing Specialist',
185
- role: 'CRM & newsletter flows',
186
- department: 'Marketing',
187
- zoneId: 'growth',
188
- status: 'idle',
189
- pinNumber: 5,
190
- position: [-1, 0, -6.8],
191
- rotation: [0, 0, 0],
192
- avatarColor: '#7c3aed',
193
- },
194
-
195
- // Row 2 (Content, Video, Management)
196
- {
197
- id: 'slot-6',
198
- type: 'person',
199
- name: 'Social Media Manager',
200
- role: 'Community & content calendar',
201
- department: 'Creative',
202
- zoneId: 'creative',
203
- status: 'idle',
204
- pinNumber: 6,
205
- position: [-13, 0, -2.0],
206
- rotation: [0, 0, 0],
207
- avatarColor: '#ea580c',
208
- },
209
- {
210
- id: 'slot-7',
211
- type: 'person',
212
- name: 'Agency Operations Lead',
213
- role: 'Process & workflow tracking',
214
- department: 'Operations',
215
- zoneId: 'operations',
216
- status: 'idle',
217
- pinNumber: 7,
218
- position: [-9, 0, -2.0],
219
- rotation: [0, 0, 0],
220
- avatarColor: '#059669',
221
- },
222
- {
223
- id: 'slot-8',
224
- type: 'person',
225
- name: 'Video & Motion Producer',
226
- role: 'Reels, editing & animation',
227
- department: 'Creative',
228
- zoneId: 'creative',
229
- status: 'idle',
230
- pinNumber: 8,
231
- position: [-5, 0, -2.0],
232
- rotation: [0, 0, 0],
233
- avatarColor: '#dc2626',
234
- },
235
- {
236
- id: 'slot-9',
237
- type: 'person',
238
- name: 'Client Services Director',
239
- role: 'Team & client coordination',
240
- department: 'Management',
241
- zoneId: 'executive',
242
- status: 'idle',
243
- pinNumber: 9,
244
- position: [-1, 0, -2.0],
245
- rotation: [0, 0, 0],
246
- avatarColor: '#4f46e5',
247
- },
248
-
249
- // Row 3 (Copywriter, Research, SEO)
250
- {
251
- id: 'slot-10',
252
- type: 'person',
253
- name: 'Copywriter',
254
- role: 'Landing & ad copy',
255
- department: 'Creative',
256
- zoneId: 'creative',
257
- status: 'idle',
258
- pinNumber: 10,
259
- position: [-13, 0, 2.8],
260
- rotation: [0, 0, 0],
261
- avatarColor: '#0891b2',
262
- },
263
- {
264
- id: 'slot-11',
265
- type: 'person',
266
- name: 'Market Researcher',
267
- role: 'Competitor & trend analysis',
268
- department: 'Marketing',
269
- zoneId: 'growth',
270
- status: 'idle',
271
- pinNumber: 11,
272
- position: [-9, 0, 2.8],
273
- rotation: [0, 0, 0],
274
- avatarColor: '#16a34a',
275
- },
276
- {
277
- id: 'slot-12',
278
- type: 'person',
279
- name: 'Brand Strategist',
280
- role: 'Positioning & messaging',
281
- department: 'Management',
282
- zoneId: 'executive',
283
- status: 'idle',
284
- pinNumber: 12,
285
- position: [-5, 0, 2.8],
286
- rotation: [0, 0, 0],
287
- avatarColor: '#9333ea',
288
- },
289
- {
290
- id: 'slot-13',
291
- type: 'person',
292
- name: 'SEO & Organic Growth',
293
- role: 'Search engine & content distribution',
294
- department: 'Marketing',
295
- zoneId: 'growth',
296
- status: 'idle',
297
- pinNumber: 13,
298
- position: [-1, 0, 2.8],
299
- rotation: [0, 0, 0],
300
- avatarColor: '#0284c7',
301
- },
302
-
303
- // Front Hub (Art Direction & Design)
304
- {
305
- id: 'slot-14',
306
- type: 'person',
307
- name: 'Visual Designer (UI/UX)',
308
- role: 'Interface & web design',
309
- department: 'Technology',
310
- zoneId: 'tech',
311
- status: 'idle',
312
- pinNumber: 14,
313
- position: [-10, 0, 7.5],
314
- rotation: [0, 0, 0],
315
- avatarColor: '#e11d48',
316
- },
317
- {
318
- id: 'slot-15',
319
- type: 'person',
320
- name: 'Art Director (AI imagery)',
321
- role: 'AI visual artist',
322
- department: 'Creative',
323
- zoneId: 'creative',
324
- status: 'idle',
325
- pinNumber: 15,
326
- position: [-4, 0, 7.5],
327
- rotation: [0, 0, 0],
328
- avatarColor: '#475569',
329
- },
330
-
331
- // Meeting Room Desks / Client Relations
332
- {
333
- id: 'slot-16',
334
- type: 'person',
335
- name: 'Knowledge Librarian & QA',
336
- role: 'Process validation & documentation',
337
- department: 'Operations',
338
- zoneId: 'operations',
339
- status: 'idle',
340
- pinNumber: 16,
341
- position: [7.5, 0, 7.5],
342
- rotation: [0, -Math.PI / 4, 0],
343
- avatarColor: '#ca8a04',
344
- },
345
- {
346
- id: 'slot-17',
347
- type: 'person',
348
- name: 'Client Relations Lead',
349
- role: 'Onboarding & communication',
350
- department: 'Operations',
351
- zoneId: 'meeting',
352
- status: 'idle',
353
- pinNumber: 17,
354
- position: [13.5, 0, 7.5],
355
- rotation: [0, Math.PI / 4, 0],
356
- avatarColor: '#059669',
357
- },
69
+ metadata: { desk: 'executive' as OfficeDeskKind },
70
+ },
71
+ { id: 'slot-2', label: 'Workstation 2', position: [-13, 0, -6.8], zoneId: 'growth', pinNumber: 2, avatarColor: '#0284c7', metadata: { desk: 'workstation' as OfficeDeskKind, dualMonitor: false } },
72
+ { id: 'slot-3', label: 'Workstation 3', position: [-9, 0, -6.8], zoneId: 'creative', pinNumber: 3, avatarColor: '#db2777', metadata: { desk: 'workstation' as OfficeDeskKind, dualMonitor: true } },
73
+ { id: 'slot-4', label: 'Workstation 4', position: [-5, 0, -6.8], zoneId: 'growth', pinNumber: 4, avatarColor: '#2563eb', metadata: { desk: 'workstation' as OfficeDeskKind, dualMonitor: false } },
74
+ { id: 'slot-5', label: 'Workstation 5', position: [-1, 0, -6.8], zoneId: 'growth', pinNumber: 5, avatarColor: '#7c3aed', metadata: { desk: 'workstation' as OfficeDeskKind, dualMonitor: true } },
75
+ { id: 'slot-6', label: 'Workstation 6', position: [-13, 0, -2.0], zoneId: 'creative', pinNumber: 6, avatarColor: '#ea580c', metadata: { desk: 'workstation' as OfficeDeskKind, dualMonitor: false } },
76
+ { id: 'slot-7', label: 'Workstation 7', position: [-9, 0, -2.0], zoneId: 'operations', pinNumber: 7, avatarColor: '#059669', metadata: { desk: 'workstation' as OfficeDeskKind, dualMonitor: true } },
77
+ { id: 'slot-8', label: 'Workstation 8', position: [-5, 0, -2.0], zoneId: 'creative', pinNumber: 8, avatarColor: '#dc2626', metadata: { desk: 'workstation' as OfficeDeskKind, dualMonitor: true } },
78
+ { id: 'slot-9', label: 'Workstation 9', position: [-1, 0, -2.0], zoneId: 'executive', pinNumber: 9, avatarColor: '#4f46e5', metadata: { desk: 'workstation' as OfficeDeskKind, dualMonitor: false } },
79
+ { id: 'slot-10', label: 'Workstation 10', position: [-13, 0, 2.8], zoneId: 'creative', pinNumber: 10, avatarColor: '#0891b2', metadata: { desk: 'workstation' as OfficeDeskKind, dualMonitor: false } },
80
+ { id: 'slot-11', label: 'Workstation 11', position: [-9, 0, 2.8], zoneId: 'growth', pinNumber: 11, avatarColor: '#16a34a', metadata: { desk: 'workstation' as OfficeDeskKind, dualMonitor: false } },
81
+ { id: 'slot-12', label: 'Workstation 12', position: [-5, 0, 2.8], zoneId: 'executive', pinNumber: 12, avatarColor: '#9333ea', metadata: { desk: 'workstation' as OfficeDeskKind, dualMonitor: true } },
82
+ { id: 'slot-13', label: 'Workstation 13', position: [-1, 0, 2.8], zoneId: 'growth', pinNumber: 13, avatarColor: '#0284c7', metadata: { desk: 'workstation' as OfficeDeskKind, dualMonitor: true } },
83
+ { id: 'slot-14', label: 'Workstation 14', position: [-10, 0, 7.5], zoneId: 'tech', pinNumber: 14, avatarColor: '#e11d48', metadata: { desk: 'workstation' as OfficeDeskKind, dualMonitor: true } },
84
+ { id: 'slot-15', label: 'Workstation 15', position: [-4, 0, 7.5], zoneId: 'creative', pinNumber: 15, avatarColor: '#475569', metadata: { desk: 'workstation' as OfficeDeskKind, dualMonitor: true } },
85
+ { id: 'slot-16', label: 'Meeting room desk A', position: [7.5, 0, 7.5], rotation: [0, -Math.PI / 4, 0], zoneId: 'operations', pinNumber: 16, avatarColor: '#ca8a04', metadata: { desk: 'meeting' as OfficeDeskKind, dualMonitor: false } },
86
+ { id: 'slot-17', label: 'Meeting room desk B', position: [13.5, 0, 7.5], rotation: [0, Math.PI / 4, 0], zoneId: 'meeting', pinNumber: 17, avatarColor: '#059669', metadata: { desk: 'meeting' as OfficeDeskKind, dualMonitor: true } },
358
87
  ]
359
88
 
360
89
  export const officePreset: WorldPreset = {
@@ -404,7 +133,7 @@ export const officePreset: WorldPreset = {
404
133
  nightBackgroundColor: '#0f172a',
405
134
  },
406
135
  zones: DEFAULT_OFFICE_ZONES,
407
- defaultEntities: DEFAULT_OFFICE_ENTITIES,
136
+ slots: OFFICE_SLOTS,
408
137
 
409
138
  buildScene: (scene: THREE.Scene, options) => {
410
139
  const materials = new MaterialPalette()
@@ -417,56 +146,36 @@ export const officePreset: WorldPreset = {
417
146
  })
418
147
  scene.add(arch)
419
148
 
420
- // 2. Executive Suite Desk (Slot 1)
421
- const execDesk = createExecutiveDesk(materials, { entityId: 'slot-1' })
422
- execDesk.position.set(11, 0, -5.5)
423
- scene.add(execDesk)
424
-
425
- // 3. Conference Table in Meeting Room (Center of east parquet wing)
426
- const confTable = createConferenceTable(materials)
427
- confTable.position.set(11, 0, 2.5)
428
- scene.add(confTable)
429
-
430
- // 4. Meeting Room Desks (Slots 16 & 17)
431
- const desk16 = createModernWorkstation(materials, { entityId: 'slot-16', dualMonitor: false })
432
- desk16.position.set(7.5, 0, 7.5)
433
- desk16.rotation.y = -Math.PI / 4
434
- scene.add(desk16)
435
-
436
- const desk17 = createModernWorkstation(materials, { entityId: 'slot-17', dualMonitor: true })
437
- desk17.position.set(13.5, 0, 7.5)
438
- desk17.rotation.y = Math.PI / 4
439
- scene.add(desk17)
440
-
441
- // 5. Open Office Desks (Slots 2-15)
442
- const workstationSlots: Array<{ id: string; pos: [number, number, number]; dual: boolean }> = [
443
- { id: 'slot-2', pos: [-13, 0, -6.8], dual: false },
444
- { id: 'slot-3', pos: [-9, 0, -6.8], dual: true },
445
- { id: 'slot-4', pos: [-5, 0, -6.8], dual: false },
446
- { id: 'slot-5', pos: [-1, 0, -6.8], dual: true },
447
- { id: 'slot-6', pos: [-13, 0, -2.0], dual: false },
448
- { id: 'slot-7', pos: [-9, 0, -2.0], dual: true },
449
- { id: 'slot-8', pos: [-5, 0, -2.0], dual: true },
450
- { id: 'slot-9', pos: [-1, 0, -2.0], dual: false },
451
- { id: 'slot-10', pos: [-13, 0, 2.8], dual: false },
452
- { id: 'slot-11', pos: [-9, 0, 2.8], dual: false },
453
- { id: 'slot-12', pos: [-5, 0, 2.8], dual: true },
454
- { id: 'slot-13', pos: [-1, 0, 2.8], dual: true },
455
- { id: 'slot-14', pos: [-10, 0, 7.5], dual: true },
456
- { id: 'slot-15', pos: [-4, 0, 7.5], dual: true },
457
- ]
149
+ // 2. Desk furniture is generated from the architectural slot anchors —
150
+ // the same data consumer entities are auto-placed onto.
151
+ for (const slot of OFFICE_SLOTS) {
152
+ const kind = (slot.metadata?.desk as OfficeDeskKind) || 'workstation'
153
+ const dual = slot.metadata?.dualMonitor !== false
154
+
155
+ if (kind === 'executive') {
156
+ const desk = createExecutiveDesk(materials, { entityId: slot.id })
157
+ desk.position.set(slot.position[0], slot.position[1], slot.position[2])
158
+ if (slot.rotation) desk.rotation.set(slot.rotation[0], slot.rotation[1], slot.rotation[2])
159
+ scene.add(desk)
160
+ continue
161
+ }
458
162
 
459
- for (const ws of workstationSlots) {
460
163
  const desk = createModernWorkstation(materials, {
461
- entityId: ws.id,
462
- dualMonitor: ws.dual,
164
+ entityId: slot.id,
165
+ dualMonitor: dual,
463
166
  hasLaptop: true,
464
167
  })
465
- desk.position.set(ws.pos[0], ws.pos[1], ws.pos[2])
168
+ desk.position.set(slot.position[0], slot.position[1], slot.position[2])
169
+ if (slot.rotation) desk.rotation.set(slot.rotation[0], slot.rotation[1], slot.rotation[2])
466
170
  scene.add(desk)
467
171
  }
468
172
 
469
- // 6. Architectural Ficus Indoor Plants
173
+ // 3. Conference Table in Meeting Room (Center of east parquet wing)
174
+ const confTable = createConferenceTable(materials)
175
+ confTable.position.set(11, 0, 2.5)
176
+ scene.add(confTable)
177
+
178
+ // 4. Architectural Ficus Indoor Plants
470
179
  const plantCoords: [number, number][] = [
471
180
  [-17, -9],
472
181
  [-17, 9],
@@ -482,7 +191,7 @@ export const officePreset: WorldPreset = {
482
191
  scene.add(plant)
483
192
  }
484
193
 
485
- // 7. Executive Bookcases & Lounge Breakout Real 3D Models
194
+ // 5. Executive Bookcases & Lounge Breakout Real 3D Models
486
195
  const loader = ModelLoader.getInstance()
487
196
  void loader.load('furniture:bookcaseOpen').then((bookcase) => {
488
197
  if (bookcase) {
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three'
2
- import type { WorldPreset, WorldEntity, WorldZone } from '../core/types'
2
+ import type { WorldPreset, WorldSlot, WorldZone } from '../core/types'
3
3
  import { MaterialPalette } from '../engine/materials'
4
4
 
5
5
  export const DEFAULT_SCHOOL_ZONES: WorldZone[] = [
@@ -26,33 +26,12 @@ export const DEFAULT_SCHOOL_ZONES: WorldZone[] = [
26
26
  },
27
27
  ]
28
28
 
29
- export const DEFAULT_SCHOOL_ENTITIES: WorldEntity[] = [
30
- {
31
- id: 'teacher-1',
32
- type: 'person',
33
- name: 'Prof. Deniz — Department Head',
34
- role: 'Lecturing & mentoring',
35
- department: 'Academic',
36
- zoneId: 'lecture_hall',
37
- status: 'working',
38
- pinNumber: 1,
39
- position: [-6, 0, -4],
40
- avatarColor: '#4338ca',
41
- },
42
- {
43
- id: 'student-1',
44
- type: 'person',
45
- name: 'Zeynep — Graduate Researcher',
46
- role: 'STEM experiment practitioner',
47
- department: 'Research',
48
- zoneId: 'stem_lab',
49
- status: 'idle',
50
- pinNumber: 2,
51
- position: [6, 0, -3],
52
- avatarColor: '#0891b2',
53
- },
29
+ export const SCHOOL_SLOTS: WorldSlot[] = [
30
+ { id: 'slot-1', label: 'Lecture hall station', position: [-6, 0, -4], zoneId: 'lecture_hall', pinNumber: 1, avatarColor: '#4338ca' },
31
+ { id: 'slot-2', label: 'STEM lab bench', position: [6, 0, -3], zoneId: 'stem_lab', pinNumber: 2, avatarColor: '#0891b2' },
54
32
  ]
55
33
 
34
+
56
35
  export const schoolPreset: WorldPreset = {
57
36
  id: 'preset-school',
58
37
  name: 'Modern University & Academy Campus',
@@ -86,7 +65,7 @@ export const schoolPreset: WorldPreset = {
86
65
  backgroundColor: '#0f172a',
87
66
  },
88
67
  zones: DEFAULT_SCHOOL_ZONES,
89
- defaultEntities: DEFAULT_SCHOOL_ENTITIES,
68
+ slots: SCHOOL_SLOTS,
90
69
 
91
70
  buildScene: (scene: THREE.Scene, options) => {
92
71
  const materials = new MaterialPalette()
@@ -1982,3 +1982,89 @@
1982
1982
  .wv-container.is-night .wv-context-lost-overlay {
1983
1983
  background: rgba(15, 23, 42, 0.82);
1984
1984
  }
1985
+
1986
+ /* ----- Empty floor state (no occupants placed yet) ----- */
1987
+ .wv-hq-empty-floor {
1988
+ position: absolute;
1989
+ inset: 0;
1990
+ display: flex;
1991
+ align-items: center;
1992
+ justify-content: center;
1993
+ pointer-events: none;
1994
+ z-index: 12;
1995
+ }
1996
+
1997
+ .wv-hq-empty-floor-card {
1998
+ pointer-events: auto;
1999
+ display: flex;
2000
+ flex-direction: column;
2001
+ align-items: center;
2002
+ gap: 8px;
2003
+ max-width: 360px;
2004
+ padding: 26px 30px;
2005
+ border-radius: 16px;
2006
+ background: rgba(255, 255, 255, 0.92);
2007
+ border: 1px solid rgba(15, 23, 42, 0.1);
2008
+ box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
2009
+ text-align: center;
2010
+ color: #334155;
2011
+ backdrop-filter: blur(6px);
2012
+ }
2013
+
2014
+ .wv-hq-empty-floor-card svg {
2015
+ color: #3b82f6;
2016
+ }
2017
+
2018
+ .wv-hq-empty-floor-card h3 {
2019
+ margin: 2px 0 0;
2020
+ font-size: 15px;
2021
+ font-weight: 700;
2022
+ color: #0f172a;
2023
+ }
2024
+
2025
+ .wv-hq-empty-floor-card p {
2026
+ margin: 0;
2027
+ font-size: 12.5px;
2028
+ line-height: 1.55;
2029
+ color: #64748b;
2030
+ }
2031
+
2032
+ .wv-hq-empty-floor-btn {
2033
+ display: inline-flex;
2034
+ align-items: center;
2035
+ gap: 7px;
2036
+ margin-top: 8px;
2037
+ padding: 9px 18px;
2038
+ border: none;
2039
+ border-radius: 10px;
2040
+ background: linear-gradient(135deg, #3b82f6, #6366f1);
2041
+ color: #fff;
2042
+ font-size: 13px;
2043
+ font-weight: 600;
2044
+ cursor: pointer;
2045
+ transition: transform 0.15s ease, box-shadow 0.15s ease;
2046
+ }
2047
+
2048
+ .wv-hq-empty-floor-btn:hover:not(:disabled) {
2049
+ transform: translateY(-1px);
2050
+ box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
2051
+ }
2052
+
2053
+ .wv-hq-empty-floor-btn:disabled {
2054
+ opacity: 0.6;
2055
+ cursor: wait;
2056
+ }
2057
+
2058
+ .is-night .wv-hq-empty-floor-card {
2059
+ background: rgba(15, 23, 42, 0.92);
2060
+ border-color: rgba(148, 163, 184, 0.2);
2061
+ color: #cbd5e1;
2062
+ }
2063
+
2064
+ .is-night .wv-hq-empty-floor-card h3 {
2065
+ color: #f1f5f9;
2066
+ }
2067
+
2068
+ .is-night .wv-hq-empty-floor-card p {
2069
+ color: #94a3b8;
2070
+ }