MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / spawnEntity

Function spawnEntity

src/world/loader.ts:181–196  ·  view source on GitHub ↗
(
  entity: EntityData,
  ctx: InstantiateContext,
  warnings: string[],
)

Source from the content-addressed store, hash-verified

179// ---- entity spawning -------------------------------------------------------
180
181function spawnEntity(
182 entity: EntityData,
183 ctx: InstantiateContext,
184 warnings: string[],
185): SceneNodeHandle {
186 if (entity.modelRef !== null && entity.modelRef.length > 0) {
187 return spawnModelEntity(entity, ctx, warnings);
188 }
189
190 if (entity.prefabRef !== null && entity.prefabRef.length > 0) {
191 return spawnPrefabEntity(entity, ctx, warnings);
192 }
193
194 warnings.push('entity ' + entity.id + ' has neither modelRef nor prefabRef — skipped');
195 return 0;
196}
197
198function spawnModelEntity(
199 entity: EntityData,

Callers 1

instantiateWorldFunction · 0.85

Calls 3

spawnModelEntityFunction · 0.85
spawnPrefabEntityFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected