This commit is contained in:
2025-11-21 11:02:37 +00:00
parent 9c94e1b3f3
commit f9f4fc02ea
6 changed files with 101 additions and 112 deletions
-2
View File
@@ -10,7 +10,6 @@ module Dodge.Creature (
armourChaseCrit,
module Dodge.Creature.Action,
module Dodge.Creature.Boid,
module Dodge.Creature.ChainUpdates,
module Dodge.Creature.Impulse,
module Dodge.Creature.Perception,
module Dodge.Creature.ReaderUpdate,
@@ -31,7 +30,6 @@ import Dodge.Creature.Action
import Dodge.Creature.ArmourChase
import Dodge.Creature.AutoCrit
import Dodge.Creature.Boid
import Dodge.Creature.ChainUpdates
import Dodge.Creature.ChaseCrit
import Dodge.Creature.Impulse
import Dodge.Creature.Inanimate
-9
View File
@@ -1,9 +0,0 @@
module Dodge.Creature.ChainUpdates (chainCreatureUpdates) where
import Data.Foldable
import Dodge.Data.World
chainCreatureUpdates :: [World -> Creature -> Creature] -> World -> Creature -> Creature
chainCreatureUpdates ls w cr = foldl' unf cr ls
where
unf cr' g = g w cr'
+49 -47
View File
@@ -4,13 +4,13 @@ module Dodge.Creature.SentinelAI (
sentinelExtraWatchUpdate,
) where
import Control.Lens
--import Control.Lens
import Data.Maybe
--import Dodge.Creature.Action
import Dodge.Creature.ChainUpdates
import Dodge.Creature.Perception
import Dodge.Creature.ReaderUpdate
import Dodge.Creature.Strategy
--import Dodge.Creature.ChainUpdates
--import Dodge.Creature.Perception
--import Dodge.Creature.ReaderUpdate
--import Dodge.Creature.Strategy
import Dodge.Creature.Test
import Dodge.Creature.Volition
import Dodge.Data.CreatureEffect
@@ -47,54 +47,56 @@ sentinelAI =
--chainCreatureUpdates ls w cr = foldr (\f -> f w) cr ls
sentinelFireType :: (Int -> Action) -> World -> Creature -> Creature
sentinelFireType f =
chainCreatureUpdates
[ watchUpdateStrat
[
( crHasTargetLOS
, \_ _ ->
StrategyActions
(ShootAt 0)
[ drawwp `DoActionThen` f 0 `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]
, aiming
]
)
, (const crAwayFromPost, const goToPostStrat)
]
, perceptionUpdate [0]
, -- , Left $ perceptionUp 0
const doStrategyActions
, targetYouWhenCognizant
, const $
overrideInternal
(\cr -> crHasTarget cr && crStratConMatches (GetTo (V2 0 0)) cr)
(crActionPlan . apStrategy .~ WatchAndWait)
]
where
drawwp = DoActionIfElse NoAction (WdCrBlfromCrBl CrIsAiming) (DoActionThen drawWeapon (WaitThen 50 NoAction))
aiming =
AimAt
{ _targetID = 0
, _targetSeenAt = V2 0 0 -- hack
}
sentinelFireType _ = undefined
--sentinelFireType f =
-- chainCreatureUpdates
-- [ watchUpdateStrat
-- [
-- ( crHasTargetLOS
-- , \_ _ ->
-- StrategyActions
-- (ShootAt 0)
-- [ drawwp `DoActionThen` f 0 `DoActionThen` DoImpulses [ChangeStrategy WatchAndWait]
-- , aiming
-- ]
-- )
-- , (const crAwayFromPost, const goToPostStrat)
-- ]
-- , perceptionUpdate [0]
-- , -- , Left $ perceptionUp 0
-- const doStrategyActions
-- , targetYouWhenCognizant
-- , const $
-- overrideInternal
-- (\cr -> crHasTarget cr && crStratConMatches (GetTo (V2 0 0)) cr)
-- (crActionPlan . apStrategy .~ WatchAndWait)
-- ]
-- where
-- drawwp = DoActionIfElse NoAction (WdCrBlfromCrBl CrIsAiming) (DoActionThen drawWeapon (WaitThen 50 NoAction))
-- aiming =
-- AimAt
-- { _targetID = 0
-- , _targetSeenAt = V2 0 0 -- hack
-- }
sentinelExtraWatchUpdate ::
[(World -> Creature -> Bool, World -> Creature -> Strategy)] ->
World ->
Creature ->
Creature
sentinelExtraWatchUpdate xs =
chainCreatureUpdates
[ watchUpdateStrat
(xs ++ [(const crAwayFromPost, const goToPostStrat)])
, perceptionUpdate [0]
, const doStrategyActions
, targetYouWhenCognizant
, const $
overrideInternal
(\cr -> crHasTarget cr && crStratConMatches (GetTo (V2 0 0)) cr)
(crActionPlan . apStrategy .~ WatchAndWait)
]
sentinelExtraWatchUpdate _ = undefined
--sentinelExtraWatchUpdate xs =
-- chainCreatureUpdates
-- [ watchUpdateStrat
-- (xs ++ [(const crAwayFromPost, const goToPostStrat)])
-- , perceptionUpdate [0]
-- , const doStrategyActions
-- , targetYouWhenCognizant
-- , const $
-- overrideInternal
-- (\cr -> crHasTarget cr && crStratConMatches (GetTo (V2 0 0)) cr)
-- (crActionPlan . apStrategy .~ WatchAndWait)
-- ]
--shootAtAdvance :: Int -> [Action]
--shootAtAdvance tcid =
+5 -2
View File
@@ -1,12 +1,15 @@
module Dodge.Humanoid (chaseCritInternal) where
import Data.Foldable
import Dodge.Creature
import Dodge.Data.World
import LensHelp
chaseCritInternal :: World -> Creature -> Creature
chaseCritInternal =
chainCreatureUpdates
chaseCritInternal w cr =
foldl'
(\c f -> f w c)
cr
[ const doStrategyActions
, overrideMeleeCloseTarget
, setViewPos
-1
View File
@@ -202,7 +202,6 @@ doDrawing' win pdata u = do
glDrawArrays GL_TRIANGLES 0 (fromIntegral nCloudVs * 6)
--setup downscale viewport for blurring bloom
--setViewportSize (round winx `div` (2 * resFact)) (round winy `div` (2 * resFact))
setViewport _gr_downsize_res cfig
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboHalf1 pdata)))
glDepthFunc GL_ALWAYS