A referência da API é gerada a partir dos comentários de documentação Go no código-fonte e está escrita em inglês.
package devplugin
import "github.com/nsgo-dev/game/pkg/gameplugin/devplugin"Visão geral
Package devplugin installs development-time plugin contributions (MCP bridge prefabs and playtest bots) separately from github.com/nsgo-dev/game/pkg/gameplugin.
Separating MCP and playtest wiring into this subpackage keeps shipped game binaries that import pkg/gameplugin from linking pkg/mcp, pkg/tooling/playtest, pkg/replay, and their transitive dependencies.
Índice
Funções
func Install(h *Host, ps ...Plugin) errorInstall validates every plugin in ps against h and the process-global playtest registry before registering anything, then installs their bots, prefabs, and Install hooks in deterministic order (plugins in argument order, Prefabs in slice order, Bots in sorted key order).
Tipos
type Host struct {
// Bridge receives plugin Prefabs when non-nil.
Bridge *mcp.Bridge
// contains filtered or unexported fields
}Host holds the development-time registries that Install wires plugins into. Nil fields skip that kind of contribution.
func (h *Host) Has(name string) boolHas reports whether a devplugin plugin named name has been installed on h.
func (h *Host) Plugins() []gameplugin.InstalledPlugins returns the devplugin plugins installed on h in installation order.
type Plugin struct {
// Name uniquely identifies the plugin using the same rule as plugin.yaml's name.
Name string
// Module is the plugin's Go module path, matching go.mod and plugin.yaml when set.
Module string
// API must equal [gameplugin.APIVersion].
API int
// Prefabs lists prefabs registered on Host.Bridge in slice order.
Prefabs []PrefabSpec
// Bots maps playtest bot profile names to factories registered in the process-global playtest registry in sorted key order, once per process per owning plugin.
Bots map[string]playtest.BotFactory
// Install is an optional escape hatch called last after all declarative contributions have been validated and registered.
Install func(*Host) error
}Plugin declares a plugin's development-time contributions: MCP bridge prefabs and playtest bot profiles.
type PrefabSpec struct {
// Name is the prefab name registered on the Bridge. When Prefab is set and Name is empty, Prefab.Name() is used.
Name string
// Prefab registers an *entities.Prefab via Bridge.RegisterEntityPrefab.
Prefab *entities.Prefab
// Scene registers a self-contained single-root *sceneformat.SceneDoc via Bridge.RegisterScenePrefab.
Scene *sceneformat.SceneDoc
// Spawn registers a custom mcp.PrefabSpawner via Bridge.RegisterPrefab.
Spawn mcp.PrefabSpawner
}PrefabSpec describes one prefab that a devplugin Plugin registers on Host.Bridge. Exactly one of Prefab, Scene, or Spawn must be non-nil.