edit

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package edit contains logic for creating and updating game content. The services in this package modify resources directly.

Index

Constants

View Source
const (
	VariableContextCitadel = VariableBaseContextIdentifier(0)
	VariableContextEngine  = VariableBaseContextIdentifier(1)
)

Context identifier

Variables

This section is empty.

Functions

This section is empty.

Types

type AugmentedTextBlockSetter

type AugmentedTextBlockSetter interface {
	SetResourceBlock(lang resource.Language, id resource.ID, index int, data []byte)
	SetResourceBlocks(lang resource.Language, id resource.ID, data [][]byte)
	DelResource(lang resource.Language, id resource.ID)
}

AugmentedTextBlockSetter modifies resource blocks.

type AugmentedTextService

type AugmentedTextService struct {
	// contains filtered or unexported fields
}

AugmentedTextService provides read/write functionality.

func NewAugmentedTextService

func NewAugmentedTextService(
	textViewer media.TextViewerService, textSetter media.TextSetterService,
	audioViewer media.AudioViewerService, audioSetter media.AudioSetterService) AugmentedTextService

NewAugmentedTextService returns a new instance based on given accessor.

func (AugmentedTextService) Clear

func (service AugmentedTextService) Clear(setter AugmentedTextBlockSetter, key resource.Key)

Clear sets the text to an empty string and sets an empty sound if audio is associated.

func (AugmentedTextService) Remove

func (service AugmentedTextService) Remove(setter AugmentedTextBlockSetter, key resource.Key)

Remove erases the text and audio from the resources.

func (AugmentedTextService) RestoreFunc

func (service AugmentedTextService) RestoreFunc(key resource.Key) func(setter AugmentedTextBlockSetter)

RestoreFunc creates a snapshot of all associated media components and returns a function to restore it.

func (AugmentedTextService) RestoreSoundFunc

func (service AugmentedTextService) RestoreSoundFunc(key resource.Key) func(setter AugmentedTextBlockSetter)

RestoreSoundFunc creates a snapshot of the current sound and returns a function to restore it. In case the text resource has no audio, a stub method will be returned.

func (AugmentedTextService) RestoreTextFunc

func (service AugmentedTextService) RestoreTextFunc(key resource.Key) func(setter AugmentedTextBlockSetter)

RestoreTextFunc creates a snapshot of the current textual state and returns a function to restore it.

func (AugmentedTextService) SetSound

func (service AugmentedTextService) SetSound(setter AugmentedTextBlockSetter, key resource.Key, sound audio.L8)

SetSound changes the sound of a text resource. Should the text resource have no audio component, this call does nothing.

func (AugmentedTextService) SetText

func (service AugmentedTextService) SetText(setter AugmentedTextBlockSetter, key resource.Key, value string)

SetText changes the textual value of a text resource.

func (AugmentedTextService) Sound

func (service AugmentedTextService) Sound(key resource.Key) audio.L8

Sound returns the audio value of the identified text resource. In case the text resource has no audio, an empty sound will be returned.

func (AugmentedTextService) Text

func (service AugmentedTextService) Text(key resource.Key) string

Text returns the textual value of the identified text resource.

func (AugmentedTextService) WithAudio

func (service AugmentedTextService) WithAudio(key resource.Key) bool

WithAudio returns true if the identified resource is one with an audio component.

type GameStateService added in v1.7.0

type GameStateService struct {
	// contains filtered or unexported fields
}

GameStateService handles all details on the global game state.

func NewGameStateService added in v1.7.0

func NewGameStateService(registry cmd.Registry) *GameStateService

NewGameStateService returns a new instance.

func (GameStateService) BooleanVariable added in v1.7.0

func (service GameStateService) BooleanVariable(index int) archive.GameVariableInfo

BooleanVariable returns the variable info as per project settings for the given index.

func (GameStateService) BooleanVariableOverride added in v1.7.0

func (service GameStateService) BooleanVariableOverride(index int) bool

BooleanVariableOverride returns true if project-specific details are stored for given variable index.

func (GameStateService) CurrentSettings added in v1.7.0

func (service GameStateService) CurrentSettings() GameStateSettings

CurrentSettings returns the snapshot of the project.

