Add forgotten files, many updates concerning turrets and shields

This commit is contained in:
2021-11-05 19:58:55 +00:00
parent 2c768845b2
commit 5a52b646e1
21 changed files with 380 additions and 34 deletions
+6 -1
View File
@@ -21,6 +21,7 @@ import Picture
import qualified IntMapHelp as IM
--import StrictHelp
import Data.Maybe
import Data.Function
import Control.Lens
--import Control.Applicative
@@ -39,10 +40,14 @@ import qualified Data.Vector.Mutable as MV
--dummyUpdate cr _ = (Endo id, Just cr)
-- | The movement is updated before the ai in order to correctly set the oldpos.
-- This should be made more sensible: should the movement side effects apply to
-- the creature before or after it has moved?
-- currently invSideEffects are applied after the creature moves, to correctly
-- update shield positions
stateUpdate :: CRUpdate -> CRUpdate
stateUpdate u cr w = case u (updateMovement cr) w of
(f, maybeCr) ->
( Endo $ invSideEff cr . movementSideEff cr . deathEff . appEndo f
( Endo $ invSideEff (fromMaybe cr maybeCr) . movementSideEff cr . deathEff . appEndo f
, fmap (stepReloading . stepItemUseCooldown . doDamage . crAutoReload) $ crOrCorpse =<< maybeCr
)
where