Stop inanimate objects from opening walls
This commit is contained in:
@@ -15,8 +15,10 @@ import Picture
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Control.Lens
|
||||
|
||||
defaultInanimate = defaultCreature & crIsAnimate .~ False
|
||||
|
||||
lamp :: Creature
|
||||
lamp = defaultCreature
|
||||
lamp = defaultInanimate
|
||||
{ _crUpdate = initialiseLamp
|
||||
, _crHP = 500
|
||||
, _crPict = \ _ -> onLayer CrLayer $ color white $ circleSolid 10
|
||||
@@ -40,7 +42,7 @@ updateLamp i = unrandUpdate handleLS internalUpdate
|
||||
|
||||
|
||||
barrel :: Creature
|
||||
barrel = defaultCreature
|
||||
barrel = defaultInanimate
|
||||
{ _crUpdate = updateBarrel
|
||||
, _crHP = 500
|
||||
, _crPict = \ _ -> onLayer CrLayer $ pictures
|
||||
@@ -56,7 +58,7 @@ barrel = defaultCreature
|
||||
}
|
||||
|
||||
explosiveBarrel :: Creature
|
||||
explosiveBarrel = defaultCreature
|
||||
explosiveBarrel = defaultInanimate
|
||||
{ _crUpdate = updateExpBarrel
|
||||
, _crHP = 400
|
||||
, _crPict = \ _ -> onLayer CrLayer $ pictures [ color orange $ circleSolid 10
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
module Dodge.Creature.LookupStatus
|
||||
where
|
||||
import Dodge.Data
|
||||
|
||||
import Geometry
|
||||
|
||||
import Control.Lens
|
||||
|
||||
isArmouredFrom :: Point2 -> Creature -> Bool
|
||||
isArmouredFrom p cr
|
||||
= p /= _crPos cr
|
||||
&& any (\it -> it ^? itIdentity == Just FrontArmour) (_crInv cr)
|
||||
&& angleVV (unitVectorAtAngle $ _crDir cr) (p -.- _crPos cr) < pi/2
|
||||
-- even though angleVV can generate NaN, the comparison seems to deal with it
|
||||
@@ -0,0 +1,20 @@
|
||||
module Dodge.Creature.Property
|
||||
where
|
||||
import Dodge.Data
|
||||
|
||||
import Geometry
|
||||
|
||||
import Control.Lens
|
||||
|
||||
crIsArmouredFrom :: Point2 -> Creature -> Bool
|
||||
crIsArmouredFrom p cr
|
||||
= p /= _crPos cr
|
||||
&& any (\it -> it ^? itIdentity == Just FrontArmour) (_crInv cr)
|
||||
&& angleVV (unitVectorAtAngle $ _crDir cr) (p -.- _crPos cr) < pi/2
|
||||
-- even though angleVV can generate NaN, the comparison seems to deal with it
|
||||
|
||||
crOnSeg :: Point2 -> Point2 -> Creature -> Bool
|
||||
crOnSeg p1 p2 cr = circOnLine p1 p2 (_crPos cr) (_crRad cr)
|
||||
|
||||
crNearSeg :: Float -> Point2 -> Point2 -> Creature -> Bool
|
||||
crNearSeg d p1 p2 cr = circOnLine p1 p2 (_crPos cr) (_crRad cr + d)
|
||||
Reference in New Issue
Block a user