Work on held item usage

This commit is contained in:
2023-05-27 12:32:09 +01:00
parent 4cfb7d431a
commit ec8317c14e
19 changed files with 150 additions and 173 deletions
+5 -2
View File
@@ -3,6 +3,7 @@ module Dodge.Bullet (
useAmmoParams,
) where
import Linear
import Dodge.Item.Weapon.Bullet
import System.Random
import Data.Foldable
@@ -59,13 +60,15 @@ useAmmoParams :: Item -> Creature -> World -> World
useAmmoParams it cr w =
w & cWorld . lWorld . instantBullets
.:~ ( _amBullet bultype
& buPos .~ sp
-- & buPos .~ sp
& buPos .~ _crPos cr
& buTrajectory %~ settrajectory
& buVel %~ (rotateV dir . (muzvel *.*))
& buDrag *~ _rifling (_itParams it)
)
where
sp = _crPos cr +.+ (muzlength + 10) *.* unitVectorAtAngle dir
--sp = _crPos cr +.+ (muzlength + 10) *.* unitVectorAtAngle dir
sp = _crPos cr +.+ (muzlength ^?! _head . _x) *.* unitVectorAtAngle dir
dir = _crDir cr
bultype = _laAmmoType $ _heldConsumption $ _itUse it
muzvel = _muzVel $ _itParams it