module Mischief.ECS.Resources where
import Mischief.ECS.Components
import Mischief.ECS.Components.Bundle
import Mischief.ECS.Components.Spawn
import Mischief.ECS.Tables
import Mischief.ECS.World
import Mischief.ECS.World.Insert
import Mischief.ECS.World.Query
import Mischief.ECS.World.Query.QueryType
import Mischief.ECS.World.Query.Queryable
insertRes :: forall r. (Component r, Bundle r) => r -> System ()
insertRes :: forall r. (Component r, Bundle r) => r -> System ()
insertRes r
res = do
entity <- forall c. Component c => System Entity
meta @r
insert res entity
res :: forall c. (QueryType c) => System (Maybe c)
res :: forall c. QueryType c => System (Maybe c)
res = do
meta <- forall c. Component c => System Entity
meta @c
get (Val (C @c)) meta
resOrInsert :: forall r. (Component r, Updateable (Result r), Bundle r) => r -> System (Result r)
resOrInsert :: forall r.
(Component r, Updateable (Result r), Bundle r) =>
r -> System (Result r)
resOrInsert r
r = do
meta <- forall c. Component c => System Entity
meta @r
getOrInsert r meta