diff options
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Main.hs b/src/Main.hs index 639673c..903da05 100644 --- a/src/Main.hs +++ b/src/Main.hs | |||
@@ -46,6 +46,7 @@ main = do | |||
46 | , cmd "factions" listFactions "List all inhabited factions" | 46 | , cmd "factions" listFactions "List all inhabited factions" |
47 | , cmd "members" listFaction "List all members of a faction" | 47 | , cmd "members" listFaction "List all members of a faction" |
48 | , cmd "entities" listEntities "List all entities" | 48 | , cmd "entities" listEntities "List all entities" |
49 | , cmd "align" alignEntity "Align an entity to a faction creating it, if necessary" | ||
49 | ] | 50 | ] |
50 | } | 51 | } |
51 | void $ runShell description haskelineBackend (def :: GameState) | 52 | void $ runShell description haskelineBackend (def :: GameState) |
@@ -68,10 +69,14 @@ stateOutline st | |||
68 | return . colsAllG top $ [show (seqVal' ^. seqVal)] : map factionColumn [0..(length factions - 1)] | 69 | return . colsAllG top $ [show (seqVal' ^. seqVal)] : map factionColumn [0..(length factions - 1)] |
69 | 70 | ||
70 | listFaction :: Completable Faction -> Sh GameState () | 71 | listFaction :: Completable Faction -> Sh GameState () |
71 | listFaction (Completable (flip (set faction') def -> qFaction)) = use gEntities >>= mapM_ (shellPutStrLn <=< toName) . Map.keys . Map.filter ((==) qFaction . view eFaction) | 72 | listFaction = withArg $ \qFaction -> use gEntities >>= mapM_ (shellPutStrLn <=< toName) . Map.keys . Map.filter ((==) qFaction . view eFaction) |
72 | 73 | ||
73 | listFactions :: Sh GameState () | 74 | listFactions :: Sh GameState () |
74 | listFactions = use inhabitedFactions >>= mapM_ (shellPutStrLn . view faction') | 75 | listFactions = use inhabitedFactions >>= mapM_ (shellPutStrLn . view faction') |
75 | 76 | ||
76 | listEntities :: Sh GameState () | 77 | listEntities :: Sh GameState () |
77 | listEntities = use (gEntities . to Map.keys) >>= mapM_ (shellPutStrLn <=< toName) | 78 | listEntities = use (gEntities . to Map.keys) >>= mapM_ (shellPutStrLn <=< toName) |
79 | |||
80 | alignEntity :: Completable EntityIdentifier -> Completable Faction -> Sh GameState () | ||
81 | alignEntity ident' nFaction' = flip withArg nFaction' $ \nFaction -> flip withArg ident' $ \ident -> do | ||
82 | gEntities %= Map.adjust (set eFaction nFaction) ident | ||