This commit is contained in:
2022-07-16 18:07:43 +01:00
parent 11732358ed
commit 22adcb89e0
7 changed files with 31 additions and 34 deletions
+7 -7
View File
@@ -2,29 +2,29 @@ module Dodge.Creature.YourControl
( yourControl
) where
import Dodge.Data
import Dodge.LightSource
import Dodge.Base.Coordinate
import Dodge.Creature.Impulse.Movement
import Dodge.Creature.Test
import Dodge.Update.UsingInput
import Dodge.InputFocus
--import Dodge.Config.KeyConfig
import Geometry
import LensHelp
import Control.Lens
import qualified SDL
--import qualified Data.Set as S
import qualified Data.Map.Strict as M
--import qualified Data.IntMap.Strict as IM
--import Data.Maybe
{- | The AI equivalent for your control. -}
yourControl :: Creature -> World -> World
yourControl cr w
| inTermFocus w = w & updateUsingInput
| otherwise = w
| inTermFocus w = dimCreatureLight cr w & updateUsingInput
| otherwise = dimCreatureLight cr w
& creatures . ix (_crID cr) %~
(wasdWithAiming w (_mvSpeed $ _crMvType cr) . mouseActionsCr (_mouseButtons w))
& updateUsingInput
dimCreatureLight :: Creature -> World -> World
dimCreatureLight cr = tempLightSources .:~ tlsTimeRadColPos 1 300 0.1 (addZ 100 $ _crPos cr)
-- note the order of operation, setting the posture first--this prevents the twist fire bug
{- | Turn key presses into creature movement. -}