Move creature mass out of record

This commit is contained in:
2025-06-06 09:10:03 +01:00
parent aa219acf8d
commit 73c79f2f4d
12 changed files with 76 additions and 67 deletions
+3 -2
View File
@@ -10,6 +10,7 @@ module Dodge.HeldUse (
heldEffectMuzzles,
) where
import Dodge.Creature.Mass
import Dodge.Data.Muzzle
import Dodge.Data.UseDelay
import Dodge.Item.UseDelay
@@ -455,7 +456,7 @@ applySoundCME itm cr = fromMaybe id $ do
applyRecoil :: Item -> Creature -> World -> World
applyRecoil itm cr =
cWorld . lWorld . creatures . ix (_crID cr) . crPos
+~ rotateV (_crDir cr) (V2 ((- recoilAmount itm) / _crMass cr) 0)
+~ rotateV (_crDir cr) (V2 ((- recoilAmount itm) / crMass (_crType cr)) 0)
recoilAmount :: Item -> Float
recoilAmount itm
@@ -559,7 +560,7 @@ applySidePush maxSide cr w =
& randGen .~ g
where
cid = _crID cr
push = rotateV (_crDir cr) (V2 0 (pushAmount / _crMass cr))
push = rotateV (_crDir cr) (V2 0 (pushAmount / crMass (_crType cr)))
(pushAmount, g) = randomR (- maxSide, maxSide) $ _randGen w
applyTorqueCME :: Item -> Creature -> World -> World