Commit before removing pressplates
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -9,6 +9,7 @@ import Geometry.Data
|
||||
import Geometry.LHS
|
||||
import Geometry.Vector
|
||||
import ListHelp
|
||||
import Linear
|
||||
|
||||
-- | Draw an anticlockwise rectangle based on maximal N S W E values.
|
||||
rectNSWE :: Float -> Float -> Float -> Float -> [Point2]
|
||||
@@ -153,7 +154,7 @@ convexHullSafe _ = []
|
||||
grahamScan :: [Point2] -> [Point2]
|
||||
grahamScan = foldr push []
|
||||
where
|
||||
push point stack = grahamEliminate (point : stack)
|
||||
push p stack = grahamEliminate (p : stack)
|
||||
|
||||
{- | Remove second element if top three elements are not counterclockwise.
|
||||
Repeat if necessary. See
|
||||
@@ -164,8 +165,8 @@ grahamEliminate (x : y : z : xs)
|
||||
| not $ isLHS x y z = grahamEliminate (x : z : xs)
|
||||
grahamEliminate xs = xs
|
||||
|
||||
centroid :: Foldable t => t Point2 -> Point2
|
||||
centroid = L.fold $ (/) <$> L.Fold (+.+) (V2 0 0) id <*> L.genericLength
|
||||
centroid :: (Num (f a),Functor f, Fractional a,Foldable t) => t (f a) -> f a
|
||||
centroid = L.fold $ (^/) <$> L.Fold (+) 0 id <*> L.genericLength
|
||||
|
||||
centroidNum :: (Fractional a, Foldable t) => t a -> a
|
||||
centroidNum = L.fold $ (/) <$> L.Fold (+) 0 id <*> L.genericLength
|
||||
|
||||
Reference in New Issue
Block a user