Cleanup projectile firing

This commit is contained in:
2025-10-12 10:46:27 +01:00
parent 33de1f79b6
commit bbda28cbc1
4 changed files with 45 additions and 64 deletions
+4 -3
View File
@@ -279,10 +279,10 @@ moveProjectile' pj w
shellHitWall p n wl pj w
| (p, Just (_, OFloor)) <- collide3 sp (sp + 2*^ _pjVel pj) w =
shellHitFloor p pj w
| (p, Just (_, OCreature cr)) <- collide3 sp (sp + _pjVel pj) w =
| (p, Just (_, OCreature cr)) <- collide3 sp (sp + 2 *^ _pjVel pj) w =
shellHitCreature p cr pj w
& cWorld . lWorld . flares <>~ test p cr w sp (_pjVel pj)
| (_, Just (_, OChasmWall)) <- collide3 sp (sp + _pjVel pj) w =
| (_, Just (_, OChasmWall)) <- collide3 sp (sp + 2 *^_pjVel pj) w =
-- no stick or bounce for now
w & cWorld . lWorld . projectiles . ix (pj ^. pjID) . pjTimer .~ 0
| otherwise =
@@ -293,10 +293,11 @@ moveProjectile' pj w
where
sp = _pjPos pj
test :: Point3 -> Creature -> World -> Point3 -> Point3 -> Picture
test p cr w sp v =
(setLayer FixedCoordLayer
$ uncurryV translate (worldPosToScreen (w ^. wCam) (p ^. _xy))
$ drawList [text (shortShow p),text $shortShow sp, text $ shortShow $ sp + 2*v, text $ shortShow v]
$ drawList [text (shortShow p),text $ shortShow sp, text $ shortShow $ sp + 2*v, text $ shortShow v]
<> color white (crossPic 5)
) <>
(setLayer DebugLayer