Move towards a simplified creature update
This commit is contained in:
@@ -11,7 +11,7 @@ module Dodge.Creature
|
|||||||
, smallChaseCrit
|
, smallChaseCrit
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
--import Dodge.Creature.Stance.Data
|
import Dodge.RemoveCreatureEndo
|
||||||
import Dodge.Creature.State.Data
|
import Dodge.Creature.State.Data
|
||||||
--import Dodge.Item.Weapon.Grenade
|
--import Dodge.Item.Weapon.Grenade
|
||||||
import Dodge.Item.Weapon.Booster
|
import Dodge.Item.Weapon.Booster
|
||||||
@@ -70,7 +70,7 @@ spawnerCrit = defaultCreature
|
|||||||
miniGunCrit :: Creature
|
miniGunCrit :: Creature
|
||||||
miniGunCrit = defaultCreature
|
miniGunCrit = defaultCreature
|
||||||
{ _crPict = basicCrPict red
|
{ _crPict = basicCrPict red
|
||||||
, _crUpdate = stateUpdate $ impulsiveAIR $
|
, _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $
|
||||||
sentinelFireType (const shootTillEmpty)
|
sentinelFireType (const shootTillEmpty)
|
||||||
, _crActionPlan = ActionPlan
|
, _crActionPlan = ActionPlan
|
||||||
{ _crImpulse = []
|
{ _crImpulse = []
|
||||||
@@ -89,7 +89,7 @@ longCrit :: Creature
|
|||||||
longCrit = defaultCreature
|
longCrit = defaultCreature
|
||||||
{ _crPict = basicCrPict red
|
{ _crPict = basicCrPict red
|
||||||
-- , _crUpdate = stateUpdate sniperAI
|
-- , _crUpdate = stateUpdate sniperAI
|
||||||
, _crUpdate = stateUpdate $ impulsiveAIR $ sentinelFireType $ const shootTillEmpty
|
, _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $ sentinelFireType $ const shootTillEmpty
|
||||||
, _crActionPlan = ActionPlan
|
, _crActionPlan = ActionPlan
|
||||||
{ _crImpulse = []
|
{ _crImpulse = []
|
||||||
, _crAction = []
|
, _crAction = []
|
||||||
@@ -109,7 +109,7 @@ multGunCrit = defaultCreature
|
|||||||
, _crInvSel = 0
|
, _crInvSel = 0
|
||||||
, _crRad = 10
|
, _crRad = 10
|
||||||
, _crHP = 300
|
, _crHP = 300
|
||||||
, _crUpdate = stateUpdate $ impulsiveAIR $ sentinelExtraWatchUpdate
|
, _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $ sentinelExtraWatchUpdate
|
||||||
[ ( not . crHasAmmo
|
[ ( not . crHasAmmo
|
||||||
, \_ _ -> StrategyActions Reload reloadActions
|
, \_ _ -> StrategyActions Reload reloadActions
|
||||||
)
|
)
|
||||||
@@ -150,7 +150,7 @@ startCr = defaultCreature
|
|||||||
, _crMvDir = pi/2
|
, _crMvDir = pi/2
|
||||||
, _crID = 0
|
, _crID = 0
|
||||||
, _crPict = basicCrPict black
|
, _crPict = basicCrPict black
|
||||||
, _crUpdate = stateUpdate yourControl
|
, _crUpdate = toCrUpdate $ stateUpdate yourControl
|
||||||
, _crRad = 10
|
, _crRad = 10
|
||||||
, _crMass = 10
|
, _crMass = 10
|
||||||
, _crHP = 1000
|
, _crHP = 1000
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
module Dodge.Creature.ArmourChase
|
module Dodge.Creature.ArmourChase
|
||||||
( armourChaseCrit
|
( armourChaseCrit
|
||||||
)
|
) where
|
||||||
where
|
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.RemoveCreatureEndo
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.Creature.State
|
import Dodge.Creature.State
|
||||||
import Dodge.Creature.ReaderUpdate
|
import Dodge.Creature.ReaderUpdate
|
||||||
@@ -20,7 +20,7 @@ import Control.Monad.Reader
|
|||||||
|
|
||||||
armourChaseCrit :: Creature
|
armourChaseCrit :: Creature
|
||||||
armourChaseCrit = defaultCreature
|
armourChaseCrit = defaultCreature
|
||||||
{ _crUpdate = stateUpdate $ impulsiveAIR $
|
{ _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $
|
||||||
watchUpdateStratR [] >=>
|
watchUpdateStratR [] >=>
|
||||||
doStrategyActionsR >=>
|
doStrategyActionsR >=>
|
||||||
performActionsR >=>
|
performActionsR >=>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ module Dodge.Creature.AutoCrit
|
|||||||
( autoCrit
|
( autoCrit
|
||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.RemoveCreatureEndo
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.Creature.Picture
|
import Dodge.Creature.Picture
|
||||||
import Dodge.Creature.SentinelAI
|
import Dodge.Creature.SentinelAI
|
||||||
@@ -21,7 +22,7 @@ import qualified Data.IntMap.Strict as IM
|
|||||||
autoCrit :: Creature
|
autoCrit :: Creature
|
||||||
autoCrit = defaultCreature
|
autoCrit = defaultCreature
|
||||||
{ _crPict = basicCrPict red
|
{ _crPict = basicCrPict red
|
||||||
, _crUpdate = stateUpdate $ impulsiveAIR sentinelAI
|
, _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR sentinelAI
|
||||||
, _crActionPlan = ActionPlan
|
, _crActionPlan = ActionPlan
|
||||||
{ _crImpulse = []
|
{ _crImpulse = []
|
||||||
, _crAction = []
|
, _crAction = []
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ module Dodge.Creature.ChaseCrit
|
|||||||
,chaseCrit
|
,chaseCrit
|
||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.RemoveCreatureEndo
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.Creature.Picture
|
import Dodge.Creature.Picture
|
||||||
import Dodge.Creature.ReaderUpdate
|
import Dodge.Creature.ReaderUpdate
|
||||||
@@ -33,7 +34,7 @@ smallChaseCrit = chaseCrit
|
|||||||
}
|
}
|
||||||
chaseCrit :: Creature
|
chaseCrit :: Creature
|
||||||
chaseCrit = defaultCreature
|
chaseCrit = defaultCreature
|
||||||
{ _crUpdate = stateUpdate $ --dummyUpdate
|
{ _crUpdate = toCrUpdate $ stateUpdate $ --dummyUpdate
|
||||||
impulsiveAIR $
|
impulsiveAIR $
|
||||||
doStrategyActionsR >=>
|
doStrategyActionsR >=>
|
||||||
performActionsR >=>
|
performActionsR >=>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ module Dodge.Creature.Inanimate
|
|||||||
, explosiveBarrel
|
, explosiveBarrel
|
||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.RemoveCreatureEndo
|
||||||
import Dodge.WorldEvent.Explosion
|
import Dodge.WorldEvent.Explosion
|
||||||
import Dodge.Creature.Picture
|
import Dodge.Creature.Picture
|
||||||
--import Dodge.Creature.Stance.Data
|
--import Dodge.Creature.Stance.Data
|
||||||
@@ -42,7 +43,7 @@ colorLamp
|
|||||||
-> Float -- height of lamp
|
-> Float -- height of lamp
|
||||||
-> Creature
|
-> Creature
|
||||||
colorLamp col h = defaultInanimate
|
colorLamp col h = defaultInanimate
|
||||||
{ _crUpdate = initialiseColorLamp col h
|
{ _crUpdate = toCrUpdate $ initialiseColorLamp col h
|
||||||
, _crHP = 100
|
, _crHP = 100
|
||||||
, _crPict = picAtCrPosNoRot (lampCrPic h)
|
, _crPict = picAtCrPosNoRot (lampCrPic h)
|
||||||
, _crRad = 3
|
, _crRad = 3
|
||||||
@@ -51,7 +52,7 @@ colorLamp col h = defaultInanimate
|
|||||||
|
|
||||||
lamp :: Float -> Creature
|
lamp :: Float -> Creature
|
||||||
lamp h = defaultInanimate
|
lamp h = defaultInanimate
|
||||||
{ _crUpdate = initialiseLamp h
|
{ _crUpdate = toCrUpdate $ initialiseLamp h
|
||||||
, _crHP = 100
|
, _crHP = 100
|
||||||
, _crPict = picAtCrPosNoRot (lampCrPic h)
|
, _crPict = picAtCrPosNoRot (lampCrPic h)
|
||||||
, _crRad = 3
|
, _crRad = 3
|
||||||
@@ -83,12 +84,12 @@ initialiseLamp :: Float -> CRUpdate
|
|||||||
initialiseLamp = initialiseColorLamp 0.75
|
initialiseLamp = initialiseColorLamp 0.75
|
||||||
|
|
||||||
initialiseColorLamp :: Point3 -> Float -> CRUpdate
|
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
|
where
|
||||||
i = _crID cr
|
i = _crID cr
|
||||||
addLS w = w
|
addLS w = w
|
||||||
& lightSources %~ IM.insert lsid (lsColPosID col (V3 x y h) lsid)
|
& 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
|
where
|
||||||
lsid = IM.newKey $ _lightSources w
|
lsid = IM.newKey $ _lightSources w
|
||||||
(V2 x y) = _crPos cr
|
(V2 x y) = _crPos cr
|
||||||
@@ -109,7 +110,7 @@ updateLamp h i = unrandUpdate handleLS internalUpdate
|
|||||||
|
|
||||||
barrel :: Creature
|
barrel :: Creature
|
||||||
barrel = defaultInanimate
|
barrel = defaultInanimate
|
||||||
{ _crUpdate = updateBarrel
|
{ _crUpdate = toCrUpdate updateBarrel
|
||||||
, _crHP = 500
|
, _crHP = 500
|
||||||
, _crPict = picAtCrPos $ onLayer CrLayer $ pictures
|
, _crPict = picAtCrPos $ onLayer CrLayer $ pictures
|
||||||
[ color orange $ circleSolid 10
|
[ color orange $ circleSolid 10
|
||||||
@@ -124,7 +125,7 @@ barrel = defaultInanimate
|
|||||||
|
|
||||||
explosiveBarrel :: Creature
|
explosiveBarrel :: Creature
|
||||||
explosiveBarrel = defaultInanimate
|
explosiveBarrel = defaultInanimate
|
||||||
{ _crUpdate = updateExpBarrel
|
{ _crUpdate = toCrUpdate updateExpBarrel
|
||||||
, _crHP = 400
|
, _crHP = 400
|
||||||
, _crPict = shapeAtCrPos
|
, _crPict = shapeAtCrPos
|
||||||
. colorSH orange
|
. colorSH orange
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ module Dodge.Creature.LauncherCrit
|
|||||||
)
|
)
|
||||||
where
|
where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.RemoveCreatureEndo
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.Creature.Picture
|
import Dodge.Creature.Picture
|
||||||
import Dodge.Creature.Test
|
import Dodge.Creature.Test
|
||||||
@@ -24,7 +25,7 @@ import Control.Monad.Reader
|
|||||||
launcherCrit :: Creature
|
launcherCrit :: Creature
|
||||||
launcherCrit = defaultCreature
|
launcherCrit = defaultCreature
|
||||||
{ _crPict = basicCrPict red
|
{ _crPict = basicCrPict red
|
||||||
, _crUpdate = stateUpdate $ impulsiveAIR $
|
, _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $
|
||||||
performActionsR
|
performActionsR
|
||||||
>=> watchUpdateStratR
|
>=> watchUpdateStratR
|
||||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0) [retreatFire])
|
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0) [retreatFire])
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ module Dodge.Creature.LtAutoCrit
|
|||||||
( ltAutoCrit
|
( ltAutoCrit
|
||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.RemoveCreatureEndo
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.Creature.Picture
|
import Dodge.Creature.Picture
|
||||||
import Dodge.Creature.Impulse
|
import Dodge.Creature.Impulse
|
||||||
@@ -29,7 +30,7 @@ import Control.Monad.Reader
|
|||||||
ltAutoCrit :: Creature
|
ltAutoCrit :: Creature
|
||||||
ltAutoCrit = defaultCreature
|
ltAutoCrit = defaultCreature
|
||||||
{ _crPict = basicCrPict red
|
{ _crPict = basicCrPict red
|
||||||
, _crUpdate = stateUpdate $ impulsiveAIR $
|
, _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $
|
||||||
performActionsR
|
performActionsR
|
||||||
>=> watchUpdateStratR
|
>=> watchUpdateStratR
|
||||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ module Dodge.Creature.PistolCrit
|
|||||||
( pistolCrit
|
( pistolCrit
|
||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.RemoveCreatureEndo
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.Creature.Picture
|
import Dodge.Creature.Picture
|
||||||
import Dodge.Creature.Test
|
import Dodge.Creature.Test
|
||||||
@@ -29,7 +30,7 @@ import Control.Monad.State
|
|||||||
pistolCrit :: Creature
|
pistolCrit :: Creature
|
||||||
pistolCrit = defaultCreature
|
pistolCrit = defaultCreature
|
||||||
{ _crPict = basicCrPict red
|
{ _crPict = basicCrPict red
|
||||||
, _crUpdate = stateUpdate $ impulsiveAIR $
|
, _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $
|
||||||
performActionsR
|
performActionsR
|
||||||
>=> watchUpdateStratR
|
>=> watchUpdateStratR
|
||||||
[ (crHasTargetLOS, \w cr -> StrategyActions (ShootAt 0)
|
[ (crHasTargetLOS, \w cr -> StrategyActions (ShootAt 0)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ module Dodge.Creature.SpreadGunCrit
|
|||||||
( spreadGunCrit
|
( spreadGunCrit
|
||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.RemoveCreatureEndo
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.Creature.Picture
|
import Dodge.Creature.Picture
|
||||||
import Dodge.Creature.Test
|
import Dodge.Creature.Test
|
||||||
@@ -30,7 +31,7 @@ import Control.Monad
|
|||||||
spreadGunCrit :: Creature
|
spreadGunCrit :: Creature
|
||||||
spreadGunCrit = defaultCreature
|
spreadGunCrit = defaultCreature
|
||||||
{ _crPict = basicCrPict red
|
{ _crPict = basicCrPict red
|
||||||
, _crUpdate = stateUpdate $ impulsiveAIR $
|
, _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $
|
||||||
performActionsR
|
performActionsR
|
||||||
>=> watchUpdateStratR
|
>=> watchUpdateStratR
|
||||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ module Dodge.Creature.SwarmCrit
|
|||||||
)
|
)
|
||||||
where
|
where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.RemoveCreatureEndo
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.Creature.Picture
|
import Dodge.Creature.Picture
|
||||||
import Dodge.Creature.Boid
|
import Dodge.Creature.Boid
|
||||||
@@ -18,7 +19,7 @@ import Control.Monad.Reader
|
|||||||
|
|
||||||
swarmCrit :: Creature
|
swarmCrit :: Creature
|
||||||
swarmCrit = defaultCreature
|
swarmCrit = defaultCreature
|
||||||
{ _crUpdate = stateUpdate $ impulsiveAIR $
|
{ _crUpdate = toCrUpdate $ stateUpdate $ impulsiveAIR $
|
||||||
flockToPointUsing (encircleDistP 100) (meleeHeadingMove 0.1 0.1 (pi/4) 3.9)
|
flockToPointUsing (encircleDistP 100) (meleeHeadingMove 0.1 0.1 (pi/4) 3.9)
|
||||||
>=> return . (crMeleeCooldown %~ max 0 . subtract 1)
|
>=> return . (crMeleeCooldown %~ max 0 . subtract 1)
|
||||||
>=> perceptionUpdate [0]
|
>=> perceptionUpdate [0]
|
||||||
|
|||||||
+2
-1
@@ -229,7 +229,8 @@ data Creature = Creature
|
|||||||
, _crTwist :: Float
|
, _crTwist :: Float
|
||||||
, _crID :: Int
|
, _crID :: Int
|
||||||
, _crPict :: Creature -> Configuration -> World -> SPic
|
, _crPict :: Creature -> Configuration -> World -> SPic
|
||||||
, _crUpdate :: Creature -> World -> (Endo World, Maybe Creature)
|
--, _crUpdate :: Creature -> World -> (Endo World, Maybe Creature)
|
||||||
|
, _crUpdate :: Creature -> World -> World
|
||||||
, _crRad :: Float
|
, _crRad :: Float
|
||||||
, _crMass :: Float
|
, _crMass :: Float
|
||||||
, _crHP :: Int
|
, _crHP :: Int
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
module Dodge.Debug.Terminal
|
module Dodge.Debug.Terminal
|
||||||
where
|
where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
|
import Dodge.RemoveCreatureEndo
|
||||||
import Dodge.Creature
|
import Dodge.Creature
|
||||||
import Dodge.Creature.YourControl
|
import Dodge.Creature.YourControl
|
||||||
import Dodge.Creature.State
|
import Dodge.Creature.State
|
||||||
@@ -11,8 +12,8 @@ applyTerminalString :: String -> Universe -> Universe
|
|||||||
applyTerminalString "NOCLIP" w = w & config . debug_noclip %~ not
|
applyTerminalString "NOCLIP" w = w & config . debug_noclip %~ not
|
||||||
applyTerminalString "LOADME" w = w & uvWorld . creatures . ix 0 . crInv .~ stackedInventory
|
applyTerminalString "LOADME" w = w & uvWorld . creatures . ix 0 . crInv .~ stackedInventory
|
||||||
& uvWorld . creatures . ix 0 . crInvCapacity .~ 50
|
& uvWorld . creatures . ix 0 . crInvCapacity .~ 50
|
||||||
applyTerminalString "GODON" u = u & uvWorld . creatures . ix 0 . crUpdate .~ stateUpdateDamage clearDamage yourControl
|
applyTerminalString "GODON" u = u & uvWorld . creatures . ix 0 . crUpdate .~ toCrUpdate (stateUpdateDamage clearDamage yourControl)
|
||||||
applyTerminalString "GODOFF" u = u & uvWorld . creatures . ix 0 . crUpdate .~ stateUpdate yourControl
|
applyTerminalString "GODOFF" u = u & uvWorld . creatures . ix 0 . crUpdate .~ toCrUpdate (stateUpdate yourControl)
|
||||||
applyTerminalString "LOADTEST" w = w & uvWorld . creatures . ix 0 . crInv .~ testInventory
|
applyTerminalString "LOADTEST" w = w & uvWorld . creatures . ix 0 . crInv .~ testInventory
|
||||||
& uvWorld . creatures . ix 0 . crInvCapacity .~ 50
|
& uvWorld . creatures . ix 0 . crInvCapacity .~ 50
|
||||||
applyTerminalString "LM" w = applyTerminalString "LOADME" w
|
applyTerminalString "LM" w = applyTerminalString "LOADME" w
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import Control.Lens
|
|||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
import qualified Data.Vector as V
|
import qualified Data.Vector as V
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Monoid
|
--import Data.Monoid
|
||||||
defaultCreature :: Creature
|
defaultCreature :: Creature
|
||||||
defaultCreature = Creature
|
defaultCreature = Creature
|
||||||
{ _crPos = V2 0 0
|
{ _crPos = V2 0 0
|
||||||
@@ -31,7 +31,7 @@ defaultCreature = Creature
|
|||||||
, _crTwist = 0
|
, _crTwist = 0
|
||||||
, _crID = 1
|
, _crID = 1
|
||||||
, _crPict = \_ _ _ -> (,) mempty blank
|
, _crPict = \_ _ _ -> (,) mempty blank
|
||||||
, _crUpdate = \cr _ -> (Endo id , Just cr)
|
, _crUpdate = const id
|
||||||
, _crRad = 10
|
, _crRad = 10
|
||||||
, _crMass = 10
|
, _crMass = 10
|
||||||
, _crHP = 100
|
, _crHP = 100
|
||||||
|
|||||||
+14
-13
@@ -25,8 +25,8 @@ import qualified Data.IntMap.Strict as IM
|
|||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
--import qualified Data.Set as S
|
--import qualified Data.Set as S
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Data.Monoid
|
--import Data.Monoid
|
||||||
import System.Random
|
--import System.Random
|
||||||
|
|
||||||
{- For most menus the only way to change the world is using event handling. -}
|
{- For most menus the only way to change the world is using event handling. -}
|
||||||
updateUniverse :: Universe -> Universe
|
updateUniverse :: Universe -> Universe
|
||||||
@@ -65,7 +65,8 @@ functionalUpdate cfig w = checkEndGame
|
|||||||
. zoneClouds
|
. zoneClouds
|
||||||
. updateMIM magnets _mgUpdate
|
. updateMIM magnets _mgUpdate
|
||||||
. updateIMl _machines _mcUpdate
|
. updateIMl _machines _mcUpdate
|
||||||
. updateCreatures
|
. updateIMl _creatures _crUpdate
|
||||||
|
-- . updateCreatures
|
||||||
. updateCreatureGroups
|
. updateCreatureGroups
|
||||||
. updateBlocks
|
. updateBlocks
|
||||||
. updateSeenWalls
|
. updateSeenWalls
|
||||||
@@ -144,16 +145,16 @@ updateMIM :: ASetter' World (IM.IntMap a) -> (a -> a -> Maybe a) -> World -> Wor
|
|||||||
updateMIM f up w = w & f %~ IM.mapMaybe (dbArg up)
|
updateMIM f up w = w & f %~ IM.mapMaybe (dbArg up)
|
||||||
|
|
||||||
-- Note that this updates the randgen
|
-- Note that this updates the randgen
|
||||||
updateCreatures :: World -> World
|
--updateCreatures :: World -> World
|
||||||
updateCreatures w = appEndo f $ w
|
--updateCreatures w = appEndo f $ w
|
||||||
& creatures .~ IM.mapMaybe id m
|
-- & creatures .~ IM.mapMaybe id m
|
||||||
& randGen .~ newg
|
-- & randGen .~ newg
|
||||||
where
|
-- where
|
||||||
((f,newg),m) = mapAccumR crUp (Endo id,_randGen w) (_creatures w)
|
-- ((f,newg),m) = mapAccumR crUp (Endo id,_randGen w) (_creatures w)
|
||||||
crUp (f',g) cr = ((f' <> f'',g'), cr')
|
-- crUp (f',g) cr = ((f' <> f'',g'), cr')
|
||||||
where
|
-- where
|
||||||
(f'',cr') = _crUpdate cr cr (w & randGen .~ g)
|
-- (f'',cr') = _crUpdate cr cr (w & randGen .~ g)
|
||||||
(_,g') = genWord8 g
|
-- (_,g') = genWord8 g
|
||||||
|
|
||||||
ppEvents :: World -> World
|
ppEvents :: World -> World
|
||||||
ppEvents w = IM.foldl' (flip $ \pp -> _ppEvent pp pp) w $ _pressPlates w
|
ppEvents w = IM.foldl' (flip $ \pp -> _ppEvent pp pp) w $ _pressPlates w
|
||||||
|
|||||||
Reference in New Issue
Block a user