module Mischief.ECS.Relationships.ChildOf where import Mischief.ECS.Components import Mischief.ECS.Entities import Mischief.ECS.Relationships.Graph import Mischief.ECS.World data ChildOf = ChildOf deriving (Show) instance Component ChildOf where type IsExclusiveRel ChildOf = True parent :: forall m w. (MonadSystem w m) => Entity -> m (Maybe Entity) parent entity = do p <- outgoing' @ChildOf entity return $ case p of [p] -> Just p _ -> Nothing children :: forall m w. (MonadSystem w m) => Entity -> m [Entity] children = outgoing' @ChildOf