Safe Haskell | None |
---|---|
Language | Haskell2010 |
The monad for writing to the main game state.
- class MonadStateRead m => MonadStateWrite m where
- newtype AtomicFail = AtomicFail String
- atomicFail :: String -> a
- putState :: MonadStateWrite m => State -> m ()
- 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 ()
- 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 ()
- addAis :: MonadStateWrite m => [(ItemId, Item)] -> m ()
- itemsMatch :: Item -> Item -> Bool
- addItemToActor :: MonadStateWrite m => ItemId -> Item -> Int -> ActorId -> m ()
- resetActorAspect :: 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 ()
- insertItemInv :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> m ()
- insertItemSha :: 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 ()
- deleteItemInv :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> m ()
- deleteItemSha :: 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.
modifyState :: (State -> State) -> m () 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.
atomicFail :: String -> a Source #
putState :: MonadStateWrite m => State -> m () 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 #
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 #
addItemToActor :: MonadStateWrite m => ItemId -> Item -> Int -> ActorId -> m () Source #
resetActorAspect :: 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 #
insertItemInv :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> m () Source #
insertItemSha :: 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 #
deleteItemInv :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> m () Source #
deleteItemSha :: MonadStateWrite m => ItemId -> ItemQuant -> FactionId -> m () Source #