Data-ify creature drawing (partially)
This commit is contained in:
@@ -10,7 +10,6 @@ import Dodge.Creature.ChaseCrit
|
||||
--import Dodge.Creature.ChainUpdates
|
||||
import Dodge.Creature.ReaderUpdate
|
||||
import Dodge.Creature.Perception
|
||||
import Dodge.Creature.Picture
|
||||
--import Dodge.Creature.Impulse
|
||||
import Dodge.Creature.Action
|
||||
import Dodge.Item.Equipment
|
||||
@@ -36,7 +35,6 @@ flockArmourChaseCrit = defaultCreature
|
||||
]
|
||||
, _crName = "armourChaseCrit"
|
||||
, _crHP = 300
|
||||
, _crPict = basicCrPict
|
||||
, _crInv = IM.fromList
|
||||
[(0,frontArmour)
|
||||
,(1,medkit 200)
|
||||
|
||||
@@ -3,7 +3,6 @@ module Dodge.Creature.AutoCrit
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Creature.Update
|
||||
import Dodge.Creature.SentinelAI
|
||||
--import Dodge.Creature.ChooseTarget
|
||||
@@ -22,11 +21,10 @@ import Control.Lens
|
||||
|
||||
autoCrit :: Creature
|
||||
autoCrit = defaultCreature
|
||||
{ _crPict = basicCrPict
|
||||
, _crUpdate = defaultImpulsive [sentinelAI]
|
||||
{ _crUpdate = defaultImpulsive [sentinelAI]
|
||||
, _crInv = IM.fromList [(0,autoGun),(1,medkit 100)]
|
||||
, _crRad = 10
|
||||
, _crHP = 300
|
||||
, _crMvType = defaultAimMvType
|
||||
}
|
||||
& crSkin . skinUpper .~ light4 red
|
||||
& crType . skinUpper .~ light4 red
|
||||
|
||||
@@ -26,7 +26,6 @@ smallChaseCrit :: Creature
|
||||
smallChaseCrit = chaseCrit
|
||||
{ _crHP = 1
|
||||
, _crRad = 4
|
||||
, _crPict = basicCrPict
|
||||
, _crInv = IM.fromList [(0,medkit 200)]
|
||||
, _crCorpse = basicCrCorpse
|
||||
}
|
||||
@@ -52,7 +51,6 @@ chaseCrit = defaultCreature
|
||||
]
|
||||
, _crName = "chaseCrit"
|
||||
, _crHP = 150
|
||||
, _crPict = basicCrPict
|
||||
, _crInv = IM.fromList [(0,medkit 200)]
|
||||
, _crMeleeCooldown = 0
|
||||
, _crFaction = ColorFaction green
|
||||
|
||||
@@ -31,7 +31,7 @@ barrel :: Creature
|
||||
barrel = defaultInanimate
|
||||
{ _crUpdate = updateBarrel
|
||||
, _crHP = 500
|
||||
, _crPict = picAtCrPos $ setDepth 20 $ pictures
|
||||
, _crType = DrawnCreature $ picAtCrPos $ setDepth 20 $ pictures
|
||||
[ color orange $ circleSolid 10
|
||||
, setDepth 0.049 . color (greyN 0.5) $ circleSolid 8
|
||||
, color (greyN 0.5) $ circleSolid 8
|
||||
@@ -46,7 +46,7 @@ explosiveBarrel :: Creature
|
||||
explosiveBarrel = defaultInanimate
|
||||
{ _crUpdate = updateExpBarrel
|
||||
, _crHP = 400
|
||||
, _crPict = shapeAtCrPos
|
||||
, _crType = DrawnCreature $ shapeAtCrPos
|
||||
. colorSH orange
|
||||
. upperPrismPoly 20
|
||||
$ polyCirc 4 10
|
||||
|
||||
@@ -25,19 +25,14 @@ colorLamp
|
||||
colorLamp col h = defaultInanimate
|
||||
{ _crUpdate = initialiseColorLamp col h
|
||||
, _crHP = 100
|
||||
, _crPict = picAtCrPosNoRot (lampCrPic h)
|
||||
, _crType = DrawnCreature $ picAtCrPosNoRot (lampCrPic h)
|
||||
, _crRad = 3
|
||||
, _crMass = 3
|
||||
}
|
||||
|
||||
lamp :: Float -> Creature
|
||||
lamp h = defaultInanimate
|
||||
{ _crUpdate = initialiseLamp h
|
||||
, _crHP = 100
|
||||
, _crPict = picAtCrPosNoRot (lampCrPic h)
|
||||
, _crRad = 3
|
||||
, _crMass = 3
|
||||
}
|
||||
lamp = colorLamp 0.75
|
||||
|
||||
lampCrPic :: Float -> Picture
|
||||
lampCrPic h = pictures
|
||||
[ setLayer BloomLayer (setDepth h . color white $ circleSolid 3)
|
||||
@@ -46,9 +41,6 @@ lampCrPic h = pictures
|
||||
where
|
||||
f pos = Verx (pos -.-.- V3 2.5 2.5 0) blue [] BottomLayer polyNum
|
||||
|
||||
initialiseLamp :: Float -> Creature -> World -> World
|
||||
initialiseLamp = initialiseColorLamp 0.75
|
||||
|
||||
initialiseColorLamp :: Point3 -> Float -> Creature -> World -> World
|
||||
initialiseColorLamp col h cr w = w
|
||||
& lightSources . at lsid ?~ lsColPosID col (addZ h $ _crPos cr) lsid
|
||||
|
||||
@@ -4,7 +4,6 @@ module Dodge.Creature.LauncherCrit
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.Picture
|
||||
--import Dodge.Creature.ChainUpdates
|
||||
import Dodge.Creature.Test
|
||||
import Dodge.Creature.Volition
|
||||
@@ -24,8 +23,7 @@ import Control.Lens
|
||||
|
||||
launcherCrit :: Creature
|
||||
launcherCrit = defaultCreature
|
||||
{ _crPict = basicCrPict
|
||||
, _crUpdate = defaultImpulsive
|
||||
{ _crUpdate = defaultImpulsive
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0) [retreatFire])
|
||||
@@ -44,7 +42,7 @@ launcherCrit = defaultCreature
|
||||
, _crState = defaultState
|
||||
, _crHP = 300
|
||||
}
|
||||
& crSkin . skinUpper .~ light4 red
|
||||
& crType . skinUpper .~ light4 red
|
||||
|
||||
retreatFire :: Action
|
||||
retreatFire = ImpulsesList ( [ UseItem ] : replicate 20 [ Turn 0.16 ])
|
||||
|
||||
@@ -3,7 +3,6 @@ module Dodge.Creature.LtAutoCrit
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Creature.Update
|
||||
import Dodge.Creature.Action
|
||||
import Dodge.Creature.Test
|
||||
@@ -22,8 +21,7 @@ import Control.Lens
|
||||
|
||||
ltAutoCrit :: Creature
|
||||
ltAutoCrit = defaultCreature
|
||||
{ _crPict = basicCrPict
|
||||
, _crUpdate = defaultImpulsive
|
||||
{ _crUpdate = defaultImpulsive
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
||||
@@ -47,7 +45,7 @@ ltAutoCrit = defaultCreature
|
||||
, _crRad = 10
|
||||
, _crHP = 500
|
||||
}
|
||||
& crSkin . skinUpper .~ light4 red
|
||||
& crType . skinUpper .~ light4 red
|
||||
|
||||
chooseMovement :: Creature -> World -> Action
|
||||
chooseMovement cr w
|
||||
|
||||
@@ -47,7 +47,7 @@ basicCrShape cr
|
||||
, rotmdir $ colorSH (_skinLower cskin) $ feet cr
|
||||
]
|
||||
where
|
||||
cskin = _crSkin cr
|
||||
cskin = _crType cr
|
||||
crsize = 0.1 * _crRad cr
|
||||
tr = uncurryV translateSHf (_crPos cr)
|
||||
rotdir = rotateSH (_crDir cr)
|
||||
@@ -235,7 +235,7 @@ basicCrCorpse cr cp = noPic . tr . scaleSH (V3 crsize crsize crsize) $ mconcat
|
||||
, rotdir . rotmdir $ colorSH (_skinLower cskin) $ deadFeet cr
|
||||
]
|
||||
where
|
||||
cskin = _crSkin cr
|
||||
cskin = _crType cr -- this should be fixed
|
||||
crsize = 0.1 * _crRad cr
|
||||
tr = uncurryV translateSHf (_cpPos cp)
|
||||
rotdir = rotateSH (_cpDir cp)
|
||||
|
||||
@@ -3,7 +3,6 @@ module Dodge.Creature.PistolCrit
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Creature.Update
|
||||
import Dodge.Creature.Test
|
||||
import Dodge.Creature.Action
|
||||
@@ -24,8 +23,7 @@ import Control.Lens
|
||||
|
||||
pistolCrit :: Creature
|
||||
pistolCrit = defaultCreature
|
||||
{ _crPict = basicCrPict
|
||||
, _crUpdate = defaultImpulsive
|
||||
{ _crUpdate = defaultImpulsive
|
||||
[ performActions
|
||||
, watchUpdateStrat
|
||||
[ (crHasTargetLOS, \w cr -> StrategyActions (ShootAt 0)
|
||||
@@ -44,7 +42,7 @@ pistolCrit = defaultCreature
|
||||
, _crRad = 10
|
||||
, _crHP = 500
|
||||
}
|
||||
& crSkin . skinUpper .~ light4 red
|
||||
& crType . skinUpper .~ light4 red
|
||||
chooseMovement :: Creature -> World -> Action
|
||||
chooseMovement cr w = chooseMovement' cr w
|
||||
`DoActionThen`
|
||||
|
||||
@@ -3,7 +3,6 @@ module Dodge.Creature.SpreadGunCrit
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Creature.Update
|
||||
import Dodge.Creature.Test
|
||||
import Dodge.Creature.Action
|
||||
@@ -24,8 +23,7 @@ import Control.Lens
|
||||
|
||||
spreadGunCrit :: Creature
|
||||
spreadGunCrit = defaultCreature
|
||||
{ _crPict = basicCrPict
|
||||
, _crUpdate = defaultImpulsive
|
||||
{ _crUpdate = defaultImpulsive
|
||||
[performActions
|
||||
,watchUpdateStrat
|
||||
[ (crHasTargetLOS, \_ _ -> StrategyActions (ShootAt 0)
|
||||
@@ -49,7 +47,7 @@ spreadGunCrit = defaultCreature
|
||||
, _crRad = 10
|
||||
, _crHP = 500
|
||||
}
|
||||
& crSkin . skinUpper .~ light4 red
|
||||
& crType . skinUpper .~ light4 red
|
||||
|
||||
chooseMovement :: Creature -> World -> Action
|
||||
chooseMovement cr w
|
||||
|
||||
@@ -80,7 +80,7 @@ checkDeath cr w
|
||||
where
|
||||
removecr
|
||||
| _crID cr == 0 = (creatures . ix (_crID cr) . crUpdate .~ const id)
|
||||
. (creatures . ix (_crID cr) . crPict .~ const mempty)
|
||||
. (creatures . ix (_crID cr) . crType .~ DrawnCreature (const mempty))
|
||||
. (creatures . ix (_crID cr) . crHP .~ 0)
|
||||
-- hack to get around player creature being killed but left with more than 0 hp
|
||||
| otherwise = creatures . at (_crID cr) .~ Nothing
|
||||
|
||||
@@ -30,12 +30,11 @@ swarmCrit = defaultCreature
|
||||
, _crHP = 1
|
||||
, _crRad = 2
|
||||
, _crMass = 2
|
||||
, _crPict = basicCrPict
|
||||
, _crCorpse = basicCrCorpse
|
||||
, _crFaction = ColorFaction yellow
|
||||
, _crMeleeCooldown = 0
|
||||
}
|
||||
& crSkin . skinUpper .~ light4 yellow
|
||||
& crType . skinUpper .~ light4 yellow
|
||||
|
||||
--swarmCritMoveFunc :: Creature -> Point2 -> Creature -> Point2
|
||||
--swarmCritMoveFunc tcr cenp cr
|
||||
|
||||
Reference in New Issue
Block a user