func (*GameStateService) DefaultAllVariables added in v1.7.0

func (service *GameStateService) DefaultAllVariables() error

DefaultAllVariables removes all project specific overrides.

func (*GameStateService) DefaultBooleanVariable added in v1.7.0

func (service *GameStateService) DefaultBooleanVariable(index int) error

DefaultBooleanVariable clears the variable info for the given index in the project settings.

func (*GameStateService) DefaultIntegerVariable added in v1.7.0

func (service *GameStateService) DefaultIntegerVariable(index int) error

DefaultIntegerVariable clears the variable info for the given index in the project settings.

func (GameStateService) IntegerVariable added in v1.7.0

func (service GameStateService) IntegerVariable(index int) archive.GameVariableInfo

IntegerVariable returns the variable info as per project settings for the given index.

func (GameStateService) IntegerVariableOverride added in v1.7.0

func (service GameStateService) IntegerVariableOverride(index int) bool

IntegerVariableOverride returns true if project-specific details are stored for given variable index.

func (*GameStateService) RestoreSettings added in v1.7.0

func (service *GameStateService) RestoreSettings(settings GameStateSettings)

RestoreSettings loads the given snapshot.

func (*GameStateService) SetBooleanVariable added in v1.7.0

func (service *GameStateService) SetBooleanVariable(index int, info archive.GameVariableInfo) error

SetBooleanVariable sets the variable info for the given index in the project settings.

func (*GameStateService) SetIntegerVariable added in v1.7.0

func (service *GameStateService) SetIntegerVariable(index int, info archive.GameVariableInfo) error

SetIntegerVariable sets the variable info for the given index in the project settings.

func (*GameStateService) SetVariableBaseContext added in v1.7.0

func (service *GameStateService) SetVariableBaseContext(identifier VariableBaseContextIdentifier)

SetVariableBaseContext sets the current context to use as basis for variables not specified by the project.

func (GameStateService) VariableBaseContext added in v1.7.0

func (service GameStateService) VariableBaseContext() VariableBaseContextIdentifier

VariableBaseContext returns the current context to use as basis for variables not specified by the project.

type GameStateSettings added in v1.7.0

type GameStateSettings struct {
	BaseContext int

	BooleanVariables []VariableSettings
	IntegerVariables []VariableSettings
}

GameStateSettings describe the game state details.

type ManifestEntrySettings added in v1.6.0

type ManifestEntrySettings struct {
	Origin []string
}

ManifestEntrySettings describe the properties of one manifest entry in a project.

type MovieService

type MovieService struct {
	// contains filtered or unexported fields
}

MovieService provides read/write functionality.

func NewMovieService

func NewMovieService(codepage text.Codepage,
	movieViewer media.MovieViewerService, movieSetter media.MovieSetterService) MovieService

NewMovieService returns a new instance based on given accessor.

func (MovieService) AddScene

func (service MovieService) AddScene(setter media.MovieBlockSetter, key resource.Key, scene movie.HighResScene)

AddScene adds the given scene at the end of the movie.

func (MovieService) Audio

func (service MovieService) Audio(key resource.Key) audio.L8

Audio returns the audio component of identified movie.

func (MovieService) MoveSceneEarlier

func (service MovieService) MoveSceneEarlier(setter media.MovieBlockSetter, key resource.Key, scene int)

MoveSceneEarlier moves the given scene one step earlier.

func (MovieService) MoveSceneLater

func (service MovieService) MoveSceneLater(setter media.MovieBlockSetter, key resource.Key, scene int)

MoveSceneLater moves the given scene one step later.

func (MovieService) Remove

func (service MovieService) Remove(setter media.MovieBlockSetter, key resource.Key)

Remove erases the movie from the resources.

func (MovieService) RemoveScene

func (service MovieService) RemoveScene(setter media.MovieBlockSetter, key resource.Key, scene int)

RemoveScene cuts out the given scene from the movie.

func (MovieService) RestoreFunc

func (service MovieService) RestoreFunc(key resource.Key) func(setter media.MovieBlockSetter)

RestoreFunc creates a snapshot of the current movie and returns a function to restore it.

func (MovieService) SetAudio

