mischief-ecs
Safe HaskellNone
LanguageGHC2024

Mischief.ECS.World.Insert

Synopsis

Documentation

insert :: HasCallStack => forall b. Bundle b => b -> Entity -> System () Source #

Insert a bundle of components on an Entity.

If the entity already contains these components, their values will be updated in-place instead of causing an archetype change.

getOrInsert :: (Updateable (Result qd), Bundle qd) => qd -> Entity -> System (Result qd) Source #

insertNew :: Bundle b => b -> Entity -> System () Source #

Insert a bundle of components on an Entity.

Only the components that the entity doesn't already have will be inserted, and the rest ignored.

class Settable c i | c -> i where Source #

Methods

setInner :: c -> i -> System () Source #

setIfNeqInner :: c -> i -> System () Source #

Instances

Instances details
Settable' (IsComp c) (Result c) i => Settable (Result c) i Source # 
Instance details

Defined in Mischief.ECS.World.Insert

Methods

setInner :: Result c -> i -> System () Source #

setIfNeqInner :: Result c -> i -> System () Source #

class Settable' (isRel :: k) c i | isRel c -> i where Source #

Methods

setInner' :: c -> i -> System () Source #

setIfNeqInner' :: c -> i -> System () Source #

Instances

Instances details
Component c => Settable' 'False (Result (Rel c)) c Source # 
Instance details

Defined in Mischief.ECS.World.Insert

Methods

setInner' :: Result (Rel c) -> c -> System () Source #

setIfNeqInner' :: Result (Rel c) -> c -> System () Source #

(Component c, IsComponentC c ~ HTrue) => Settable' 'True (Result c) c Source # 
Instance details

Defined in Mischief.ECS.World.Insert

Methods

setInner' :: Result c -> c -> System () Source #

setIfNeqInner' :: Result c -> c -> System () Source #

set :: Settable c i => c -> i -> System () Source #

Set the value of a component obtained as query result.

Note that the local Result won't be mutated. You'll need to query the component again or use update to update the current result.

setIfNeq :: (Eq i, Settable c i) => c -> i -> System () Source #

class Updateable' (flag :: k) r where Source #

Methods

updateInner' :: r -> System (Maybe r) Source #

Instances

Instances details
Component c => Updateable' 'False (Result (Rel c)) Source # 
Instance details

Defined in Mischief.ECS.World.Insert

Methods

updateInner' :: Result (Rel c) -> System (Maybe (Result (Rel c))) Source #

(Component c, IsComponentC c ~ HTrue) => Updateable' 'True (Result c) Source # 
Instance details

Defined in Mischief.ECS.World.Insert

class Updateable r where Source #

Methods

updateInner :: r -> System (Maybe r) Source #

Instances

Instances details
Updateable' (IsComp c) (Result c) => Updateable (Result c) Source # 
Instance details

Defined in Mischief.ECS.World.Insert

update :: Updateable (Result c) => Result c -> System (Maybe (Result c)) Source #

Update the value of a Result.

Useful if you've done changed to the component and want to grab the live value without re-querying.