tasks

package
v0.0.0-...-b6f29c3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2020 License: ISC Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TickList = &Scripts{}

TickList A collection of Tasks that are intended to be ran once per game engine tick. Tasks should contractually return either true if they are to be removed after execution completes, or false if they are to be ran again on the next engine cycle.

View Source
var (
	Ticks = atomic.NewUint64(0)
)

Functions

func CurrentTick

func CurrentTick() tickCount

func Do

func Do(fn interface{})

func DoOnce

func DoOnce(ticks int, fn ScriptCall)

func DoOnceSync

func DoOnceSync(ticks int, fn ScriptCall)

DoOnceSync Run a task one time, and then remove it, regardless of the return value of the call.

func Schedule

func Schedule(ticks int, call StatusReturnCall)

func Stall

func Stall(ticks int)

Types

type ScriptCall

type ScriptCall interface{}

scriptCall This is a type-free box type, made for boxing function pointers usually from an Anko script.

type ScriptCalls

type ScriptCalls []ScriptCall

scriptArg A slice of ScriptCalls.

type Scripts

type Scripts struct {
	ScriptCalls
	sync.RWMutex
}

Scripts A locked slice of ScriptCalls.

func (*Scripts) Add

func (s *Scripts) Add(fn interface{})

func (*Scripts) ForEach

func (s *Scripts) ForEach(ctx context.Context, arg interface{})

func (*Scripts) Schedule

func (s *Scripts) Schedule(ticks int, fn ScriptCall)

func (*Scripts) Tick

func (s *Scripts) Tick(ctx context.Context)

type StatusReturnCall

type StatusReturnCall = func() bool

Call function type aliases for tickables etc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL