swarm-0.5.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

Documentation

data NameGenerator Source #

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

Constructors

NameGenerator 

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.

dataNotFound :: FilePath -> IO LoadingFailure Source #

Get a nice message suggesting to download data directory to XdgData.

getSwarmXdgDataSubdir :: Bool -> FilePath -> IO FilePath Source #

Get path to swarm data, optionally creating necessary directories. This could fail if user has bad permissions on his own $HOME or $XDG_DATA_HOME which is unlikely.

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.

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.