Documentation
¶
Overview ¶
Package bridges builds bridges by one set of rules, package site's, whoever builds them: a level's file, a player with a bridge in hand, a map maker.
NewPlugin takes the world, the board and the Config: where a bridge may stand (site.Rules) and the kind of bridge a player builds. A game defines its kinds of bridges in the Kinds section (Plugin.Types, Types.Define a Spec): whom the deck carries and how much it bears, how wide and thick it is, its railings and its piers.
A bridge is its parts ¶
A bridge is entities standing on the board, saved as any: a piece of deck on every cell from head to head, a band with its railings, and over a map in relief a pier between every two spans casting its Baked shadow (light.Shadow). Over them stands its handle, "<name>.whole", holding no cell and drawn at no level, which casts the deck's shadow whole, seen through by sight, and takes its pieces with it as it goes (world.Whole). Type.Deck and Type.Pier are their looks' slots for a scene's atlas. They are world.Fixed: from L4 out the world's sheets hold them at their tops, and by a sector drawn finer they are drawn alive at its level, so a bridge stays whole and level across the seam.
A level's bridges ¶
A line of a level's file `{kind: bridge, from: [x, y], to: [x, y]}` is a bridge from head to head: Write.Spawn builds every one in the Spawn section and fails with the line of one that may not stand.
A bridge in a player's hand ¶
Plugin.DefaultBindings have Shift+B take a bridge in hand (Tool); while the player holds it, the cursor lays the bridge out (Aim), a left click marks a head (Mark) and a right click or Esc puts the bridge down. [Plugin.Renderer] draws the bridge in hand, yellow where it may not stand (Plugin.Reason says why), green where it may. Plugin.Window asks "Build the bridge?": Build has it built at the next step of the simulation, its heads levelled on the ground Plugin.WithShaper gives, Cancel builds nothing. A bridge confirmed waits for its step in Resources.Orders, saved with the game.
Figures ¶
A Figure is a kind of bridge in one piece: Define its Spec on the plugin's Types, Look the looks of its deck and pier on the world's atlas, and, Stateful or Ruled, its own effects and rules. Plugin.Figures, called in the Stage's Figures link, hands them on to the world's figures, which the Stage leads through its sections; Plugin.World is the world they stand in.
Vocabulary ¶
Marks: world.Whole on a bridge's handle, world.PieceOf on its pieces. Commands, a player's with the bridge tool in hand: Aim, Mark, Build, Cancel.
Index ¶
- Constants
- type Aim
- type Build
- type Cancel
- type Config
- type Figure
- type Mark
- type Order
- type Plugin
- func (p *Plugin) DefaultBindings() []control.Binding
- func (p *Plugin) EventHandler() control.EventHandler
- func (p *Plugin) Figures(figures ...Figure)
- func (p *Plugin) Install(ctx plugin.Installer) error
- func (p *Plugin) Name() string
- func (p *Plugin) Populate() error
- func (p *Plugin) Queues() []command.CommandQueue
- func (p *Plugin) Reason() *ui.Element
- func (p *Plugin) Restore()
- func (p *Plugin) RunPlan(ctx goke.RunCtx, d time.Duration)
- func (p *Plugin) Serializable() plugin.Serializable
- func (p *Plugin) String() string
- func (p *Plugin) Types() *Types
- func (p *Plugin) Window() *ui.Element
- func (p *Plugin) WithShaper(s ground.Shaper) *Plugin
- func (p *Plugin) World() *world.Plugin
- func (p *Plugin) Write() *Write
- type Resources
- type Row
- type Ruled
- type Spec
- type Stateful
- type Type
- type Types
- type Write
Constants ¶
const Tool control.Tool = "bridge"
Tool is a bridge in a player's hand, for control.Take.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cancel ¶
type Cancel struct{}
Cancel builds nothing of the bridge its player was asked about, the first head still laid.
type Config ¶
Config is where bridges may stand (Longest 3 where Rules say none) and the kind of bridge a player's Tool builds, the first defined for none.
type Figure ¶
Figure is a kind of bridge in one piece: its Spec defined on the plugin's Types in the Kinds section, the looks of its deck and pier declared on the world's atlas in a scene. One with states of its own is Stateful, one with roles and rules of its own Ruled.
type Mark ¶
Mark lays a bridge's head at the world point At: the first where the bridge begins, the next its other end, asking whether to build it; the first again lifts it.
type Order ¶ added in v0.17.0
Order is a bridge its player confirmed (Build), built at the next step of the simulation: the name of its kind of bridge (Types.Named) and its plan.
type Plugin ¶
Plugin builds bridges by one set of rules, a level's and a player's, as entities standing on the board.
func (*Plugin) DefaultBindings ¶
DefaultBindings are Shift+B taking the bridge in hand and, while it is held, the cursor aiming it, a left click marking a head and a right click or Esc putting it down.
func (*Plugin) EventHandler ¶
func (p *Plugin) EventHandler() control.EventHandler
func (*Plugin) Figures ¶
Figures notes the kinds of bridges among the world's figures, which the Stage leads through its sections. Called in the Stage's Figures link.
func (*Plugin) Populate ¶
Populate holds the bridges a level's file laid to the Rules; one that may not stand fails with its line.
func (*Plugin) Queues ¶
func (p *Plugin) Queues() []command.CommandQueue
Queues are the plugin's command queues: Aim, Mark, Build and Cancel.
func (*Plugin) Reason ¶
Reason is a label saying why the bridge in a player's hand may not stand where it points.
func (*Plugin) Restore ¶ added in v0.17.0
func (p *Plugin) Restore()
Restore takes the Resources loaded.
func (*Plugin) RunPlan ¶
RunPlan carries out the players' commands at once and builds the bridges confirmed in the simulation.
func (*Plugin) Serializable ¶
func (p *Plugin) Serializable() plugin.Serializable
Serializable is the plugin's Resources, kept whole; a bridge built is its parts, saved as entities.
func (*Plugin) Window ¶
Window is the window asking a player whether to build the bridge it marked out, shown while it asks.
func (*Plugin) WithShaper ¶
WithShaper gives the plugin the ground a player's bridge levels its heads on; without it a bridge stands only where its heads lie flat at its deck already.
type Resources ¶ added in v0.17.0
type Resources struct{ Orders []Order }
Resources is the state of bridges, saved with the game whole: the bridges ordered and not yet built.
type Ruled ¶
type Ruled interface{ Rules(p *Plugin) }
Ruled is a Figure with roles and rules of its own, defined in the Rules section.
type Spec ¶
type Spec struct {
Allows cell.Domain
Load float32
Width float32
Thickness float32
Pace float64
Rail cell.Rail
Pier float32
}
Spec is what a kind of bridge is: whom its deck carries (Allows, at Pace; 0 the ground's) and how heavy they may be (Load, kg; 0 any), how wide and thick its deck is, its railings and how wide a pier is.
type Stateful ¶
type Stateful interface{ Effects(p *Plugin) }
Stateful is a Figure with effects of its own, defined in the Effects section.
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
Type is a kind of bridge defined.
type Types ¶
type Types struct {
// contains filtered or unexported fields
}
Types is the register of the kinds of bridges, defined on the Stage's kinds.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package site is where a bridge may stand: Plan a bridge from one head to another over a Ground under the Rules, or say why not (Refusal).
|
Package site is where a bridge may stand: Plan a bridge from one head to another over a Ground under the Rules, or say why not (Refusal). |