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 (Int -> ChildOf -> ShowS [ChildOf] -> ShowS ChildOf -> String (Int -> ChildOf -> ShowS) -> (ChildOf -> String) -> ([ChildOf] -> ShowS) -> Show ChildOf forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> ChildOf -> ShowS showsPrec :: Int -> ChildOf -> ShowS $cshow :: ChildOf -> String show :: ChildOf -> String $cshowList :: [ChildOf] -> ShowS showList :: [ChildOf] -> ShowS Show) instance Component ChildOf where type IsExclusiveRel ChildOf = True parent :: forall m w. (MonadSystem w m) => Entity -> m (Maybe Entity) parent :: forall (m :: * -> *) w. MonadSystem w m => Entity -> m (Maybe Entity) parent Entity entity = do p <- forall c (m :: * -> *) w. (Component c, MonadSystem w m) => Entity -> m [Entity] outgoing' @ChildOf Entity entity return $ case p of [Entity p] -> Entity -> Maybe Entity forall a. a -> Maybe a Just Entity p [Entity] _ -> Maybe Entity forall a. Maybe a Nothing children :: forall m w. (MonadSystem w m) => Entity -> m [Entity] children :: forall (m :: * -> *) w. MonadSystem w m => Entity -> m [Entity] children = forall c (m :: * -> *) w. (Component c, MonadSystem w m) => Entity -> m [Entity] outgoing' @ChildOf