Hack solution, update random generator for each creature
This commit is contained in:
@@ -48,7 +48,8 @@ chaseCrit = defaultCreature
|
||||
, _crFaction = ColorFaction green
|
||||
, _crVocalization = Vocalization seagullChatterS
|
||||
[seagullBarkS
|
||||
,seagullChatterS,seagullWhistleS
|
||||
,seagullChatterS
|
||||
,seagullWhistleS
|
||||
,seagullWhistle1S
|
||||
,seagullCryS
|
||||
] 50 0
|
||||
|
||||
@@ -3,7 +3,14 @@ import Dodge.Data
|
||||
import Dodge.Creature.State
|
||||
import Dodge.Creature.Impulse
|
||||
import Dodge.Creature.ChainUpdates
|
||||
import LensHelp
|
||||
|
||||
import System.Random
|
||||
|
||||
-- bit of a hack to get new random generators after each creature's update
|
||||
defaultImpulsive :: [World -> Creature -> Creature]
|
||||
-> Creature -> World -> World
|
||||
defaultImpulsive = stateUpdate . impulsiveAIBefore . chainCreatureUpdates
|
||||
defaultImpulsive = fmap (fmap updateRandGen) . stateUpdate . impulsiveAIBefore . chainCreatureUpdates
|
||||
where
|
||||
updateRandGen w = let (_,g) = randomR (0,1::Int) (_randGen w)
|
||||
in w & randGen .~ g
|
||||
|
||||
Reference in New Issue
Block a user