e61914bad4
Register Entity, the generic Component wrapper, and Scene as JerryScript classes (modulelist.c ties them together, plus their .d.ts stubs), so scenes/entities can be built from script going forward instead of the JSON scene format. With scripting now the intended authoring path, drop the JSON serialize/deserialize machinery entirely: componentdefinition_t's serialize/deserialize callbacks, every component's *Serialize/ *Deserialize function, entitySerialize/entityDeserialize, sceneSerialize/sceneDeserialize, and the "prefabs/<name>.json"/ "scenes/<name>.json" asset fallback in entityPrefabResolveAndApply/ scenePrefabResolveAndApply (C-coded prefabs only now). physicsshape.c and its test are removed outright since they only existed for this. game.c's test scene now comes from the existing overworldSceneCreate() C builder instead of loading the now-deleted assets/scenes/test.json. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
37 lines
921 B
TypeScript
37 lines
921 B
TypeScript
// Copyright (c) 2026 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
/// <reference path="component/component.d.ts" />
|
|
|
|
/**
|
|
* A game entity. `new Entity()` adds it to the currently active scene's
|
|
* entity manager (see Scene.getActive()) -- throws if no scene is
|
|
* active.
|
|
*/
|
|
declare class Entity {
|
|
constructor();
|
|
|
|
/** The engine-assigned numeric entity ID. */
|
|
readonly id: number;
|
|
|
|
/** Optional name; empty string if unset. */
|
|
name: string;
|
|
|
|
/**
|
|
* Adds a component of the given type (e.g. POSITION) to this entity
|
|
* and returns its wrapper.
|
|
*/
|
|
add(type: number): Component;
|
|
|
|
/**
|
|
* Gets this entity's component of the given type, or undefined if it
|
|
* doesn't have one.
|
|
*/
|
|
getComponent(type: number): Component | undefined;
|
|
|
|
/** Removes this entity and all its position-component descendants. */
|
|
dispose(): void;
|
|
}
|