Safe Haskell | None |
---|---|
Language | Haskell2010 |
The monad for writing to the main game state.
Synopsis
- class MonadStateRead m => MonadStateWrite m where
- modifyState :: (State -> State) -> m ()
- putState :: State -> m ()
- newtype AtomicFail = AtomicFail String
- atomicFail :: String -> a
- updateLevel :: MonadStateWrite m => LevelId -> (Level -> Level) -> m ()
- updateActor :: MonadStateWrite m => ActorId -> (Actor -> Actor) -> m ()
- updateFaction :: MonadStateWrite m => FactionId -> (Faction -> Faction) -> m ()
- moveActorMap :: MonadStateWrite m => ActorId -> Actor -> Actor -> m ()
- swapActorMap :: MonadStateWrite m => ActorId -> Actor -> ActorId -> Actor -> m ()
- insertBagContainer :: MonadStateWrite m => ItemBag -> Container -> m ()
- insertItemContainer :: MonadStateWrite m => ItemId -> ItemQuant -> Container -> m ()
- insertItemActor :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> CStore -> m ()
- deleteBagContainer :: MonadStateWrite m => ItemBag -> Container -> m ()
- deleteItemContainer :: MonadStateWrite m => ItemId -> ItemQuant -> Container -> m ()
- deleteItemActor :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> CStore -> m ()
- itemsMatch :: Item -> Item -> Bool
- addItemToActorMaxSkills :: MonadStateWrite m => ItemId -> Item -> Int -> ActorId -> m ()
- resetActorMaxSkills :: MonadStateWrite m => m ()
- insertItemFloor :: MonadStateWrite m => ItemId -> ItemQuant -> LevelId -> Point -> m ()
- insertItemEmbed :: MonadStateWrite m => ItemId -> ItemQuant -> LevelId -> Point -> m ()
- insertItemOrgan :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> m ()
- insertItemEqp :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> m ()
- insertItemStash :: MonadStateWrite m => ItemId -> ItemQuant -> FactionId -> m ()
- deleteItemFloor :: MonadStateWrite m => ItemId -> ItemQuant -> LevelId -> Point -> m ()
- deleteItemEmbed :: MonadStateWrite m => ItemId -> ItemQuant -> LevelId -> Point -> m ()
- deleteItemOrgan :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> m ()
- deleteItemEqp :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> m ()
- deleteItemStash :: MonadStateWrite m => ItemId -> ItemQuant -> FactionId -> m ()
- rmFromBag :: ItemQuant -> ItemId -> ItemBag -> ItemBag
Documentation
class MonadStateRead m => MonadStateWrite m where Source #
The monad for writing to the main game state. Atomic updates (UpdAtomic
)
are given semantics in this monad.
Instances
MonadStateWrite CliImplementation Source # | |
Defined in Implementation.MonadClientImplementation modifyState :: (State -> State) -> CliImplementation () Source # putState :: State -> CliImplementation () Source # | |
MonadStateWrite SerImplementation Source # | |
Defined in Implementation.MonadServerImplementation modifyState :: (State -> State) -> SerImplementation () Source # putState :: State -> SerImplementation () Source # |
newtype AtomicFail Source #
Exception signifying that atomic action failed because
the information it carries is inconsistent with the client's state,
(e.g., because the client knows too little to understand the command
or already deduced the state change from earlier commands
or is confused, amnesiac or sees illusory actors or tiles).
Whenever we know the failure is logically impossible,
we don't throw the AtomicFail
exception, but insert a normal assertion
or error
call, which are never caught nor handled.
Instances
Show AtomicFail Source # | |
Defined in Game.LambdaHack.Atomic.MonadStateWrite showsPrec :: Int -> AtomicFail -> ShowS # show :: AtomicFail -> String # showList :: [AtomicFail] -> ShowS # | |
Exception AtomicFail Source # | |
Defined in Game.LambdaHack.Atomic.MonadStateWrite toException :: AtomicFail -> SomeException # fromException :: SomeException -> Maybe AtomicFail # displayException :: AtomicFail -> String # |
atomicFail :: String -> a Source #
updateLevel :: MonadStateWrite m => LevelId -> (Level -> Level) -> m () Source #
updateActor :: MonadStateWrite m => ActorId -> (Actor -> Actor) -> m () Source #
updateFaction :: MonadStateWrite m => FactionId -> (Faction -> Faction) -> m () Source #
moveActorMap :: MonadStateWrite m => ActorId -> Actor -> Actor -> m () Source #
swapActorMap :: MonadStateWrite m => ActorId -> Actor -> ActorId -> Actor -> m () Source #
insertBagContainer :: MonadStateWrite m => ItemBag -> Container -> m () Source #
insertItemContainer :: MonadStateWrite m => ItemId -> ItemQuant -> Container -> m () Source #
insertItemActor :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> CStore -> m () Source #
deleteBagContainer :: MonadStateWrite m => ItemBag -> Container -> m () Source #
deleteItemContainer :: MonadStateWrite m => ItemId -> ItemQuant -> Container -> m () Source #
deleteItemActor :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> CStore -> m () Source #
addItemToActorMaxSkills :: MonadStateWrite m => ItemId -> Item -> Int -> ActorId -> m () Source #
resetActorMaxSkills :: MonadStateWrite m => m () Source #
Internal operations
insertItemFloor :: MonadStateWrite m => ItemId -> ItemQuant -> LevelId -> Point -> m () Source #
insertItemEmbed :: MonadStateWrite m => ItemId -> ItemQuant -> LevelId -> Point -> m () Source #
insertItemOrgan :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> m () Source #
insertItemEqp :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> m () Source #
insertItemStash :: MonadStateWrite m => ItemId -> ItemQuant -> FactionId -> m () Source #
deleteItemFloor :: MonadStateWrite m => ItemId -> ItemQuant -> LevelId -> Point -> m () Source #
deleteItemEmbed :: MonadStateWrite m => ItemId -> ItemQuant -> LevelId -> Point -> m () Source #
deleteItemOrgan :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> m () Source #
deleteItemEqp :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> m () Source #
deleteItemStash :: MonadStateWrite m => ItemId -> ItemQuant -> FactionId -> m () Source #