section

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package section names the parts a Stage is defined in, in their order, and lets a plugin refuse what is defined in the wrong one. A plugin may name parts of its own between them (Define) and give a game a Section of one to write into its Stage; a Stage written by hand is in none, and nothing is refused.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(src any, what string, want ...Part) error

Check is an error for what, which belongs in one of want, when src says another part of the Stage is being defined; nil for a src that tells no parts, for Anytime and for Plugins.

func Must

func Must(src any, what string, want ...Part)

Must panics with what Check says.

Types

type Part

type Part uint8

Part is a part of a Stage's definition.

const (
	Anytime Part = iota // a Stage written by hand
	Plugins             // anything may be defined: the plugins define their own
	Players             // the players and the plugins' keys
	Effects
	Rules // the roles and the plans too
	Commands
	Kinds    // of cells and of units
	Controls // the game's own keys
	Spawn
	Scenes
	Done
)

func Define

func Define(name string, after, before Part) Part

Define is a part of a Stage's definition a plugin names, between the parts after and before. Call it once, for a package variable.

func (Part) Between

func (p Part) Between() (after, before Part, ok bool)

Between is the parts a plugin's part lies between; false for a Stage's own.

func (Part) String

func (p Part) String() string

type Reader

type Reader interface{ Section() Part }

Reader tells which part of the Stage is being defined.

type Section

type Section struct {
	Part Part
	// contains filtered or unexported fields
}

Section is a plugin's part of a Stage's definition, run where the game writes it.

func Of

func Of[P any](part Part, f func(p P) error) Section

Of is the Section of part running f with the plugin of type P the Stage uses.

func (Section) Run

func (s Section) Run(used []any) error

Run runs s with the plugins the Stage uses.

type Writer

type Writer interface {
	Reader
	Enter(p Part)
}

Writer is a Reader told which part begins.

Jump to

Keyboard shortcuts

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