Skip to content

Server: scriptable NPC spawning#16

Merged
Kheartz merged 1 commit into
mainfrom
npc_spawn
Jun 14, 2026
Merged

Server: scriptable NPC spawning#16
Kheartz merged 1 commit into
mainfrom
npc_spawn

Conversation

@Kheartz

@Kheartz Kheartz commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Add a server-owned human (NPC) spawn capability; clients render it via the existing student-proxy path.

  • Human::Spawn(net, srv, x, y, z) creates a server-owned human entity -- anonymous (a named CreateEntity is lookup-or-create in flecs, so a fixed name would return the same entity every call) and assignOwnerManually so the framework doesn't reassign its owner. Clients dress/move/despawn it like any player.
  • World.spawnHuman(x, y, z) -> Human JS builtin (arg-validated) exposes it.
  • scripting Human::Destroy is now ownership-aware: server-owned (owner 0) -> ServerEngine::RemoveEntity, real players -> no-op.
  • gamemode resource gains /spawnnpc, /walknpcs, /clearnpcs dev commands (single-tester scaffolding, capped at 20).

Add a server-owned human (NPC) spawn capability; clients render it via the
existing student-proxy path.

- Human::Spawn(net, srv, x, y, z) creates a server-owned human entity --
  anonymous (a named CreateEntity is lookup-or-create in flecs, so a fixed
  name would return the same entity every call) and assignOwnerManually so
  the framework doesn't reassign its owner. Clients dress/move/despawn it
  like any player.
- World.spawnHuman(x, y, z) -> Human JS builtin (arg-validated) exposes it.
- scripting Human::Destroy is now ownership-aware: server-owned (owner 0)
  -> ServerEngine::RemoveEntity, real players -> no-op.
- gamemode resource gains /spawnnpc, /walknpcs, /clearnpcs dev commands
  (single-tester scaffolding, capped at 20).
@Kheartz Kheartz merged commit 19997c3 into main Jun 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant