Safe Haskell | None |
---|---|
Language | Haskell2010 |
A set of atomic commands shared by client and server. These are the largest building blocks that have no components that can be observed in isolation.
We try to make atomic commands respect the laws of energy and mass
conservation, unless they really can't, e.g., monster spawning.
For example item removal from inventory is not an atomic command,
but item dropped from the inventory to the ground is. This makes
it easier to undo the commands. In principle, the commands are the only
way to affect the basic game state (State
).
See https://github.com/LambdaHack/LambdaHack/wiki/Client-server-architecture.
- data CmdAtomic
- data UpdAtomic
- = UpdCreateActor !ActorId !Actor ![(ItemId, Item)]
- | UpdDestroyActor !ActorId !Actor ![(ItemId, Item)]
- | UpdCreateItem !ItemId !Item !ItemQuant !Container
- | UpdDestroyItem !ItemId !Item !ItemQuant !Container
- | UpdSpotActor !ActorId !Actor ![(ItemId, Item)]
- | UpdLoseActor !ActorId !Actor ![(ItemId, Item)]
- | UpdSpotItem !Bool !ItemId !Item !ItemQuant !Container
- | UpdLoseItem !Bool !ItemId !Item !ItemQuant !Container
- | UpdMoveActor !ActorId !Point !Point
- | UpdWaitActor !ActorId !Bool
- | UpdDisplaceActor !ActorId !ActorId
- | UpdMoveItem !ItemId !Int !ActorId !CStore !CStore
- | UpdRefillHP !ActorId !Int64
- | UpdRefillCalm !ActorId !Int64
- | UpdTrajectory !ActorId !(Maybe ([Vector], Speed)) !(Maybe ([Vector], Speed))
- | UpdQuitFaction !FactionId !(Maybe Status) !(Maybe Status)
- | UpdLeadFaction !FactionId !(Maybe ActorId) !(Maybe ActorId)
- | UpdDiplFaction !FactionId !FactionId !Diplomacy !Diplomacy
- | UpdTacticFaction !FactionId !Tactic !Tactic
- | UpdAutoFaction !FactionId !Bool
- | UpdRecordKill !ActorId !(Id ItemKind) !Int
- | UpdAlterTile !LevelId !Point !(Id TileKind) !(Id TileKind)
- | UpdAlterExplorable !LevelId !Int
- | UpdSearchTile !ActorId !Point !(Id TileKind)
- | UpdHideTile !ActorId !Point !(Id TileKind)
- | UpdSpotTile !LevelId ![(Point, Id TileKind)]
- | UpdLoseTile !LevelId ![(Point, Id TileKind)]
- | UpdAlterSmell !LevelId !Point !Time !Time
- | UpdSpotSmell !LevelId ![(Point, Time)]
- | UpdLoseSmell !LevelId ![(Point, Time)]
- | UpdTimeItem !ItemId !Container !ItemTimer !ItemTimer
- | UpdAgeGame ![LevelId]
- | UpdUnAgeGame ![LevelId]
- | UpdDiscover !Container !ItemId !(Id ItemKind) !ItemSeed
- | UpdCover !Container !ItemId !(Id ItemKind) !ItemSeed
- | UpdDiscoverKind !Container !ItemId !(Id ItemKind)
- | UpdCoverKind !Container !ItemId !(Id ItemKind)
- | UpdDiscoverSeed !Container !ItemId !ItemSeed
- | UpdCoverSeed !Container !ItemId !ItemSeed
- | UpdPerception !LevelId !Perception !Perception
- | UpdRestart !FactionId !DiscoveryKind !PerLid !State !Challenge !DebugModeCli
- | UpdRestartServer !State
- | UpdResume !FactionId !PerLid
- | UpdResumeServer !State
- | UpdKillExit !FactionId
- | UpdWriteSave
- | UpdMsgAll !Text
- data SfxAtomic
- = SfxStrike !ActorId !ActorId !ItemId !CStore
- | SfxRecoil !ActorId !ActorId !ItemId !CStore
- | SfxSteal !ActorId !ActorId !ItemId !CStore
- | SfxRelease !ActorId !ActorId !ItemId !CStore
- | SfxProject !ActorId !ItemId !CStore
- | SfxReceive !ActorId !ItemId !CStore
- | SfxApply !ActorId !ItemId !CStore
- | SfxCheck !ActorId !ItemId !CStore
- | SfxTrigger !ActorId !Point
- | SfxShun !ActorId !Point
- | SfxEffect !FactionId !ActorId !Effect !Int64
- | SfxMsgFid !FactionId !SfxMsg
- data SfxMsg
- = SfxUnexpected !ReqFailure
- | SfxLoudUpd !Bool !UpdAtomic
- | SfxLoudStrike !Bool !(Id ItemKind) !Int
- | SfxLoudSummon !Bool !(GroupName ItemKind) !Dice
- | SfxFizzles
- | SfxVoidDetection
- | SfxSummonLackCalm !ActorId
- | SfxLevelNoMore
- | SfxLevelPushed
- | SfxBracedImmune !ActorId
- | SfxEscapeImpossible
- | SfxTransImpossible
- | SfxIdentifyNothing !CStore
- | SfxPurposeNothing !CStore
- | SfxPurposeTooFew !Int !Int
- | SfxPurposeUnique
- | SfxColdFish
- | SfxTimerExtended !ActorId !ItemId !CStore
- undoUpdAtomic :: UpdAtomic -> Maybe UpdAtomic
- undoSfxAtomic :: SfxAtomic -> SfxAtomic
- undoCmdAtomic :: CmdAtomic -> Maybe CmdAtomic
Documentation
Abstract syntax of atomic commands, that is, atomic game state transformations.
Abstract syntax of atomic updates, that is, atomic commands that really change the state. Most of them are an encoding of a game state diff, though they also carry some intentional hints that help clients determine whether and how to communicate them to players.
Abstract syntax of atomic special effects, that is, atomic commands that only display special effects and don't change the state.
undoSfxAtomic :: SfxAtomic -> SfxAtomic Source #