func (service MovieService) SetAudio(setter media.MovieBlockSetter, key resource.Key, soundData audio.L8)

SetAudio sets the audio component of identified movie.

func (MovieService) SetSceneFramesDisplayTime

func (service MovieService) SetSceneFramesDisplayTime(setter media.MovieBlockSetter, key resource.Key,
	scene int, displayTime time.Duration)

SetSceneFramesDisplayTime sets the display time for each frame.

func (MovieService) SetSubtitles

func (service MovieService) SetSubtitles(setter media.MovieBlockSetter, key resource.Key,
	language resource.Language, subtitles movie.SubtitleList)

SetSubtitles sets the subtitles of identified movie in given language.

func (MovieService) SizeWarning

func (service MovieService) SizeWarning(key resource.Key) bool

SizeWarning returns true if the given movie is larger than the underlying archive would support.

func (MovieService) Subtitles

func (service MovieService) Subtitles(key resource.Key, language resource.Language) movie.SubtitleList

Subtitles returns the subtitles associated with the given key.

func (MovieService) Video

func (service MovieService) Video(key resource.Key) []movie.Scene

Video returns the video component of identified movie.

type ProjectService added in v1.6.0

type ProjectService struct {
	// contains filtered or unexported fields
}

ProjectService handles the overall information about the active project.

func NewProjectService added in v1.6.0

func NewProjectService(commander cmd.Registry, mod *world.Mod) *ProjectService

NewProjectService returns a new instance of a service for given mod.

func (*ProjectService) AddManifestEntry added in v1.6.0

func (service *ProjectService) AddManifestEntry(at int, entry *world.ManifestEntry) error

AddManifestEntry attempts to insert the given manifest entry at given index.

func (ProjectService) CurrentSettings added in v1.6.0

func (service ProjectService) CurrentSettings() ProjectSettings

CurrentSettings returns the snapshot of the project.

func (ProjectService) CurrentStateFilename added in v1.7.0

func (service ProjectService) CurrentStateFilename() string

CurrentStateFilename returns the name for the state of the project.

func (ProjectService) Mod added in v1.6.0

func (service ProjectService) Mod() *world.Mod

Mod returns the currently active mod in the project.

func (ProjectService) ModHasStorageLocation added in v1.6.0

func (service ProjectService) ModHasStorageLocation() bool

ModHasStorageLocation returns whether the mod has a place to be stored.

func (ProjectService) ModPath added in v1.7.0

func (service ProjectService) ModPath() string

ModPath returns the base path of the mod in the project.

func (*ProjectService) ModifyModWith added in v1.7.0

func (service *ProjectService) ModifyModWith(modifier func(world.Modder) error) (err error)

ModifyModWith runs a function with the intent to alter the current mod.

func (*ProjectService) MoveManifestEntry added in v1.6.0

func (service *ProjectService) MoveManifestEntry(to, from int) error

MoveManifestEntry attempts to remove the manifest entry at given from index and re-insert it at given to index.

func (*ProjectService) NewMod added in v1.6.0

func (service *ProjectService) NewMod()

NewMod resets the mod to a new state.

func (*ProjectService) RemoveManifestEntry added in v1.6.0

func (service *ProjectService) RemoveManifestEntry(at int) error

RemoveManifestEntry attempts to remove the manifest entry at given index.

func (*ProjectService) ResetProject added in v1.7.0

func (service *ProjectService) ResetProject()

ResetProject clears the project and returns it to initial state.

func (*ProjectService) RestoreProject added in v1.7.0

func (service *ProjectService) RestoreProject(settings ProjectSettings, stateFilename string)

RestoreProject sets internal data based on the given settings.

func (*ProjectService) SaveMod added in v1.6.0

func (service *ProjectService) SaveMod() error

SaveMod will store the currently active mod in its current path.

func (*ProjectService) SaveModUnder added in v1.6.0

func (service *ProjectService) SaveModUnder(modPath string) error

SaveModUnder will store the currently active mod in the given path.

func (ProjectService) SaveStatus added in v1.6.0

func (service ProjectService) SaveStatus() SaveStatus

SaveStatus returns the current pending save information.

func (*ProjectService) SetCurrentStateFilename added in v1.7.0

