Start to implement equipment sites on body

This commit is contained in:
2022-05-21 12:13:50 +01:00
parent bc0f7ada3c
commit 398ed6d982
8 changed files with 94 additions and 23 deletions
+5 -2
View File
@@ -8,11 +8,14 @@ import Geometry
import Control.Lens
-- the use of crOldPos is because the damage position is calculated on the
-- previous frame
-- Not sure if it is a good idea
crIsArmouredFrom :: Point2 -> Creature -> Bool
crIsArmouredFrom p cr
= p /= _crPos cr
= p /= _crOldPos cr
&& any (\it -> it ^? itType == Just FRONTARMOUR) (_crInv cr)
&& angleVV (unitVectorAtAngle $ _crDir cr) (p -.- _crPos cr) < pi/2
&& angleVV (unitVectorAtAngle $ _crDir cr) (p -.- _crOldPos cr) < pi/2
-- even though angleVV can generate NaN, the comparison seems to deal with it
--crOnSeg :: Point2 -> Point2 -> Creature -> Bool