Work on chase crit corpse

This commit is contained in:
2026-04-05 10:16:20 +01:00
parent 73dfd1f319
commit 22a1162e14
4 changed files with 23 additions and 3 deletions
+20
View File
@@ -1,5 +1,7 @@
module Dodge.Corpse.Make (makeCorpse) where module Dodge.Corpse.Make (makeCorpse) where
import qualified Quaternion as Q
import Linear
import Control.Lens import Control.Lens
import Dodge.Creature.Picture import Dodge.Creature.Picture
import Dodge.Creature.Radius import Dodge.Creature.Radius
@@ -13,6 +15,7 @@ import ShapePicture
makeCorpse :: Creature -> SPic makeCorpse :: Creature -> SPic
makeCorpse cr = case cr ^. crType of makeCorpse cr = case cr ^. crType of
HoverCrit{} -> noPic $ drawHoverCrit cr HoverCrit{} -> noPic $ drawHoverCrit cr
ChaseCrit{} -> noPic $ chaseCorpse cr
_ -> _ ->
noPic noPic
. scaleSH (V3 crsize crsize crsize) . scaleSH (V3 crsize crsize crsize)
@@ -25,3 +28,20 @@ makeCorpse cr = case cr ^. crType of
cskin = crShape $ _crType cr -- this should be fixed cskin = crShape $ _crType cr -- this should be fixed
crsize = 0.1 * crRad (cr ^. crType) crsize = 0.1 * crRad (cr ^. crType)
rotmdir = rotateSH (_crMvDir cr - _crDir cr) rotmdir = rotateSH (_crMvDir cr - _crDir cr)
chaseCorpse :: Creature -> Shape
chaseCorpse cr = mconcat
[colorSH (_skinUpper cskin) . upperPrismPolyHalfMI 0 $ polyCirc 3 12
& each %~ vNormal
& each . _y *~ 0.6
, colorSH (_skinUpper cskin) . overPosSH (Q.apply neckq) $
(upperPrismPolyHalfMI 3 $ (+ V2 8 0) . vNormal <$> trapTBH 2 5 8)
, colorSH (_skinHead cskin)
(overPosSH (Q.apply headq) (upperBox Medium Important 2 [V2 0 (-4), V2 9 0, V2 0 4]))
, rotmdir $ colorSH (_skinLower cskin) $ deadFeet cr
]
where
neckq = (V3 6 0 0, Q.qid)
cskin = crShape $ _crType cr -- this should be fixed
rotmdir = rotateSH (_crMvDir cr - _crDir cr)
headq = neckq `Q.comp` (V3 16 0 0, Q.qid )
+1 -1
View File
@@ -36,7 +36,7 @@ hoverCrit :: Creature
hoverCrit = hoverCrit =
defaultCreature defaultCreature
& crName .~ "hoverCrit" & crName .~ "hoverCrit"
& crHP .~ HP 500 & crHP .~ HP 150
& crType .~ HoverCrit 0 & crType .~ HoverCrit 0
& crFaction .~ ColorFaction blue & crFaction .~ ColorFaction blue
& crStance . carriage .~ Flying 15 0.975 & crStance . carriage .~ Flying 15 0.975
+1 -1
View File
@@ -5,7 +5,7 @@ import Dodge.Data.Creature.Misc
crMass :: CreatureType -> Float crMass :: CreatureType -> Float
crMass = \case crMass = \case
Avatar {} -> 10 Avatar {} -> 10
ChaseCrit {} -> 10 ChaseCrit {} -> 12
HoverCrit {} -> 5 HoverCrit {} -> 5
SwarmCrit -> 2 SwarmCrit -> 2
AutoCrit -> 10 AutoCrit -> 10
+1 -1
View File
@@ -46,7 +46,7 @@ updateCarriage' cid cr w = \case
& cWorld . lWorld . creatures . ix cid . crStance . carriage .~ OnGround & cWorld . lWorld . creatures . ix cid . crStance . carriage .~ OnGround
else w & cWorld . lWorld . creatures . ix cid . crPos .~ ep else w & cWorld . lWorld . creatures . ix cid . crPos .~ ep
OnGround {} -> w OnGround {} -> w
& tocr . crPos +~ 0.8 *^ (cr ^. crOldPos - oop) & tocr . crPos . _xy +~ 0.8 *^ (cr ^. crOldPos . _xy - oop ^. _xy)
where where
tocr = cWorld . lWorld . creatures . ix cid tocr = cWorld . lWorld . creatures . ix cid
oop = cr ^. crOldOldPos oop = cr ^. crOldOldPos