swarm-0.6.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.Game.ResourceLoading

Description

Various utilities related to loading game data files.

Synopsis

Generic data access

getDataDirSafe :: (Has (Throw SystemFailure) sig m, Has (Lift IO) sig m) => AssetData -> FilePath -> m FilePath Source #

Get subdirectory from swarm data directory.

This will first look in Cabal generated path and then try a data directory in XdgData path.

The idea is that when installing with Cabal/Stack the first is preferred, but when the players install a binary they need to extract the `data` archive to the XDG directory.

getDataFileNameSafe :: (Has (Throw SystemFailure) sig m, Has (Lift IO) sig m) => AssetData -> FilePath -> m FilePath Source #

Get file from swarm data directory.

See the note in getDataDirSafe.

Concrete data access

getSwarmSavePath :: Bool -> IO FilePath Source #

Get path to swarm saves, optionally creating necessary directories.

getSwarmHistoryPath :: Bool -> IO FilePath Source #

Get path to swarm history, optionally creating necessary directories.

getSwarmAchievementsPath :: Bool -> IO FilePath Source #

Get a path to the directory where achievement records are stored. If the argument is set to True, create the directory if it does not exist.

Loading text files

readAppData :: (Has (Throw SystemFailure) sig m, Has (Lift IO) sig m) => m (Map Text Text) Source #

Read all the .txt files in the data/ directory.

data NameGenerator Source #

Read-only lists of adjectives and words for use in building random robot names

Constructors

NameGenerator