DataEntityKind class final
An entity kind a data plugin declares: the properties a level must give it, and optionally a box it occupies.
A genre's rules as data, where the engine has a data form for them. A
level names its entities by type, and EntityKinds is what says which
types exist and what each needs; that table is the one rule a genre
writes that is already data-shaped. So a data plugin can add a kind, its
required properties are checked by the level validator with the same
sentences the built-in kinds use, and a kind with a collider places a
box of the entity's size — a trigger volume, a solid block — exactly as
EntityKind.place does for the engine's own. What it does when something
enters that box is a system's job, written in Wasm or Dart.
- Inheritance
-
- Object
- EntityKind
- DataEntityKind
Constructors
-
DataEntityKind(String type, {required String owner, List<
String> requires = const <String>[], ColliderKind? collider}) -
const
-
DataEntityKind.fromJson(Map<
String, Object?> json, {required String owner}) -
Reads one declaration:
{"type": "vent", "requires": ["size"], "collider": "trigger"}. Throws aDocumentFormatExceptionsaying what is wrong.factory
Properties
- collider → ColliderKind?
-
The box it occupies, or null for a kind that is only a marker.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- mustBeReachable → bool
-
Whether a player has to be able to get to one of these.
no setterinherited
- owner → String
-
The plugin that declared it, by id, for the sentences a level reads.
final
-
requires
→ List<
String> -
Properties every entity of this kind must have.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → String
-
The string that appears in a level document.
finalinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
place(
EntityDef entity, SpawnContext context, {required ColliderKind kind, int layer = CollisionLayers.world, int mask = CollisionLayers.all, Vector3? fallbackSize}) → Collider -
Puts the box this entity brings with it into the world.
inherited
-
requireKeyExists(
EntityDef entity, LevelScope scope, List< LevelIssue> out) → void -
Reports that a key this entity demands exists nowhere in the level.
inherited
-
requireSize(
EntityDef entity, LevelScope scope, List< LevelIssue> out) → void -
Reports that an entity which has to occupy space does not say how much.
inherited
-
requireTarget(
EntityDef entity, LevelScope scope, List< LevelIssue> out, {bool optional = false}) → void -
Reports that a named reference does not resolve.
inherited
-
requireText(
EntityDef entity, LevelScope scope, List< LevelIssue> out, String key) → void -
inherited
-
requireTravel(
EntityDef entity, LevelScope scope, List< LevelIssue> out) → void -
Reports that a movement offset is missing or goes nowhere.
inherited
-
spawn(
EntitySpawn spawn) → void -
Brings the spawn's entity into the world.
override
-
toJson(
) → Map< String, Object?> -
toString(
) → String -
A string representation of this object.
inherited
-
validate(
EntityCheck check) → void -
Checks one entity of this kind, in the context of the level around it,
adding what is wrong to the check's EntityCheck.out.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited