Work on flying creature inertia

This commit is contained in:
2026-04-02 22:04:58 +01:00
parent ff903bfb3b
commit 06c7e89dee
19 changed files with 205 additions and 171 deletions
+4 -1
View File
@@ -1,6 +1,7 @@
module Dodge.Creature.Damage (applyCreatureDamage) where
--import Linear
import Dodge.Creature.Mass
import Linear
import Dodge.Material.Damage
import Data.List
--import Dodge.Creature.Mass
@@ -15,6 +16,8 @@ applyCreatureDamage :: [Damage] -> Creature -> World -> World
applyCreatureDamage dms cr w = foldl' (applyIndividualDamage cr) w dms
applyIndividualDamage :: Creature -> World -> Damage -> World
applyIndividualDamage cr w (Inertial _ _ v) = w
& cWorld . lWorld . creatures . ix (_crID cr) . crPos . _xy +~ fmap (/ crMass (cr ^. crType)) v
applyIndividualDamage cr w dm =
let (i,w') = damMatSideEffect dm (crMaterial (_crType cr)) (Left cr) w
in w' & damageHP cr i