LambdaHack-0.11.0.1: A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Atomic.CmdAtomic

Description

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 equipment, in isolation, is not an atomic command, but item dropped from equipment 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.

Synopsis

- data CmdAtomic
  - = UpdAtomic UpdAtomic
  - | SfxAtomic SfxAtomic
- data UpdAtomic
  - = UpdRegisterItems [(ItemId, Item)]
  - | UpdCreateActor ActorId Actor [(ItemId, Item)]
  - | UpdDestroyActor ActorId Actor [(ItemId, Item)]
  - | UpdCreateItem Bool ItemId Item ItemQuant Container
  - | UpdDestroyItem Bool ItemId Item ItemQuant Container
  - | UpdSpotActor ActorId Actor
  - | UpdLoseActor ActorId Actor
  - | UpdSpotItem Bool ItemId ItemQuant Container
  - | UpdLoseItem Bool ItemId ItemQuant Container
  - | UpdSpotItemBag Bool Container ItemBag
  - | UpdLoseItemBag Bool Container ItemBag
  - | UpdMoveActor ActorId Point Point
  - | UpdWaitActor ActorId Watchfulness Watchfulness
  - | 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) (Maybe (FactionAnalytics, GenerationAnalytics))
  - | UpdSpotStashFaction Bool FactionId LevelId Point
  - | UpdLoseStashFaction Bool FactionId LevelId Point
  - | UpdLeadFaction FactionId (Maybe ActorId) (Maybe ActorId)
  - | UpdDiplFaction FactionId FactionId Diplomacy Diplomacy
  - | UpdDoctrineFaction FactionId Doctrine Doctrine
  - | UpdAutoFaction FactionId Bool
  - | UpdRecordKill ActorId (ContentId ItemKind) Int
  - | UpdAlterTile LevelId Point (ContentId TileKind) (ContentId TileKind)
  - | UpdAlterExplorable LevelId Int
  - | UpdAlterGold Int
  - | UpdSearchTile ActorId Point (ContentId TileKind)
  - | UpdHideTile ActorId Point (ContentId TileKind)
  - | UpdSpotTile LevelId [(Point, ContentId TileKind)]
  - | UpdLoseTile LevelId [(Point, ContentId TileKind)]
  - | UpdSpotEntry LevelId [(Point, PlaceEntry)]
  - | UpdLoseEntry LevelId [(Point, PlaceEntry)]
  - | UpdAlterSmell LevelId Point Time Time
  - | UpdSpotSmell LevelId [(Point, Time)]
  - | UpdLoseSmell LevelId [(Point, Time)]
  - | UpdTimeItem ItemId Container ItemTimers ItemTimers
  - | UpdAgeGame (EnumSet LevelId)
  - | UpdUnAgeGame (EnumSet LevelId)
  - | UpdDiscover Container ItemId (ContentId ItemKind) AspectRecord
  - | UpdCover Container ItemId (ContentId ItemKind) AspectRecord
  - | UpdDiscoverKind Container ItemKindIx (ContentId ItemKind)
  - | UpdCoverKind Container ItemKindIx (ContentId ItemKind)
  - | UpdDiscoverAspect Container ItemId AspectRecord
  - | UpdCoverAspect Container ItemId AspectRecord
  - | UpdDiscoverServer ItemId AspectRecord
  - | UpdCoverServer ItemId AspectRecord
  - | UpdPerception LevelId Perception Perception
  - | UpdRestart FactionId PerLid State Challenge ClientOptions SMGen
  - | UpdRestartServer State
  - | UpdResume FactionId PerLid
  - | UpdResumeServer State
  - | UpdKillExit FactionId
  - | UpdWriteSave
  - | UpdHearFid FactionId (Maybe Int) HearMsg
  - | UpdMuteMessages FactionId Bool
- data HearMsg
  - = HearUpd UpdAtomic
  - | HearStrike (ContentId ItemKind)
  - | HearSummon Bool (GroupName ItemKind) Dice
  - | HearCollideTile
  - | HearTaunt Text
- data SfxAtomic
  - = SfxStrike ActorId ActorId ItemId
  - | SfxRecoil ActorId ActorId ItemId
  - | SfxSteal ActorId ActorId ItemId
  - | SfxRelease ActorId ActorId ItemId
  - | SfxProject ActorId ItemId
  - | SfxReceive ActorId ItemId
  - | SfxApply ActorId ItemId
  - | SfxCheck ActorId ItemId
  - | SfxTrigger ActorId LevelId Point (ContentId TileKind)
  - | SfxShun ActorId LevelId Point (ContentId TileKind)
  - | SfxEffect FactionId ActorId ItemId Effect Int64
  - | SfxItemApplied Bool ItemId Container
  - | SfxMsgFid FactionId SfxMsg
  - | SfxRestart
  - | SfxCollideTile ActorId Point
  - | SfxTaunt Bool ActorId
