diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Main.hs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/Main.hs b/src/Main.hs index 258e230..e480f4b 100644 --- a/src/Main.hs +++ b/src/Main.hs | |||
@@ -77,25 +77,26 @@ stateOutline st | |||
77 | factionColumn i = [evalState ?? st $ toName x | x <- rowGroup, factionIndex x == i ] | 77 | factionColumn i = [evalState ?? st $ toName x | x <- rowGroup, factionIndex x == i ] |
78 | return . colsAllG top $ [show (seqVal' ^. seqVal)] : map factionColumn [0..(length factions - 1)] | 78 | return . colsAllG top $ [show (seqVal' ^. seqVal)] : map factionColumn [0..(length factions - 1)] |
79 | 79 | ||
80 | listFaction :: Completable Faction -> Sh GameState () | 80 | -- Query state |
81 | listFaction = withArg $ \qFaction -> use gEntities >>= mapM_ (shellPutStrLn <=< toName) . Map.keys . Map.filter ((==) qFaction . view eFaction) | 81 | listFactions, listEntities :: Sh GameState () |
82 | |||
83 | listFactions :: Sh GameState () | ||
84 | listFactions = use inhabitedFactions >>= mapM_ (shellPutStrLn . view faction') | 82 | listFactions = use inhabitedFactions >>= mapM_ (shellPutStrLn . view faction') |
85 | |||
86 | listEntities :: Sh GameState () | ||
87 | listEntities = use (gEntities . to Map.keys) >>= mapM_ (shellPutStrLn <=< toName) | 83 | listEntities = use (gEntities . to Map.keys) >>= mapM_ (shellPutStrLn <=< toName) |
88 | 84 | ||
89 | alignEntity :: Completable Faction -> Sh GameState () | 85 | -- Manage faction |
86 | listFaction, alignEntity :: Completable Faction -> Sh GameState () | ||
87 | listFaction = withArg $ \qFaction -> use gEntities >>= mapM_ (shellPutStrLn <=< toName) . Map.keys . Map.filter ((==) qFaction . view eFaction) | ||
90 | alignEntity = withArg $ \nFaction -> withFocus $ \ident -> gEntities %= Map.adjust (set eFaction nFaction) ident | 88 | alignEntity = withArg $ \nFaction -> withFocus $ \ident -> gEntities %= Map.adjust (set eFaction nFaction) ident |
91 | 89 | ||
90 | -- Automatic focus | ||
92 | focusTip, blur :: Sh GameState () | 91 | focusTip, blur :: Sh GameState () |
93 | focusTip = gFocus <~ use tip | 92 | focusTip = gFocus <~ use tip |
94 | blur = gFocus .= Nothing | 93 | blur = gFocus .= Nothing |
95 | 94 | ||
95 | -- Manual focus | ||
96 | setFocus :: Completable EntityIdentifier -> Sh GameState () | 96 | setFocus :: Completable EntityIdentifier -> Sh GameState () |
97 | setFocus = withArg $ \ident -> gFocus .= Just ident | 97 | setFocus = withArg $ \ident -> gFocus .= Just ident |
98 | 98 | ||
99 | -- Drop information | ||
99 | remove :: Sh GameState () | 100 | remove :: Sh GameState () |
100 | remove = withFocus $ \ident -> do | 101 | remove = withFocus $ \ident -> do |
101 | name <- toName ident | 102 | name <- toName ident |