Remove destroyed creatures rather than setting flag
Sill only set flag for avatar
This commit is contained in:
@@ -30,7 +30,7 @@ updateExpBarrel ps cr w = case cr ^. crHP of
|
|||||||
HP _ ->
|
HP _ ->
|
||||||
w
|
w
|
||||||
& makeExplosionAt (CrIndirectO (cr ^. crID)) ((cr ^. crPos) & _z +~ 20) 0
|
& makeExplosionAt (CrIndirectO (cr ^. crID)) ((cr ^. crPos) & _z +~ 20) 0
|
||||||
& cWorld . lWorld . creatures . ix (_crID cr) . crHP .~ CrDestroyed Gibbed
|
& cWorld . lWorld . creatures . at (_crID cr) .~ Nothing
|
||||||
_ -> w
|
_ -> w
|
||||||
where
|
where
|
||||||
f w' p = makeSpark NormalSpark (p + normalizeV p + cr ^. crPos . _xy) (argV p) w'
|
f w' p = makeSpark NormalSpark (p + normalizeV p + cr ^. crPos . _xy) (argV p) w'
|
||||||
@@ -43,7 +43,7 @@ updateExpBarrel ps cr w = case cr ^. crHP of
|
|||||||
updateBarrel :: Creature -> World -> World
|
updateBarrel :: Creature -> World -> World
|
||||||
updateBarrel cr = case cr ^. crHP of
|
updateBarrel cr = case cr ^. crHP of
|
||||||
HP x | x > 0 -> doDamage (cr ^. crID)
|
HP x | x > 0 -> doDamage (cr ^. crID)
|
||||||
HP _ -> cWorld . lWorld . creatures . ix (_crID cr) . crHP .~ CrDestroyed Gibbed
|
HP _ -> cWorld . lWorld . creatures . at (_crID cr) .~ Nothing
|
||||||
_ -> id
|
_ -> id
|
||||||
|
|
||||||
damsToExpBarrel :: [Damage] -> Creature -> Creature
|
damsToExpBarrel :: [Damage] -> Creature -> Creature
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ crHeight cr = case cr ^. crHP of
|
|||||||
BarrelCrit{} -> 20
|
BarrelCrit{} -> 20
|
||||||
_ -> error $ "Need to define crHeight for this crType:\n" <> unlines (prettyShort (cr ^. crType))
|
_ -> error $ "Need to define crHeight for this crType:\n" <> unlines (prettyShort (cr ^. crType))
|
||||||
CrIsCorpse{} -> Just 5
|
CrIsCorpse{} -> Just 5
|
||||||
CrDestroyed{} -> Nothing
|
AvatarDestroyed{} -> Nothing
|
||||||
|
|
||||||
wallToSurface :: Wall -> (Point3, Point3, [(Point3, Point3)])
|
wallToSurface :: Wall -> (Point3, Point3, [(Point3, Point3)])
|
||||||
wallToSurface wl = (g x, g $ vNormal (x - y), [(g x, g (y - x)), (g y, g (x - y))])
|
wallToSurface wl = (g x, g $ vNormal (x - y), [(g x, g (y - x)), (g y, g (x - y))])
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ hasAutoDoorBody cr = crittype && notdestroyed
|
|||||||
notdestroyed = case cr ^. crHP of
|
notdestroyed = case cr ^. crHP of
|
||||||
HP {} -> True
|
HP {} -> True
|
||||||
CrIsCorpse {} -> True
|
CrIsCorpse {} -> True
|
||||||
CrDestroyed {} -> False
|
AvatarDestroyed {} -> False
|
||||||
crittype = case cr ^. crType of
|
crittype = case cr ^. crType of
|
||||||
SlimeCrit {} -> False
|
SlimeCrit {} -> False
|
||||||
BeeCrit {} -> False
|
BeeCrit {} -> False
|
||||||
|
|||||||
@@ -46,10 +46,11 @@ import qualified Data.IntSet as IS
|
|||||||
-- allow for knockbacks etc to be determined as well as intended movements
|
-- allow for knockbacks etc to be determined as well as intended movements
|
||||||
updateCreature :: Creature -> World -> World
|
updateCreature :: Creature -> World -> World
|
||||||
updateCreature cr
|
updateCreature cr
|
||||||
| cr ^. crPos . _z < negate 300 = (tocr . crHP .~ CrDestroyed Pitted) . destroyAllInvItems cr
|
| cr ^. crPos . _z < negate 300 = (cWorld . lWorld . creatures . at (cr ^. crID) %~ destroyCreature)
|
||||||
|
. destroyAllInvItems cr
|
||||||
| otherwise = case cr ^. crHP of
|
| otherwise = case cr ^. crHP of
|
||||||
CrIsCorpse{} -> cleardamage . updateCarriage (_crID cr) . damageCorpse (_crID cr) cr
|
CrIsCorpse{} -> cleardamage . updateCarriage (_crID cr) . damageCorpse (_crID cr) cr
|
||||||
CrDestroyed{} -> id
|
AvatarDestroyed{} -> id
|
||||||
HP{} -> cleardamage . updateLivingCreature cr
|
HP{} -> cleardamage . updateLivingCreature cr
|
||||||
where
|
where
|
||||||
cleardamage = tocr . crDamage .~ mempty
|
cleardamage = tocr . crDamage .~ mempty
|
||||||
@@ -251,7 +252,7 @@ updateCalmBee cr cid w
|
|||||||
|
|
||||||
slimeCritUpdate :: Int -> World -> World
|
slimeCritUpdate :: Int -> World -> World
|
||||||
slimeCritUpdate cid w
|
slimeCritUpdate cid w
|
||||||
| r < 5 = w & cWorld . lWorld . creatures . ix cid . crHP .~ CrDestroyed Gibbed
|
| r < 5 = w & cWorld . lWorld . creatures . at cid .~ Nothing
|
||||||
| Just hitp <- w ^? cWorld . lWorld . creatures . ix cid . crDamage . ix 0 . dmPos
|
| Just hitp <- w ^? cWorld . lWorld . creatures . ix cid . crDamage . ix 0 . dmPos
|
||||||
, Just hitv <- w ^? cWorld . lWorld . creatures . ix cid . crDamage . ix 0 . dmVector
|
, Just hitv <- w ^? cWorld . lWorld . creatures . ix cid . crDamage . ix 0 . dmVector
|
||||||
, Just w' <- splitSlimeCrit' hitp hitv cid cr w = w'
|
, Just w' <- splitSlimeCrit' hitp hitv cid cr w = w'
|
||||||
@@ -459,7 +460,7 @@ corpseOrGib cr w =
|
|||||||
Just PhysicalDamage
|
Just PhysicalDamage
|
||||||
| _crPain cr > 300 ->
|
| _crPain cr > 300 ->
|
||||||
makeCrGibs cr
|
makeCrGibs cr
|
||||||
. sethp (CrDestroyed Gibbed)
|
. (cWorld . lWorld . creatures . at (cr ^. crID) %~ destroyCreature)
|
||||||
. dodeathsound GibsDeath
|
. dodeathsound GibsDeath
|
||||||
_ ->
|
_ ->
|
||||||
sethp (CrIsCorpse thecorpse)
|
sethp (CrIsCorpse thecorpse)
|
||||||
|
|||||||
@@ -63,7 +63,14 @@ data Creature = Creature
|
|||||||
data CrHP
|
data CrHP
|
||||||
= HP Int
|
= HP Int
|
||||||
| CrIsCorpse SPic
|
| CrIsCorpse SPic
|
||||||
| CrDestroyed CrDestructionType
|
| AvatarDestroyed
|
||||||
|
-- | CrDestroyed CrDestructionType
|
||||||
|
|
||||||
|
destroyCreature :: Maybe Creature -> Maybe Creature
|
||||||
|
destroyCreature mcr
|
||||||
|
| Just cr <- mcr
|
||||||
|
, _crID cr == 0 = Just cr{_crHP = AvatarDestroyed}
|
||||||
|
| otherwise = Nothing
|
||||||
|
|
||||||
data CrDestructionType = Gibbed | Pitted | Swallowed
|
data CrDestructionType = Gibbed | Pitted | Swallowed
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ crslime :: Creature -> Int
|
|||||||
crslime cr = case cr ^. crType of
|
crslime cr = case cr ^. crType of
|
||||||
SlimeCrit {_slimeSlime=r} | HP{} <- cr ^. crHP -> r -- r ^ (2::Int)
|
SlimeCrit {_slimeSlime=r} | HP{} <- cr ^. crHP -> r -- r ^ (2::Int)
|
||||||
HiveCrit {_hiveSlime=x} -> x
|
HiveCrit {_hiveSlime=x} -> x
|
||||||
BeeCrit {} | CrDestroyed{} <- cr ^. crHP -> 0
|
|
||||||
BeeCrit {_beeSlime=x} -> 400 + x
|
BeeCrit {_beeSlime=x} -> 400 + x
|
||||||
_ -> 0
|
_ -> 0
|
||||||
|
|
||||||
|
|||||||
+9
-8
@@ -611,13 +611,14 @@ setOldPos cr = cr & crOldPos .~ _crPos cr
|
|||||||
|
|
||||||
zoneCreatures :: World -> World
|
zoneCreatures :: World -> World
|
||||||
zoneCreatures w =
|
zoneCreatures w =
|
||||||
w & crZoning .~ foldl' zoneCreature mempty (IM.filter zonableCreature $ w ^. cWorld . lWorld . creatures)
|
-- w & crZoning .~ foldl' zoneCreature mempty (IM.filter zonableCreature $ w ^. cWorld . lWorld . creatures)
|
||||||
|
w & crZoning .~ foldl' zoneCreature mempty (w ^. cWorld . lWorld . creatures)
|
||||||
|
|
||||||
zonableCreature :: Creature -> Bool
|
--zonableCreature :: Creature -> Bool
|
||||||
zonableCreature cr = case cr ^. crHP of
|
--zonableCreature cr = case cr ^. crHP of
|
||||||
HP{} -> True
|
-- HP{} -> True
|
||||||
CrIsCorpse{} -> True
|
-- CrIsCorpse{} -> True
|
||||||
CrDestroyed{} -> False
|
-- AvatarDestroyed{} -> False
|
||||||
|
|
||||||
updateCreatureSoundPositions :: World -> World
|
updateCreatureSoundPositions :: World -> World
|
||||||
updateCreatureSoundPositions w =
|
updateCreatureSoundPositions w =
|
||||||
@@ -1005,7 +1006,7 @@ canSpring cr =
|
|||||||
cr ^. crPos . _z >= 0 && case cr ^. crHP of
|
cr ^. crPos . _z >= 0 && case cr ^. crHP of
|
||||||
HP{} -> True
|
HP{} -> True
|
||||||
CrIsCorpse{} -> True
|
CrIsCorpse{} -> True
|
||||||
CrDestroyed{} -> False
|
AvatarDestroyed{} -> False
|
||||||
|
|
||||||
crCrSpring :: Creature -> Creature -> World -> World
|
crCrSpring :: Creature -> Creature -> World -> World
|
||||||
crCrSpring c1 c2
|
crCrSpring c1 c2
|
||||||
@@ -1087,7 +1088,7 @@ feedSlime s c w = fromMaybe w $ do
|
|||||||
& slimeSuck s c
|
& slimeSuck s c
|
||||||
else
|
else
|
||||||
w
|
w
|
||||||
& cWorld . lWorld . creatures . ix (c ^. crID) . crHP .~ CrDestroyed Swallowed
|
& cWorld . lWorld . creatures . at (c ^. crID) %~ destroyCreature
|
||||||
& cWorld . lWorld . creatures . ix (s ^. crID) %~ f
|
& cWorld . lWorld . creatures . ix (s ^. crID) %~ f
|
||||||
& slimeEatSound (s ^. crID) (s ^. crPos . _xy)
|
& slimeEatSound (s ^. crID) (s ^. crPos . _xy)
|
||||||
where
|
where
|
||||||
|
|||||||
Reference in New Issue
Block a user