|
|
|
@ -22,6 +22,7 @@ pub const EntityError = error{ |
|
|
|
|
GenMismatch, |
|
|
|
|
/// Entity is not alive. |
|
|
|
|
IsNotAlive, |
|
|
|
|
// TODO: Rename this to `EntityMissing` and similar, use it elsewhere in the code. |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/// An `Entity` is an `Id` which represents a "thing" within the world. This |
|
|
|
@ -259,6 +260,11 @@ pub fn Entity(comptime ctx: anytype) type { |
|
|
|
|
return if (result != 0) fromRaw(self.world, result) else null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Returns an iterator that yields each of this `Entity`s children. |
|
|
|
|
pub fn getChildren(self: Self) World(ctx).TermIterator { |
|
|
|
|
return self.world.term(.{ c.EcsChildOf, self }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Returns an iterator that yields each of the targets of the |
|
|
|
|
/// specified `relation` that this `Entity` has, if any. |
|
|
|
|
pub fn getTargets(self: Self, relation: anytype) TargetIterator { |
|
|
|
|