Move towards a simplified creature update
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
module Dodge.Creature.ArmourChase
|
||||
( armourChaseCrit
|
||||
)
|
||||
where
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.RemoveCreatureEndo
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.State
|
||||
import Dodge.Creature.ReaderUpdate
|
||||
@@ -20,7 +20,7 @@ import Control.Monad.Reader
|
||||
|
||||
armourChaseCrit :: Creature
|
||||
armourChaseCrit = defaultCreature
|
||||
{ _crUpdate = stateUpdate $ impulsiveAIR $
|
||||
{ _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $
|
||||
watchUpdateStratR [] >=>
|
||||
doStrategyActionsR >=>
|
||||
performActionsR >=>
|
||||
|
||||
@@ -2,6 +2,7 @@ module Dodge.Creature.AutoCrit
|
||||
( autoCrit
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.RemoveCreatureEndo
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Creature.SentinelAI
|
||||
@@ -21,7 +22,7 @@ import qualified Data.IntMap.Strict as IM
|
||||
autoCrit :: Creature
|
||||
autoCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate $ impulsiveAIR sentinelAI
|
||||
, _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR sentinelAI
|
||||
, _crActionPlan = ActionPlan
|
||||
{ _crImpulse = []
|
||||
, _crAction = []
|
||||
|
||||
@@ -3,6 +3,7 @@ module Dodge.Creature.ChaseCrit
|
||||
,chaseCrit
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.RemoveCreatureEndo
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Creature.ReaderUpdate
|
||||
@@ -33,7 +34,7 @@ smallChaseCrit = chaseCrit
|
||||
}
|
||||
chaseCrit :: Creature
|
||||
chaseCrit = defaultCreature
|
||||
{ _crUpdate = stateUpdate $ --dummyUpdate
|
||||
{ _crUpdate = toCrUpdate $ stateUpdate $ --dummyUpdate
|
||||
impulsiveAIR $
|
||||
doStrategyActionsR >=>
|
||||
performActionsR >=>
|
||||
|
||||
@@ -9,6 +9,7 @@ module Dodge.Creature.Inanimate
|
||||
, explosiveBarrel
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.RemoveCreatureEndo
|
||||
import Dodge.WorldEvent.Explosion
|
||||
import Dodge.Creature.Picture
|
||||
--import Dodge.Creature.Stance.Data
|
||||
@@ -42,7 +43,7 @@ colorLamp
|
||||
-> Float -- height of lamp
|
||||
-> Creature
|
||||
colorLamp col h = defaultInanimate
|
||||
{ _crUpdate = initialiseColorLamp col h
|
||||
{ _crUpdate = toCrUpdate $ initialiseColorLamp col h
|
||||
, _crHP = 100
|
||||
, _crPict = picAtCrPosNoRot (lampCrPic h)
|
||||
, _crRad = 3
|
||||
@@ -51,7 +52,7 @@ colorLamp col h = defaultInanimate
|
||||
|
||||
lamp :: Float -> Creature
|
||||
lamp h = defaultInanimate
|
||||
{ _crUpdate = initialiseLamp h
|
||||
{ _crUpdate = toCrUpdate $ initialiseLamp h
|
||||
, _crHP = 100
|
||||
, _crPict = picAtCrPosNoRot (lampCrPic h)
|
||||
, _crRad = 3
|
||||
@@ -83,12 +84,12 @@ initialiseLamp :: Float -> CRUpdate
|
||||
initialiseLamp = initialiseColorLamp 0.75
|
||||
|
||||
initialiseColorLamp :: Point3 -> Float -> CRUpdate
|
||||
initialiseColorLamp col h cr _ = ( Endo addLS , Just $ cr & crUpdate .~ updateLamp h i)
|
||||
initialiseColorLamp col h cr _ = ( Endo addLS , Just $ cr & crUpdate .~ toCrUpdate (updateLamp h i))
|
||||
where
|
||||
i = _crID cr
|
||||
addLS w = w
|
||||
& lightSources %~ IM.insert lsid (lsColPosID col (V3 x y h) lsid)
|
||||
& creatures . ix i . crUpdate .~ updateLamp h lsid
|
||||
& creatures . ix i . crUpdate .~ toCrUpdate (updateLamp h lsid)
|
||||
where
|
||||
lsid = IM.newKey $ _lightSources w
|
||||
(V2 x y) = _crPos cr
|
||||
@@ -109,7 +110,7 @@ updateLamp h i = unrandUpdate handleLS internalUpdate
|
||||
|
||||
barrel :: Creature
|
||||
barrel = defaultInanimate
|
||||
{ _crUpdate = updateBarrel
|
||||
{ _crUpdate = toCrUpdate updateBarrel
|
||||
, _crHP = 500
|
||||
, _crPict = picAtCrPos $ onLayer CrLayer $ pictures
|
||||
[ color orange $ circleSolid 10
|
||||
@@ -124,7 +125,7 @@ barrel = defaultInanimate
|
||||
|
||||
explosiveBarrel :: Creature
|
||||
explosiveBarrel = defaultInanimate
|
||||
{ _crUpdate = updateExpBarrel
|
||||
{ _crUpdate = toCrUpdate updateExpBarrel
|
||||
, _crHP = 400
|
||||
, _crPict = shapeAtCrPos
|
||||
. colorSH orange
|
||||
|
||||
@@ -3,6 +3,7 @@ module Dodge.Creature.LauncherCrit
|
||||
)
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.RemoveCreatureEndo
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Creature.Test
|
||||
@@ -24,7 +25,7 @@ import Control.Monad.Reader
|
||||
launcherCrit :: Creature
|
||||
launcherCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate $ impulsiveAIR $
|
||||
, _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $
|
||||
performActionsR
|
||||
>=> watchUpdateStratR
|
||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0) [retreatFire])
|
||||
|
||||
@@ -2,6 +2,7 @@ module Dodge.Creature.LtAutoCrit
|
||||
( ltAutoCrit
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.RemoveCreatureEndo
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Creature.Impulse
|
||||
@@ -29,7 +30,7 @@ import Control.Monad.Reader
|
||||
ltAutoCrit :: Creature
|
||||
ltAutoCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate $ impulsiveAIR $
|
||||
, _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $
|
||||
performActionsR
|
||||
>=> watchUpdateStratR
|
||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
||||
|
||||
@@ -2,6 +2,7 @@ module Dodge.Creature.PistolCrit
|
||||
( pistolCrit
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.RemoveCreatureEndo
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Creature.Test
|
||||
@@ -29,7 +30,7 @@ import Control.Monad.State
|
||||
pistolCrit :: Creature
|
||||
pistolCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate $ impulsiveAIR $
|
||||
, _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $
|
||||
performActionsR
|
||||
>=> watchUpdateStratR
|
||||
[ (crHasTargetLOS, \w cr -> StrategyActions (ShootAt 0)
|
||||
|
||||
@@ -2,6 +2,7 @@ module Dodge.Creature.SpreadGunCrit
|
||||
( spreadGunCrit
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.RemoveCreatureEndo
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Creature.Test
|
||||
@@ -30,7 +31,7 @@ import Control.Monad
|
||||
spreadGunCrit :: Creature
|
||||
spreadGunCrit = defaultCreature
|
||||
{ _crPict = basicCrPict red
|
||||
, _crUpdate = stateUpdate $ impulsiveAIR $
|
||||
, _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $
|
||||
performActionsR
|
||||
>=> watchUpdateStratR
|
||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
||||
|
||||
@@ -3,6 +3,7 @@ module Dodge.Creature.SwarmCrit
|
||||
)
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.RemoveCreatureEndo
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Creature.Boid
|
||||
@@ -18,7 +19,7 @@ import Control.Monad.Reader
|
||||
|
||||
swarmCrit :: Creature
|
||||
swarmCrit = defaultCreature
|
||||
{ _crUpdate = stateUpdate $ impulsiveAIR $
|
||||
{ _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $
|
||||
flockToPointUsing (encircleDistP 100) (meleeHeadingMove 0.1 0.1 (pi/4) 3.9)
|
||||
>=> return . (crMeleeCooldown %~ max 0 . subtract 1)
|
||||
>=> perceptionUpdate [0]
|
||||
|
||||
Reference in New Issue
Block a user