This commit is contained in:
2022-05-24 23:06:07 +01:00
parent 1492c12d8a
commit b10e141a86
6 changed files with 8 additions and 53 deletions
+1 -14
View File
@@ -1,6 +1,6 @@
module Dodge.Creature.HandPos where
import Dodge.Data
import Dodge.Creature.Test
import Dodge.Creature.Stance
--import Shape
import ShapePicture
import Geometry
@@ -92,20 +92,7 @@ translateToChest cr
| twists cr = rotateSP (-1)
| otherwise = id
oneH :: Creature -> Bool
oneH = crInStance OneHand
twoFlat :: Creature -> Bool
twoFlat = crInStance TwoHandFlat
twists :: Creature -> Bool
twists = crInStance TwoHandTwist
shoulderSP :: SPic -> SPic
shoulderSP = translateSPz 20
waistSP :: SPic -> SPic
waistSP = translateSPz 10
crInStance :: AimStance -> Creature -> Bool
crInStance as cr = crIsAiming' cr -- || (_posture (_crStance cr) == Reloading && hasAmmo cr)
&& cr ^? crInv . ix (_crInvSel cr) . itUse . useAim . aimStance == Just as
+1 -14
View File
@@ -12,13 +12,13 @@ module Dodge.Creature.Picture
) where
import Dodge.Data
--import Dodge.Base
import Dodge.Creature.Test
--import Dodge.Render.InfoBox
--import Dodge.Render.List
--import Dodge.Creature.AlertLevel.Data
--import Dodge.Picture.Layer
import Dodge.Clock
import Dodge.Creature.HandPos (translateToRightHand,translateToLeftHand)
import Dodge.Creature.Stance
--import Dodge.Debug.Picture
import Picture
import Geometry
@@ -197,24 +197,11 @@ scalp cr
where
fhead = colorSH (greyN 0.9) . upperPrismPolyHalf 5 $ polyCirc 4 5
crInStance :: AimStance -> Creature -> Bool
crInStance as cr = crIsAiming' cr -- || (_posture (_crStance cr) == Reloading && hasAmmo cr)
&& cr ^? crInv . ix (_crInvSel cr) . itUse . useAim . aimStance == Just as
--hasAmmo :: Creature -> Bool
--hasAmmo cr = case cr ^? crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded of
-- Just x -> x > 0
-- _ -> False
oneH :: Creature -> Bool
oneH = crInStance OneHand
--twoFlat :: Creature -> Bool
--twoFlat = crInStance TwoHandFlat
twists :: Creature -> Bool
twists = crInStance TwoHandTwist
torso :: Creature -> Shape
{-# INLINE torso #-}
torso cr
+3 -3
View File
@@ -4,7 +4,7 @@ module Dodge.Creature.Property
, crNearPoint
) where
import Dodge.Data
import Dodge.Creature.HandPos
import Dodge.Creature.Stance
import Geometry
import Data.Maybe
@@ -26,8 +26,8 @@ hasFrontArmour p cr = fromMaybe False $ do
-- even though angleVV can generate NaN, the comparison seems to deal with it
where
frontarmdirection
| crInStance OneHand cr = 0.5
| crInStance TwoHandTwist cr = negate 1
| crInAimStance OneHand cr = 0.5
| crInAimStance TwoHandTwist cr = negate 1
| otherwise = 0
--crOnSeg :: Point2 -> Point2 -> Creature -> Bool
-20
View File
@@ -5,17 +5,6 @@ Note that the creature NEED NOT be the same as the creature with that id in the
in fact in some cases a creature with that id may not even exist.
-}
module Dodge.Creature.Test
-- ( crCanShoot
-- , crIsAiming'
-- , crIsReloading
-- , crIsAiming
-- , crHasTargetLOS
-- , crAwayFromPost
-- , crHasTargetR
-- , crStratConMatchesR
-- , crHasAmmo
-- , crSafeDistFromTarg
-- )
where
import Dodge.Data
import Dodge.Base.Collide
@@ -59,9 +48,6 @@ crCanSeeCIDR cid cr = reader $ \w -> hasLOS (_crPos cr) (_crPos $ _creatures w I
crIsAiming :: Creature -> Bool
crIsAiming cr = _posture (_crStance cr) == Aiming
crIsAiming' :: Creature -> Bool
crIsAiming' cr = _posture (_crStance cr) == Aiming
crHasTarget' :: Creature -> Bool
crHasTarget' cr = isJust $ cr ^? crIntention . targetCr . _Just
@@ -119,11 +105,5 @@ crAwayFromPostR cr = return $ case find sentinelGoal $ _crGoal $ _crActionPlan c
crHasAmmo :: Creature -> Bool
crHasAmmo cr = maybe False (> 0) $ cr ^? crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded
crHasAmmo' :: Creature -> Bool
crHasAmmo' cr = maybe False (> 0) $ cr ^? crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded
crCanShoot :: Creature -> Bool
crCanShoot p = crIsAiming p && crHasAmmo p
crCanShoot' :: Creature -> Bool
crCanShoot' p = crIsAiming' p && crHasAmmo' p
+1 -1
View File
@@ -174,7 +174,7 @@ createShieldWall cr invid w = case _itEffectID $ _itEffect it of
rad = _crRad cr + 2
a = crpos +.+ rad *.* crdirv -.- 10 *.* therot crdirv
b = crpos +.+ rad *.* crdirv +.+ 10 *.* therot crdirv
therot | crIsAiming' cr = vNormal
therot | crIsAiming cr = vNormal
| otherwise = rotateV (twoFlatHRot cr) . vNormal
removeShieldWall :: Creature -> Int -> World -> World
removeShieldWall cr invid w = case _itEffectID $ _itEffect it of
+2 -1
View File
@@ -66,6 +66,7 @@ import Dodge.WorldEvent
import Dodge.RandomHelp
import Dodge.Inventory.Lock
import Dodge.Creature.HandPos
import Dodge.Creature.Stance
--import Dodge.Default
import Dodge.Base
import Sound.Data
@@ -395,7 +396,7 @@ muzzleOffset cr it = V3 (holdOffset + 5 + _muzPos dimPort - _handlePos dimPort)
where
dimPort = _dimPortage $ _itDimension it
holdOffset
| crInStance OneHand cr = 10
| crInAimStance OneHand cr = 10
| otherwise = 0
withMuzPos :: (Point3 -> World -> World) -> ChainEffect