- data SfxMsg
  - = SfxUnexpected ReqFailure
  - | SfxExpected Text ReqFailure
  - | SfxExpectedEmbed ItemId LevelId ReqFailure
  - | SfxFizzles ItemId Container
  - | SfxNothingHappens ItemId Container
  - | SfxNoItemsForTile [[(Int, GroupName ItemKind)]]
  - | SfxVoidDetection DetectKind
  - | SfxUnimpressed ActorId
  - | SfxSummonLackCalm ActorId
  - | SfxSummonTooManyOwn ActorId
  - | SfxSummonTooManyAll ActorId
  - | SfxSummonFailure ActorId
  - | SfxLevelNoMore
  - | SfxLevelPushed
  - | SfxBracedImmune ActorId
  - | SfxEscapeImpossible
  - | SfxStasisProtects
  - | SfxWaterParalysisResisted
  - | SfxTransImpossible
  - | SfxIdentifyNothing
  - | SfxPurposeNothing
  - | SfxPurposeTooFew Int Int
  - | SfxPurposeUnique
  - | SfxPurposeNotCommon
  - | SfxRerollNothing
  - | SfxRerollNotRandom
  - | SfxDupNothing
  - | SfxDupUnique
  - | SfxDupValuable
  - | SfxColdFish
  - | SfxReadyGoods
  - | SfxTimerExtended ActorId ItemId CStore (Delta Time)
  - | SfxCollideActor ActorId ActorId
  - | SfxItemYield ItemId Int LevelId
- undoUpdAtomic :: UpdAtomic -> Maybe UpdAtomic
- undoSfxAtomic :: SfxAtomic -> SfxAtomic
- undoCmdAtomic :: CmdAtomic -> Maybe CmdAtomic

# Documentation

data CmdAtomic Source #

Abstract syntax of atomic commands, that is, atomic game state transformations.

Constructors

UpdAtomic UpdAtomic | atomic updates
SfxAtomic SfxAtomic | atomic special effects

#### Instances

Instances details

Show CmdAtomic Source # |
Instance details Defined in Game.LambdaHack.Atomic.CmdAtomic Methods showsPrec :: Int -> CmdAtomic -> ShowS Source # show :: CmdAtomic -> String Source # showList :: [CmdAtomic] -> ShowS Source #

data UpdAtomic Source #

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 it to players.

Constructors

UpdRegisterItems [(ItemId, Item)] |
UpdCreateActor ActorId Actor [(ItemId, Item)] |
UpdDestroyActor ActorId Actor [(ItemId, Item)] |
UpdCreateItem Bool ItemId Item ItemQuant Container |
UpdDestroyItem Bool ItemId Item ItemQuant Container |
UpdSpotActor ActorId Actor |
UpdLoseActor ActorId Actor |
UpdSpotItem Bool ItemId ItemQuant Container |
UpdLoseItem Bool ItemId ItemQuant Container |
UpdSpotItemBag Bool Container ItemBag |
UpdLoseItemBag Bool Container ItemBag |
UpdMoveActor ActorId Point Point |
UpdWaitActor ActorId Watchfulness Watchfulness |
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) (Maybe (FactionAnalytics, GenerationAnalytics)) |
UpdSpotStashFaction Bool FactionId LevelId Point |
UpdLoseStashFaction Bool FactionId LevelId Point |
UpdLeadFaction FactionId (Maybe ActorId) (Maybe ActorId) |
UpdDiplFaction FactionId FactionId Diplomacy Diplomacy |
UpdDoctrineFaction FactionId Doctrine Doctrine |
UpdAutoFaction FactionId Bool |
UpdRecordKill ActorId (ContentId ItemKind) Int |
UpdAlterTile LevelId Point (ContentId TileKind) (ContentId TileKind) |
UpdAlterExplorable LevelId Int |
UpdAlterGold Int |
UpdSearchTile ActorId Point (ContentId TileKind) |
UpdHideTile ActorId Point (ContentId TileKind) |
UpdSpotTile LevelId [(Point, ContentId TileKind)] |
UpdLoseTile LevelId [(Point, ContentId TileKind)] |
UpdSpotEntry LevelId [(Point, PlaceEntry)] |
UpdLoseEntry LevelId [(Point, PlaceEntry)] |
UpdAlterSmell LevelId Point Time Time |
UpdSpotSmell LevelId [(Point, Time)] |
UpdLoseSmell LevelId [(Point, Time)] |
UpdTimeItem ItemId Container ItemTimers ItemTimers |
UpdAgeGame (EnumSet LevelId) |
UpdUnAgeGame (EnumSet LevelId) |
UpdDiscover Container ItemId (ContentId ItemKind) AspectRecord |
UpdCover Container ItemId (ContentId ItemKind) AspectRecord |
UpdDiscoverKind Container ItemKindIx (ContentId ItemKind) |
UpdCoverKind Container ItemKindIx (ContentId ItemKind) |
UpdDiscoverAspect Container ItemId AspectRecord |
UpdCoverAspect Container ItemId AspectRecord |
UpdDiscoverServer ItemId AspectRecord |
UpdCoverServer ItemId AspectRecord |
UpdPerception LevelId Perception Perception |
UpdRestart FactionId PerLid State Challenge ClientOptions SMGen |
UpdRestartServer State |
UpdResume FactionId PerLid |
UpdResumeServer State |
UpdKillExit FactionId |
UpdWriteSave |
UpdHearFid FactionId (Maybe Int) HearMsg |
UpdMuteMessages FactionId Bool |

