Documentation
¶
Overview ¶
Package preview serves the page modlock dev opens beside a running mod: it draws every screen the mods show the local player with the game's own drawing on a browser stand-in for Panorama, says what the build and the mods are doing, and passes the page's presses and chat commands to the mods as that player's input. It serves the built mod's layouts as XML, so the page draws a mod's own layouts too.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Input ¶
Input passes one of the page's inputs to the mods and returns a line for the creator when no mod received it, or empty.
type Page ¶
type Page struct {
// contains filtered or unexported fields
}
Page follows the command line's events and serves the preview page from a directory of its files at /. The page opens a websocket at /socket, which carries its state down as JSON cli.Preview messages and the player's input up as JSON cli.Input messages. GET /layout/<mod>/<path> answers with the source of the mod's built layout at path. It serves loopback hosts and its own pages only.
func New ¶
New returns a page serving the files in dir and the layouts of the mod built in built, and passing input to the mods, for a mod that rebuilds on each save when watch is true. It shows the first player who joins, the stand-in player in the sandbox.