| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Mischief.ECS.HooksRel
Synopsis
- addOther :: (Component a, Component b) => (a -> b) -> HookRel a
- removeOther :: forall {k} (a :: k) b. Component b => HookRel a
- addDespawnCleaner :: Component a => HookRel a
- addRemoveCleaner :: Component a => HookRel a
- addCleaner :: Component a => (CleanupRequest -> System ()) -> HookRel a
- removeCleaner :: Component a => HookRel a
Documentation
addOther :: (Component a, Component b) => (a -> b) -> HookRel a Source #
Relationship Hook for Component a.
Takes a a -> b. If a is a relationship from x to y, this hook will add the corresponding b from y to x.
Example usage:
data After = After data Before = Before instanceComponentBefore where onAddRel = [addOther (constAfter)] instanceComponentAfter where onAddRel = [addOther (constBefore)]
removeOther :: forall {k} (a :: k) b. Component b => HookRel a Source #
addDespawnCleaner :: Component a => HookRel a Source #
Relationship Hook for Component a.
Adds a cleaner that will despawn this relationship's entity if the target of the relationship is despawned.
Note that one component can have only one cleaner at a time.
addRemoveCleaner :: Component a => HookRel a Source #
Relationship Hook for Component a.
Adds a cleaner that will remove this relationship if the target is despawned.
Note that one component can have only one cleaner at a time.
removeCleaner :: Component a => HookRel a Source #
Relationship Hook for Component a.
Removes the cleaner associated to this component, if any.