Use a creature to "use" the weapon of a turret
This commit is contained in:
@@ -2,6 +2,7 @@ module Dodge.Creature.Impulse
|
||||
( impulsiveAIR
|
||||
-- , impulsiveAI
|
||||
, impulsiveAI
|
||||
, followImpulses
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Creature.Vocalization
|
||||
|
||||
@@ -4,6 +4,7 @@ Drawing of creatures.
|
||||
Takes into account damage etc. -}
|
||||
module Dodge.Creature.Picture
|
||||
( basicCrPict
|
||||
, drawCrEquipment
|
||||
, circLine
|
||||
, picAtCrPos
|
||||
, shapeAtCrPos
|
||||
@@ -24,22 +25,27 @@ import ShapePicture
|
||||
import Control.Lens
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import qualified Data.Vector as V
|
||||
basicCrPict
|
||||
:: Color -- ^ Creature color
|
||||
basicCrPict :: Color -- ^ Creature color
|
||||
-> Creature
|
||||
-> Configuration
|
||||
-> World
|
||||
-> SPic
|
||||
basicCrPict col cr cfig w = (,) (basicCrShape col cr) $ pictures $
|
||||
targetingPic ++
|
||||
[ creatureDisplayText cfig w cr
|
||||
, tr . rotdir $ _spPicture $ drawEquipment cr
|
||||
]
|
||||
basicCrPict col cr cfig w =
|
||||
drawCrEquipment cr
|
||||
<>
|
||||
(basicCrShape col cr
|
||||
, pictures $
|
||||
targetingPic ++
|
||||
[ creatureDisplayText cfig w cr
|
||||
--, tr . rotdir $ _spPicture $ drawEquipment cr
|
||||
]
|
||||
)
|
||||
where
|
||||
targetingPic = IM.elems $ IM.mapMaybeWithKey f $ _crInv cr
|
||||
f invid it = fmap ((\g -> g invid it cr w) . snd) (it ^? itTargeting . _Just)
|
||||
tr = uncurryV translate (_crPos cr)
|
||||
rotdir = rotate (_crDir cr)
|
||||
|
||||
drawCrEquipment :: Creature -> SPic
|
||||
drawCrEquipment cr = uncurryV translateSPf (_crPos cr) (rotateSP (_crDir cr) $ drawEquipment cr)
|
||||
|
||||
shapeAtCrPos :: Shape -> Creature -> Configuration -> World -> SPic
|
||||
shapeAtCrPos sh cr _ _ =
|
||||
@@ -52,8 +58,8 @@ basicCrShape
|
||||
-> Creature
|
||||
-> Shape
|
||||
basicCrShape col cr = tr . scaleSH (V3 crsize crsize crsize) $ mconcat
|
||||
[ rotdir . _spShape $ drawEquipment cr
|
||||
, rotdir . dm . translateSHz 20 $ scalp cr
|
||||
[ --rotdir . _spShape $ drawEquipment cr
|
||||
rotdir . dm . translateSHz 20 $ scalp cr
|
||||
, rotdir . dm $ upperBody col cr
|
||||
, dm . rotmdir $ feet cr
|
||||
]
|
||||
|
||||
@@ -202,5 +202,6 @@ targetYouWhenCognizantR cr = reader $ \w -> case cr ^? crPerception . crAwarenes
|
||||
targetYouWhenCognizant :: World -> Creature -> Creature
|
||||
targetYouWhenCognizant w cr = case cr ^? crPerception . crAwarenessLevel . ix 0 of
|
||||
-- so this caused a space leak: be careful with ?~
|
||||
-- consider changing targeted creature to be just an index
|
||||
Just (Cognizant _) -> _creatures w IM.! 0 `seq` cr & crIntention . targetCr ?~ _creatures w IM.! 0
|
||||
_ -> cr & crIntention . targetCr .~ Nothing
|
||||
|
||||
@@ -63,8 +63,8 @@ sentinelFireType f = chainCreatureUpdatesLR
|
||||
)
|
||||
, (crAwayFromPost, goToPostStrat)
|
||||
]
|
||||
-- , Left $ perceptionUpdate' [0]
|
||||
, Left $ perceptionUp 0
|
||||
, Left $ perceptionUpdate' [0]
|
||||
-- , Left $ perceptionUp 0
|
||||
, Right doStrategyActions
|
||||
, Right reloadOverride
|
||||
, Left targetYouWhenCognizant
|
||||
|
||||
@@ -2,8 +2,10 @@ module Dodge.Creature.State
|
||||
( stateUpdate
|
||||
, stateUpdate'
|
||||
, stateUpdateDamage
|
||||
, stateUpdateDamage'
|
||||
, doDamage
|
||||
, clearDamage
|
||||
, invSideEff
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Hammer
|
||||
|
||||
Reference in New Issue
Block a user