save

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GAME_VERSION           = "1.33.425"
	RESOURCE_FACTOR        = 100
	BUILDING_MAX_STORAGE   = 1000
	SPACESHIP_UNLOCK_VALUE = 1
)

Variables

This section is empty.

Functions

func DefaultSaveLocation added in v0.2.0

func DefaultSaveLocation() (string, error)

func NewErrMissingKey

func NewErrMissingKey(m, key string) error

func ResearchNames added in v0.2.0

func ResearchNames() []string

func ResourceNames added in v0.2.0

func ResourceNames() []string

func SpaceshipParts added in v1.1.0

func SpaceshipParts() []string

Types

type AchievementsManager

type AchievementsManager struct {
	UnlockabilityStatus           UnlockabilityStatus `json:"unlockabilityStatus"`
	SerializedAchievementTrackers json.RawMessage     `json:"serializedAchievementTrackers"`
}

type Building

type Building struct {
	BuildingName            string          `json:"buildingName"`
	CustomName              json.RawMessage `json:"customName"`
	Road                    int64           `json:"road"`
	Pipes                   json.RawMessage `json:"pipes"`
	ID                      int
	Position                json.RawMessage   `json:"position"`
	Rotation                json.Number       `json:"rotation"`
	ConsumerProducer        *ConsumerProducer `json:"consumerProducer"`
	MissingResourceDuration json.Number       `json:"missingResourceDuration"`
	Upgrades                json.RawMessage   `json:"upgrades"`
	IntegratedNetEdges      json.RawMessage   `json:"integratedNetEdges"`
	TextModule              json.RawMessage   `json:"textModule"`
	StationModule           json.RawMessage   `json:"stationModule"`
}

type BuildingType

type BuildingType int
const (
	TYPE_FACTORY    BuildingType = iota
	TYPE_HABITAT    BuildingType = iota
	TYPE_STOREHOUSE BuildingType = iota
	TYPE_RESEARCH   BuildingType = iota
	TYPE_UNKNOWN    BuildingType = iota
)

type ConsumerProducer

type ConsumerProducer struct {
	ProductionLogic       interface{} `json:"productionLogic"`
	IncomingStorage       []int64     `json:"incomingStorage"`
	OutgoingStorage       []int64     `json:"outgoingStorage"`
	RequestStatusDirty    bool        `json:"requestStatusDirty"`
	LastStepPowerProduced json.Number `json:"lastStepPowerProduced"`
	LastStepPowerNeeded   json.Number `json:"lastStepPowerNeeded"`

	Type BuildingType `json:"-"`
}

func (*ConsumerProducer) UnmarshalJSON

func (c *ConsumerProducer) UnmarshalJSON(data []byte) error

type EditBuildingsOptions

type EditBuildingsOptions struct {
	HabitatWorkers bool
	HabitatStorage bool
	FactoryStorage bool
	UpgradesOnly   bool
}

type EnvironmentObject

type EnvironmentObject struct {
	ID                  int64
	ObjectName          string      `json:"objectName"`
	Health              json.Number `json:"health"`
	TransformCompressed string      `json:"transformCompressed"`
}

type ErrMissingKey

type ErrMissingKey struct {
	Map, Key string
}

func (*ErrMissingKey) Error

func (e *ErrMissingKey) Error() string

type FactoryProductionLogic

type FactoryProductionLogic struct {
	Type                 string          `json:"$type"`
	ProductionDefinition json.RawMessage `json:"productionDefinition"`
	LogicOverride        json.RawMessage `json:"logicOverride"`
	TerraformRadius      json.Number     `json:"terraformRadius"`
	TerraformType        json.RawMessage `json:"terraformType"`
	ProductionTimeStep   int64           `json:"productionTimeStep"`
}

type HabitatProductionLogic

