Cleanup, change creature height from Maybe Float to Float
This commit is contained in:
@@ -174,20 +174,13 @@ collide3Wall sp wl (ep, mo) = maybe (ep, mo) (,Just (n, OWall wl)) $ intersectSe
|
||||
|
||||
collide3Creature :: Point3 -> Creature -> (Point3, MPO) -> (Point3, MPO)
|
||||
collide3Creature sp cr (ep, m) = fromMaybe (ep, m) $ do
|
||||
h <- crHeight cr
|
||||
(p, n) <-
|
||||
fst $
|
||||
intersectCylSeg
|
||||
(cr ^. crPos)
|
||||
(crRad $ cr ^. crType)
|
||||
h
|
||||
sp
|
||||
ep
|
||||
let h = crHeight cr
|
||||
(p, n) <- fst $ intersectCylSeg (cr ^. crPos) (crRad $ cr ^. crType) h sp ep
|
||||
return (p, Just (n, OCreature cr))
|
||||
|
||||
crHeight :: Creature -> Maybe Float
|
||||
crHeight :: Creature -> Float
|
||||
crHeight cr = case cr ^. crHP of
|
||||
HP{} -> Just $ case cr ^. crType of
|
||||
HP{} -> case cr ^. crType of
|
||||
HoverCrit {} -> 10
|
||||
ChaseCrit {} -> 25
|
||||
Avatar {} -> 25
|
||||
@@ -198,8 +191,8 @@ crHeight cr = case cr ^. crHP of
|
||||
HiveCrit {} -> 25
|
||||
BarrelCrit{} -> 20
|
||||
_ -> error $ "Need to define crHeight for this crType:\n" <> unlines (prettyShort (cr ^. crType))
|
||||
CrIsCorpse{} -> Just 5
|
||||
AvatarDestroyed{} -> Nothing
|
||||
CrIsCorpse{} -> 5
|
||||
AvatarDestroyed{} -> 0
|
||||
|
||||
wallToSurface :: Wall -> (Point3, Point3, [(Point3, Point3)])
|
||||
wallToSurface wl = (g x, g $ vNormal (x - y), [(g x, g (y - x)), (g y, g (x - y))])
|
||||
|
||||
Reference in New Issue
Block a user