| Copyright | (c) Matt Hunzinger 2025 |
|---|---|
| License | BSD-style (see the LICENSE file in the distribution) |
| Maintainer | matt@hunzinger.me |
| Stability | provisional |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | None |
| Language | Haskell2010 |
Aztecs.ECS.World.Entities
Description
Synopsis
- data Entities (m :: Type -> Type) = Entities {
- archetypes :: !(Archetypes m)
- components :: !Components
- entities :: !(Map EntityID ArchetypeID)
- empty :: forall (m :: Type -> Type). Entities m
- spawn :: forall (m :: Type -> Type). Monad m => EntityID -> BundleT m -> Entities m -> (Entities m, Access m ())
- spawnWithArchetypeId :: forall (m :: Type -> Type). Monad m => EntityID -> ArchetypeID -> DynamicBundle m -> Entities m -> (Entities m, Access m ())
- insert :: forall (m :: Type -> Type). Monad m => EntityID -> BundleT m -> Entities m -> (Entities m, Access m ())
- insertDyn :: forall (m :: Type -> Type). Monad m => EntityID -> Set ComponentID -> DynamicBundle m -> Entities m -> (Entities m, Access m ())
- insertUntracked :: forall (m :: Type -> Type). Monad m => EntityID -> BundleT m -> Entities m -> Entities m
- lookup :: forall (m :: Type -> Type) a. Component m a => EntityID -> Entities m -> Maybe a
- remove :: forall (m :: Type -> Type) a. Component m a => EntityID -> Entities m -> (Maybe a, Entities m, Access m ())
- removeWithId :: forall (m :: Type -> Type) a. Component m a => EntityID -> ComponentID -> Entities m -> (Maybe a, Entities m, Access m ())
- despawn :: forall (m :: Type -> Type). EntityID -> Entities m -> (IntMap Dynamic, Entities m)
Documentation
data Entities (m :: Type -> Type) Source #
World of entities and their components.
Constructors
| Entities | |
Fields
| |
Instances
spawn :: forall (m :: Type -> Type). Monad m => EntityID -> BundleT m -> Entities m -> (Entities m, Access m ()) Source #
Spawn a Bundle. Returns the updated entities and the onInsert hook to run.
spawnWithArchetypeId :: forall (m :: Type -> Type). Monad m => EntityID -> ArchetypeID -> DynamicBundle m -> Entities m -> (Entities m, Access m ()) Source #
Spawn a DynamicBundle with a specified ArchetypeID. Returns the updated entities and the onInsert hook.
insert :: forall (m :: Type -> Type). Monad m => EntityID -> BundleT m -> Entities m -> (Entities m, Access m ()) Source #
Insert a component into an entity. Returns the updated entities and the onInsert hook.
insertDyn :: forall (m :: Type -> Type). Monad m => EntityID -> Set ComponentID -> DynamicBundle m -> Entities m -> (Entities m, Access m ()) Source #
Insert a component into an entity with its ComponentID. Returns the updated entities and the onInsert hook.
insertUntracked :: forall (m :: Type -> Type). Monad m => EntityID -> BundleT m -> Entities m -> Entities m Source #
Insert a component into an entity without running lifecycle hooks.
lookup :: forall (m :: Type -> Type) a. Component m a => EntityID -> Entities m -> Maybe a Source #
Lookup a component in an entity.
remove :: forall (m :: Type -> Type) a. Component m a => EntityID -> Entities m -> (Maybe a, Entities m, Access m ()) Source #
Remove a component from an entity. Returns the component (if found), updated entities, and the onRemove hook.
removeWithId :: forall (m :: Type -> Type) a. Component m a => EntityID -> ComponentID -> Entities m -> (Maybe a, Entities m, Access m ()) Source #
Remove a component from an entity with its ComponentID. Returns the component (if found), updated entities, and the onRemove hook.