#### Instances

Instances details

Show UpdAtomic Source # |
Instance details Defined in Game.LambdaHack.Atomic.CmdAtomic Methods showsPrec :: Int -> UpdAtomic -> ShowS Source # show :: UpdAtomic -> String Source # showList :: [UpdAtomic] -> ShowS Source #

data HearMsg Source #

Symbolic representation of text messages about heard noises, sent by server to clients and shown to players and used by AI.

Constructors

HearUpd UpdAtomic |
HearStrike (ContentId ItemKind) |
HearSummon Bool (GroupName ItemKind) Dice |
HearCollideTile |
HearTaunt Text |

#### Instances

Instances details

Show HearMsg Source # |
Instance details Defined in Game.LambdaHack.Atomic.CmdAtomic Methods showsPrec :: Int -> HearMsg -> ShowS Source # show :: HearMsg -> String Source # showList :: [HearMsg] -> ShowS Source #

data SfxAtomic Source #

Abstract syntax of atomic special effects, that is, atomic commands that only display special effects and don't change `State` nor client state.

Constructors

SfxStrike ActorId ActorId ItemId |
SfxRecoil ActorId ActorId ItemId |
SfxSteal ActorId ActorId ItemId |
SfxRelease ActorId ActorId ItemId |
SfxProject ActorId ItemId |
SfxReceive ActorId ItemId |
SfxApply ActorId ItemId |
SfxCheck ActorId ItemId |
SfxTrigger ActorId LevelId Point (ContentId TileKind) |
SfxShun ActorId LevelId Point (ContentId TileKind) |
SfxEffect FactionId ActorId ItemId Effect Int64 |
SfxItemApplied Bool ItemId Container |
SfxMsgFid FactionId SfxMsg |
SfxRestart |
SfxCollideTile ActorId Point |
SfxTaunt Bool ActorId |

#### Instances

Instances details

Show SfxAtomic Source # |
Instance details Defined in Game.LambdaHack.Atomic.CmdAtomic Methods showsPrec :: Int -> SfxAtomic -> ShowS Source # show :: SfxAtomic -> String Source # showList :: [SfxAtomic] -> ShowS Source #

data SfxMsg Source #

Symbolic representation of text messages sent by server to clients and shown to players.

Constructors

SfxUnexpected ReqFailure |
SfxExpected Text ReqFailure |
SfxExpectedEmbed ItemId LevelId ReqFailure |
SfxFizzles ItemId Container |
SfxNothingHappens ItemId Container |
SfxNoItemsForTile [[(Int, GroupName ItemKind)]] |
SfxVoidDetection DetectKind |
SfxUnimpressed ActorId |
SfxSummonLackCalm ActorId |
SfxSummonTooManyOwn ActorId |
SfxSummonTooManyAll ActorId |
SfxSummonFailure ActorId |
SfxLevelNoMore |
SfxLevelPushed |
SfxBracedImmune ActorId |
SfxEscapeImpossible |
SfxStasisProtects |
SfxWaterParalysisResisted |
SfxTransImpossible |
SfxIdentifyNothing |
SfxPurposeNothing |
SfxPurposeTooFew Int Int |
SfxPurposeUnique |
SfxPurposeNotCommon |
SfxRerollNothing |
SfxRerollNotRandom |
SfxDupNothing |
SfxDupUnique |
SfxDupValuable |
SfxColdFish |
SfxReadyGoods |
SfxTimerExtended ActorId ItemId CStore (Delta Time) |
SfxCollideActor ActorId ActorId |
SfxItemYield ItemId Int LevelId |

#### Instances

Instances details

Show SfxMsg Source # |
Instance details Defined in Game.LambdaHack.Atomic.CmdAtomic Methods showsPrec :: Int -> SfxMsg -> ShowS Source # show :: SfxMsg -> String Source # showList :: [SfxMsg] -> ShowS Source #

undoUpdAtomic :: UpdAtomic -> Maybe UpdAtomic Source #

undoSfxAtomic :: SfxAtomic -> SfxAtomic Source #

undoCmdAtomic :: CmdAtomic -> Maybe CmdAtomic Source #