mischief-ecs
Safe HaskellNone
LanguageGHC2024

Mischief.ECS.World.Defer

Synopsis

Documentation

defer :: MonadSystem w m => System a -> m () Source #

Defer a System. This will put it in the current deferred queue which is typically flushed in-between scheduled systems.

This is useful for executing mutations in parallel systems.

You can manually flush the queue with flush.

flush :: System () Source #

Flush the current list of deferred commands.

flushAsync :: System () Source #

Flush the current list of deferred async commands.

runAfter :: MonadSystem w m => IO a -> (a -> System ()) -> m () Source #

Run an IO action asynchronously before running a System with its output. Useful when performing significant IO such as reading / loading files.

delay :: MonadSystem w m => Float -> System a -> m () Source #

Delay a system by a given amount of seconds.

Example:

delay 1.5 $ insert (Health 100) player