Stop gibbed/pitted creatures from opening doors
This commit is contained in:
@@ -106,7 +106,8 @@ collide3Chasms sp w m =
|
|||||||
foldl'
|
foldl'
|
||||||
(flip (collide3Chasm sp))
|
(flip (collide3Chasm sp))
|
||||||
m
|
m
|
||||||
(foldMap loopPairs $ w ^. cWorld . chasms)
|
--(foldMap loopPairs $ w ^. cWorld . chasms)
|
||||||
|
(w ^. cWorld . cliffs)
|
||||||
|
|
||||||
collide3Chasm :: Point3 -> (Point2, Point2) -> (Point3, MPO) -> (Point3, MPO)
|
collide3Chasm :: Point3 -> (Point2, Point2) -> (Point3, MPO) -> (Point3, MPO)
|
||||||
collide3Chasm sp ab (ep, m) =
|
collide3Chasm sp ab (ep, m) =
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ module Dodge.Creature.Test (
|
|||||||
crHasTarget,
|
crHasTarget,
|
||||||
crStratConMatches,
|
crStratConMatches,
|
||||||
crSafeDistFromTarg,
|
crSafeDistFromTarg,
|
||||||
|
hasAutoDoorBody,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Linear
|
import Linear
|
||||||
@@ -136,3 +137,11 @@ isAnimate :: Creature -> Bool
|
|||||||
isAnimate cr = case _crActionPlan cr of
|
isAnimate cr = case _crActionPlan cr of
|
||||||
Inanimate -> False
|
Inanimate -> False
|
||||||
_ -> True
|
_ -> True
|
||||||
|
|
||||||
|
hasAutoDoorBody :: Creature -> Bool
|
||||||
|
hasAutoDoorBody cr = case cr ^. crHP of
|
||||||
|
HP {} -> True
|
||||||
|
CrIsCorpse {} -> True
|
||||||
|
CrIsGibs -> False
|
||||||
|
CrIsPitted -> False
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ doCrBl cb = case cb of
|
|||||||
CrCanShoot -> error "got rid of crCanShoot"
|
CrCanShoot -> error "got rid of crCanShoot"
|
||||||
CrIsAiming -> crIsAiming
|
CrIsAiming -> crIsAiming
|
||||||
CrIsAnimate -> isAnimate
|
CrIsAnimate -> isAnimate
|
||||||
|
CrOpenAutoDoor -> \cr -> isAnimate cr && hasAutoDoorBody cr
|
||||||
|
|
||||||
doCrAc :: CrAc -> Creature -> Action
|
doCrAc :: CrAc -> Creature -> Action
|
||||||
doCrAc ca = case ca of
|
doCrAc ca = case ca of
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ data WdCrBl
|
|||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data CrBl = CrCanShoot | CrIsAiming | CrIsAnimate
|
data CrBl = CrCanShoot | CrIsAiming | CrIsAnimate
|
||||||
|
| CrOpenAutoDoor
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data CrAc = CrTurnAround
|
data CrAc = CrTurnAround
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ putAutoDoor a b = Placement (PS 0 0) (PutCoord a) Nothing Nothing $ \_ apl ->
|
|||||||
in Just $
|
in Just $
|
||||||
putDoubleDoor
|
putDoubleDoor
|
||||||
defaultAutoWall
|
defaultAutoWall
|
||||||
(WdBlCrFilterNearPoint 40 (0.5 *^ (x + y)) CrIsAnimate)
|
(WdBlCrFilterNearPoint 40 (0.5 *^ (x + y)) CrOpenAutoDoor)
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
3
|
3
|
||||||
|
|||||||
+6
-19
@@ -159,25 +159,12 @@ convexHull _ = error "Tried to create the convex hull of two or fewer points"
|
|||||||
-- | otherwise = convexPartition (y:z:xs <> [x])
|
-- | otherwise = convexPartition (y:z:xs <> [x])
|
||||||
--convexPartition _ = error "unexpected shape for convexPartition"
|
--convexPartition _ = error "unexpected shape for convexPartition"
|
||||||
|
|
||||||
-- monotone means that all lines orthogonal to the first vector
|
triangulateEarClip :: [Point2] -> [[Point2]]
|
||||||
-- must only intersect the polygon at most once
|
triangulateEarClip (x:y:z:[]) = [(x:y:z:[])]
|
||||||
partitionMonotonePoly :: Point2 -> [Point2] -> [[Point2]]
|
triangulateEarClip (x:y:z:xs)
|
||||||
partitionMonotonePoly v ps = [qs]
|
| isLHS x y z && not (any (`pointInPoly` (x:y:z:[])) xs) = (x:y:z:[]) : triangulateEarClip (x:z:xs)
|
||||||
where
|
| otherwise = triangulateEarClip (y:z:xs ++ [x])
|
||||||
qs = sortOn (dot v) ps
|
triangulateEarClip _ = error "triangulateEarClip: non-simple polygon input?"
|
||||||
|
|
||||||
monotonePolyChains :: Point2 -> [Point2] -> ([Point2],[Point2])
|
|
||||||
monotonePolyChains v ps = undefined
|
|
||||||
|
|
||||||
earClip :: [Point2] -> [[Point2]]
|
|
||||||
earClip (x:y:z:[]) = [(x:y:z:[])]
|
|
||||||
earClip (x:y:z:xs)
|
|
||||||
| isLHS x y z && not (any (`pointInPoly` (x:y:z:[])) xs) = (x:y:z:[]) : earClip (x:z:xs)
|
|
||||||
| otherwise = earClip (y:z:xs ++ [x])
|
|
||||||
earClip _ = error "earClip: non-simple polygon input?"
|
|
||||||
|
|
||||||
fusePolys :: [Point2] -> [Point2] -> [Point2]
|
|
||||||
fusePolys xs ys = xs
|
|
||||||
|
|
||||||
{- | Creates the convex hull of a set of points.
|
{- | Creates the convex hull of a set of points.
|
||||||
assumes no repetition of points: try nubbing!
|
assumes no repetition of points: try nubbing!
|
||||||
|
|||||||
Reference in New Issue
Block a user