Allow for ingame terminal input

This commit is contained in:
2022-06-01 15:42:30 +01:00
parent 2cedc1b968
commit 61722e55e8
6 changed files with 45 additions and 36 deletions
+6 -4
View File
@@ -14,10 +14,12 @@ import qualified Data.Set as S
import Data.Maybe
{- | The AI equivalent for your control. -}
yourControl :: Creature -> World -> World
yourControl cr w = w
& creatures . ix (_crID cr) %~
(wasdWithAiming w (_mvSpeed $ _crMvType cr) . mouseActionsCr (_mouseButtons w))
& updateUsingInput
yourControl cr w = case w ^? hud . hudElement . subInventory . termParams . termInput . _Just of
Just _ -> w
_ -> w
& creatures . ix (_crID cr) %~
(wasdWithAiming w (_mvSpeed $ _crMvType cr) . mouseActionsCr (_mouseButtons w))
& updateUsingInput
-- note the order of operation, setting the posture first--this prevents the twist fire bug
{- | Turn key presses into creature movement. -}