type HabitatProductionLogic struct {
	Type                    string                 `json:"$type"`
	Storage                 map[string]json.Number `json:"storage"`
	MaxInhabitants          int64                  `json:"maxInhabitants"`
	HabitatLevel            int64                  `json:"habitatLevel"`
	Upgrade                 string                 `json:"upgrade"`
	Downgrade               json.RawMessage        `json:"downgrade"`
	PowerNeededForTenPeople json.Number            `json:"powerNeededForTenPeople"`
	TargetInhabitants       json.Number            `json:"targetInhabitants"`
	UpgradeCountdown        json.Number            `json:"upgradeCountdown"`
	DowngradeCountdown      json.Number            `json:"downgradeCountdown"`
	Workers                 []Worker               `json:"workers"`
}

type Market

type Market struct {
	StarterWorkers     []Worker        `json:"starterWorkers"`
	ResourcePriorities json.RawMessage `json:"resourcePriorities"`
}

type NewWorldPersistent

type NewWorldPersistent struct {
	HeightData string          `json:"heightData"`
	AlphaData  []string        `json:"alphaData"`
	DetailData []string        `json:"detailData"`
	BiomesData json.RawMessage `json:"biomesData"`
}

type ResearchManager

type ResearchManager struct {
	ResearchProgress map[string]int64 `json:"researchProgress"`
	CurrentResearch  json.RawMessage  `json:"currentResearch"`
	ResearchQueue    []string         `json:"researchQueue"`
}

type SaveData

type SaveData struct {
	MapSeed                    int64               `json:"mapSeed"`
	MapGenVersion              int64               `json:"mapGenVersion"`
	NextID                     int64               `json:"nextID"`
	SimulationFrame            int64               `json:"simulationFrame"`
	TotalGameTime              json.Number         `json:"totalGameTime"`
	TotalPlayTime              json.Number         `json:"totalPlayTime"`
	SaveFixGracePeriodActive   bool                `json:"saveFixGracePeriodActive"`
	WorldSettings              json.RawMessage     `json:"worldSettings"`
	Buildings                  []Building          `json:"buildings"`
	BuildingConnectors         json.RawMessage     `json:"buildingConnectors"`
	BuildingGroups             json.RawMessage     `json:"buildingGroups"`
	NetEdges                   json.RawMessage     `json:"netEdges"`
	NetNodes                   json.RawMessage     `json:"netNodes"`
	Cars                       json.RawMessage     `json:"cars"`
	Market                     Market              `json:"market"`
	Resources                  map[string]int64    `json:"resources"`
	GoalManager                json.RawMessage     `json:"goalManager"`
	ResearchManager            ResearchManager     `json:"researchManager"`
	PopulationManager          json.RawMessage     `json:"populationManager"`
	Statistics                 json.RawMessage     `json:"statistics"`
	Camera                     json.RawMessage     `json:"camera"`
	DistrictManager            json.RawMessage     `json:"districtManager"`
	TrainLineManager           json.RawMessage     `json:"trainLineManager"`
	Trains                     json.RawMessage     `json:"trains"`
	CarCarriers                json.RawMessage     `json:"carCarriers"`
	Spaceship                  Spaceship           `json:"spaceship"`
	PipeComponentManager       json.RawMessage     `json:"pipeComponentManager"`
	ScriptMods                 json.RawMessage     `json:"scriptMods"`
	NewWorldPersistent         NewWorldPersistent  `json:"newWorldPersistent"`
	EnvironmentObjects         []EnvironmentObject `json:"environmentObjects"` // Very Big Object ca. 8k lines
	TerraformingProgressString json.RawMessage     `json:"terraformingProgressString"`
	AchievementsManager        AchievementsManager `json:"achievementsManager"`
	TrailerModule              json.RawMessage     `json:"trailerModule"`
	StoryMessagesModule        json.RawMessage     `json:"storyMessagesModule"`
	Roads                      json.RawMessage     `json:"roads"`
	Intersections              json.RawMessage     `json:"intersections"`
}

type Savegame

