Commit before removing pressplates

This commit is contained in:
2025-10-12 20:59:57 +01:00
parent 5e5b24cad0
commit 408b39f160
2 changed files with 15 additions and 16 deletions
+11 -13
View File
@@ -204,25 +204,23 @@ pjRemoteSetDirection ph pj w = case ph of
pjlens = cWorld . lWorld . projectiles . ix (pj ^. pjID)
moveStuckGrenade :: Int -> Point3 -> Float -> Projectile -> World -> World
moveStuckGrenade cid poff d pj w
| Just cr <- w ^? cWorld . lWorld . creatures . ix cid =
let cpos = cr ^. crPos
cdir = cr ^. crDir
vel = cpos - cr ^. crOldPos
in w
& pjlens . pjPos . _xy .~ xyV3 (cpos + rotate3z cdir poff)
& pjlens . pjDir .~ d + cdir
& pjlens . pjVel .~ vel
| otherwise =
w & pjlens . pjType .~ Grenade GStick
moveStuckGrenade cid poff d pj w = fromMaybe (w & pjlens . pjType .~ Grenade GStick) $ do
cr <- w ^? cWorld . lWorld . creatures . ix cid
let cpos = cr ^. crPos
cdir = cr ^. crDir
return $
w
& pjlens . pjPos . _xy .~ xyV3 (cpos + rotate3z cdir poff)
& pjlens . pjDir .~ d + cdir
& pjlens . pjVel .~ (cpos - cr ^. crOldPos)
where
pjlens = cWorld . lWorld . projectiles . ix (pj ^. pjID)
moveProjectile :: Projectile -> World -> World
moveProjectile pj w
| Just GStuckWall{} <- pj ^? pjType . gnHitEffect = w
| Just (GStuckCreature crid poff d) <- pj ^? pjType . gnHitEffect =
moveStuckGrenade crid poff d pj w
| Just (GStuckCreature cid poff d) <- pj ^? pjType . gnHitEffect =
moveStuckGrenade cid poff d pj w
| otherwise = case collide3 sp (sp + _pjVel pj) w of
(p, Just (n, OWall wl)) -> shellHitWall p n wl pj w
(p, Just (_, OFloor)) -> shellHitFloor p pj w