func (service *ProjectService) SetCurrentStateFilename(value string)

SetCurrentStateFilename updates the current filename.

func (*ProjectService) TryLoadModFrom added in v1.6.0

func (service *ProjectService) TryLoadModFrom(names []string) error

TryLoadModFrom attempts to set the active mod from given filenames.

type ProjectSettings added in v1.6.0

type ProjectSettings struct {
	ModFiles []string
	Manifest []ManifestEntrySettings
}

ProjectSettings describe the properties of a project.

type SaveStatus added in v1.6.0

type SaveStatus struct {

	// FilesModified is the count of how many files are affected by the current pending change.
	FilesModified int
	// SavePending is set if the mod has a storage location and changes are to be saved.
	SavePending bool
	// SaveIn is the duration after which an auto-save should happen.
	SaveIn time.Duration
	// contains filtered or unexported fields
}

SaveStatus describes the current change state.

func (SaveStatus) ConfirmPendingSave added in v1.6.0

func (status SaveStatus) ConfirmPendingSave()

ConfirmPendingSave marks that the recent auto-save status has been acknowledged and should no longer be notified. A new change will re-start the auto-save timer.

type SoundEffectService

type SoundEffectService struct {
	// contains filtered or unexported fields
}

SoundEffectService provides read/write functionality.

func NewSoundEffectService

NewSoundEffectService returns a new instance based on given accessor.

func (SoundEffectService) Audio

func (service SoundEffectService) Audio(key resource.Key) audio.L8

Audio returns the audio component of identified sound effect.

func (SoundEffectService) Clear

func (service SoundEffectService) Clear(setter media.SoundEffectBlockSetter, key resource.Key)

Clear resets the identified audio resource to a silent one-sample audio.

func (SoundEffectService) Modified

func (service SoundEffectService) Modified(key resource.Key) bool

Modified returns true if the identified sound resource is marked as modified.

func (SoundEffectService) Remove

func (service SoundEffectService) Remove(setter media.SoundEffectBlockSetter, key resource.Key)

Remove erases the sound from the resources.

func (SoundEffectService) RestoreFunc

func (service SoundEffectService) RestoreFunc(key resource.Key) func(setter media.SoundEffectBlockSetter)

RestoreFunc creates a snapshot of the current sound and returns a function to restore it.

func (SoundEffectService) SetAudio

func (service SoundEffectService) SetAudio(setter media.SoundEffectBlockSetter, key resource.Key, data audio.L8)

SetAudio sets the audio component of identified sound effect.

type TextInfo

type TextInfo struct {
	ID    resource.ID
	Title string
	// contains filtered or unexported fields
}

TextInfo describes one kind of text.

type TextInfoList

type TextInfoList []TextInfo

TextInfoList is a set of TextInfo.

func KnownTexts

func KnownTexts() TextInfoList

KnownTexts returns a set of known texts.

func (TextInfoList) ByID

func (list TextInfoList) ByID(id resource.ID) TextInfo

ByID returns a text info for the given identifier.

func (TextInfoList) Title

func (list TextInfoList) Title(id resource.ID) string

Title returns the title property of the identified info.

type VariableBaseContextIdentifier added in v1.7.0

type VariableBaseContextIdentifier int

VariableBaseContextIdentifier identifies which context for variable naming should be used.

func VariableContextIdentifiers added in v1.7.0

func VariableContextIdentifiers() []VariableBaseContextIdentifier

VariableContextIdentifiers returns a list of all available identifiers.

type VariableSettings added in v1.7.0

type VariableSettings struct {
	Index int

	ResetValue  *int16 `json:",omitempty"`
	Name        string
	Description string
	Limits      *struct {
		Minimum int16
		Maximum int16
	} `json:",omitempty"`
	ValueNames []struct {
		Value int16
		Name  string
	} `json:",omitempty"`
}

VariableSettings describe game variables.

Directories

Path Synopsis
Package media contains low-level media accessors and modifier.
Package media contains low-level media accessors and modifier.
Package undoable contains edit extensions that provide an undo-mechanism.
Package undoable contains edit extensions that provide an undo-mechanism.
cmd

Jump to

Keyboard shortcuts

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