Documentation
¶
Index ¶
- Constants
- Variables
- func EnumerateMods(w http.ResponseWriter, r *http.Request)
- func GameDir() string
- func HasSMAPI() (bool, error)
- func InitializeConfig() string
- func OpenSmapiInstall() error
- func StartAPI(addr string) error
- func UploadFile(w http.ResponseWriter, r *http.Request)
- func UrlOpener(url string) func() error
- type ContentPackRef
- type DependencyRef
- type Mod
- type ModManager
- type ModMetadata
Constants ¶
View Source
const (
ModsSubPath = "Mods"
)
Variables ¶
View Source
var ( Sugar *zap.SugaredLogger AppFs = afero.NewOsFs() )
Functions ¶
func EnumerateMods ¶
func EnumerateMods(w http.ResponseWriter, r *http.Request)
func OpenSmapiInstall ¶
func OpenSmapiInstall() error
func UploadFile ¶
func UploadFile(w http.ResponseWriter, r *http.Request)
1. Upload file to {config}/zips/ (UploadFile)
Types ¶
type ContentPackRef ¶
type ContentPackRef struct {
UniqueID string `json:"UniqueID"`
MinimumVersion string `json:"MinimumVersion"`
}
For a content pack, ContentPackFor specifies which mod can read it.
type DependencyRef ¶
type DependencyRef struct {
UniqueID string `json:"UniqueID"`
// optional. If specified, older versions won't meet the requirement.
MinimumVersion string `json:"MinimumVersion"`
// You can mark a dependency as optional. It will be loaded first if it's installed, otherwise it'll be ignored.
IsRequired bool `json:"IsRequired"`
}
The Dependencies field specifies other mods required to use this mod.
type Mod ¶
type Mod struct {
Directory string `json:"directory"`
Enabled bool `json:"enabled"`
Managed bool `json:"managed"`
Metadata ModMetadata `json:"metadata"`
}
Mod is a a SMAPI mod
func LoadMods ¶
LoadMods searches the provided game directory for mods and parses them into Mod structures
func (*Mod) RefreshEnabled ¶
func (m *Mod) RefreshEnabled()
type ModManager ¶
func (*ModManager) LoadModsFromFS ¶
func (m *ModManager) LoadModsFromFS()
func (*ModManager) RefreshEnabled ¶
func (m *ModManager) RefreshEnabled()
type ModMetadata ¶
type ModMetadata struct {
// The mod name. SMAPI uses this in player messages, logs, and errors.
Name string `json:"Name"`
// The name of the person who created the mod. Ideally this should include the username used to publish mods.
Author string `json:"Author"`
// The mod's semantic version.
Version string `json:"Version"`
// A short explanation of what your mod does (one or two sentences), shown in the SMAPI log
Description string `json:"Description"`
// A unique identifier for your mod. The recommended format is <your name>.<mod name>, with no spaces or
// special characters. SMAPI uses this for update checks, mod dependencies, and compatibility blacklists
// (if the mod breaks in a future version of the game). When another mod needs to reference this mod,
// it uses the unique ID.
UniqueID string `json:"UniqueID"`
// All mods must specify either EntryDll (for a SMAPI mod) or ContentPackFor (for a content pack).
// These are mutually exclusive — you can't specify both.
// For a SMAPI mod, EntryDll is the mod's compiled DLL filename in its mod folder.
EntryDll string `json:"EntryDll"` // not present in content packs
// For a content pack, ContentPackFor specifies which mod can read it. The MinimumVersion is optional.
ContentPackFor ContentPackRef `json:"ContentPackFor"` // not present in mods
// The MinimumApiVersion fields sets the minimum SMAPI version needed to use this mod.
// If a player tries to use the mod with an older SMAPI version, they'll see a friendly message
// saying they need to update SMAPI. This also serves as a proxy for the minimum game version,
// since SMAPI itself enforces a minimum game version.
MinimumApiVersion string `json:"MinimumApiVersion"`
// The Dependencies field specifies other mods required to use this mod.
// If a player tries to use the mod and the dependencies aren't installed,
// the mod won't be loaded and they'll see a friendly message saying they need to
// install those
Dependencies []DependencyRef `json:"Dependencies"`
UpdateKeys []string `json:"UpdateKeys"`
}
Every SMAPI mod or content pack must have a manifest.json file in its folder. SMAPI uses this to identify and load the mod, perform update checks, etc.
Click to show internal directories.
Click to hide internal directories.