type Savegame struct {
	Changed bool
	// contains filtered or unexported fields
}

func LoadSavegame

func LoadSavegame(path string) (*Savegame, error)

Load the savegame from the path

func (*Savegame) AddStarterWorkers

func (s *Savegame) AddStarterWorkers(count int) int64

Increase the starter workers to the given count, return number of added workers

func (*Savegame) Backup

func (s *Savegame) Backup() (string, error)

Create a backup of the save file, returns the path of the backup

func (*Savegame) Data

func (s *Savegame) Data() *SaveData

func (*Savegame) EditBuildings

func (s *Savegame) EditBuildings(opt EditBuildingsOptions)

Edit the buildings with the given configuration

func (*Savegame) GetRepairedSpaceshipParts added in v1.1.0

func (s *Savegame) GetRepairedSpaceshipParts() []string

Get the repaired spaceship parts

func (*Savegame) GetResearchQueue added in v1.0.2

func (s *Savegame) GetResearchQueue() []string

Get research queue

func (*Savegame) GetResource

func (s *Savegame) GetResource(key string) (int, bool)

Get a resource by name

func (*Savegame) GetStarterWorkerCount added in v0.2.0

func (s *Savegame) GetStarterWorkerCount() int

Get the current number of starter workers

func (*Savegame) GetUnlockedResearch added in v0.2.0

func (s *Savegame) GetUnlockedResearch() []string

Get unlocked research

func (*Savegame) LockResearch added in v0.2.0

func (s *Savegame) LockResearch(name string)

Lock Research by name, if currently unlocked

func (*Savegame) Path

func (s *Savegame) Path() string

func (*Savegame) Prefix

func (s *Savegame) Prefix() string

func (*Savegame) RepairSpaceshipPart added in v1.1.0

func (s *Savegame) RepairSpaceshipPart(name string)

Repair the specified spaceship part

func (*Savegame) Save

func (s *Savegame) Save() error

Save the savegame to the Path

func (*Savegame) SetResource

func (s *Savegame) SetResource(key string, value int) error

Set the given resource

func (*Savegame) UnlockAllResearch

func (s *Savegame) UnlockAllResearch()

Unlocks all research

func (*Savegame) UnlockResearch added in v0.2.0

func (s *Savegame) UnlockResearch(name string)

Unlock research by name

type Spaceship added in v1.1.0

type Spaceship struct {
	CurrentlyRepairedPartName json.RawMessage `json:"currentlyRepairedPartName"`
	Parts                     []struct {
		Type           string          `json:"$type,omitempty"`
		TargetPosition json.RawMessage `json:"targetPosition,omitempty"`
		Timer          json.Number     `json:"timer,omitempty"`
		Name           string          `json:"name"`
		CurrentSteps   int64           `json:"currentSteps"`
	} `json:"parts"`
	CurrentlyRepairedPartNameKBackingField json.RawMessage `json:"<currentlyRepairedPartName>k__BackingField"`
}

type UnlockabilityStatus

type UnlockabilityStatus struct {
	DisabledDueToMods                             bool `json:"disabledDueToMods"`
	DisabledDueToCreativeSettings                 bool `json:"disabledDueToCreativeSettings"`
	DisabledDueToSettingsModification             bool `json:"disabledDueToSettingsModification"`
	DisabledDueToCheats                           bool `json:"disabledDueToCheats"`
	DisabledDueToModsBackingField                 bool `json:"<disabledDueToMods>k__BackingField"`
	DisabledDueToCreativeSettingsBackingField     bool `json:"<disabledDueToCreativeSettings>k__BackingField"`
	DisabledDueToSettingsModificationBackingField bool `json:"<disabledDueToSettingsModification>k__BackingField"`
	DisabledDueToCheatsBackingField               bool `json:"<disabledDueToCheats>k__BackingField"`
}

type Worker

type Worker struct {
	Home int64 `json:"_home"`
	ID   int64
}

Jump to

Keyboard shortcuts

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