From c2770e6b5ca4636ca1bdd12d9f3e8a6037c6038c Mon Sep 17 00:00:00 2001 From: justin Date: Mon, 23 May 2022 15:50:49 +0100 Subject: [PATCH] Cleanup --- src/Dodge/Creature/Property.hs | 2 +- src/Dodge/Data.hs | 1 + src/Dodge/Default/Weapon.hs | 2 ++ src/Dodge/Item/Weapon/SprayGuns.hs | 2 +- src/Dodge/Item/Weapon/TriggerType.hs | 14 +++++++++++--- src/Dodge/Item/Weapon/Utility.hs | 4 ++-- src/ShapePicture.hs | 4 ++-- 7 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/Dodge/Creature/Property.hs b/src/Dodge/Creature/Property.hs index 712f46dc6..53fa74fd1 100644 --- a/src/Dodge/Creature/Property.hs +++ b/src/Dodge/Creature/Property.hs @@ -14,7 +14,7 @@ import Control.Lens -- previous frame -- Not sure if it is a good idea crIsArmouredFrom :: Point2 -> Creature -> Bool -crIsArmouredFrom p cr = hasFrontArmour p cr +crIsArmouredFrom = hasFrontArmour hasFrontArmour :: Point2 -> Creature -> Bool hasFrontArmour p cr = fromMaybe False $ do diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index 2999e8efd..324d50ade 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -377,6 +377,7 @@ data ItemUse { _lUse :: Item -> Creature -> World -> World , _useDelay :: UseDelay , _useHammer :: HammerType + , _eqSite :: EquipSite } | ConsumeUse { _cUse :: Item -> Creature -> World -> World diff --git a/src/Dodge/Default/Weapon.hs b/src/Dodge/Default/Weapon.hs index d28bfd2f1..f92474219 100644 --- a/src/Dodge/Default/Weapon.hs +++ b/src/Dodge/Default/Weapon.hs @@ -65,6 +65,7 @@ defaultlUse = LeftUse { _lUse = \_ _ -> id , _useDelay = FixedRate {_rateMax = 8, _rateTime = 0} , _useHammer = NoHammer + , _eqSite = GoesOnSpecial } luseInstantNoH :: (Item -> Creature -> World -> World) -> ItemUse @@ -72,6 +73,7 @@ luseInstantNoH f = LeftUse { _lUse = f , _useDelay = NoDelay , _useHammer = NoHammer + , _eqSite = GoesOnSpecial } defaultAimParams :: AimParams defaultAimParams = AimParams diff --git a/src/Dodge/Item/Weapon/SprayGuns.hs b/src/Dodge/Item/Weapon/SprayGuns.hs index ad9bf6f48..b78633c0c 100644 --- a/src/Dodge/Item/Weapon/SprayGuns.hs +++ b/src/Dodge/Item/Weapon/SprayGuns.hs @@ -162,7 +162,7 @@ flameThrower = defaultAutoGun { _dimRad = 7 , _dimCenter = V3 9 0 0 , _dimPortage = HeldItem - { _handlePos = 5 + { _handlePos = 0 , _muzPos = 18 } , _dimSPic = flamerPic diff --git a/src/Dodge/Item/Weapon/TriggerType.hs b/src/Dodge/Item/Weapon/TriggerType.hs index 8be49fdce..4d295901a 100644 --- a/src/Dodge/Item/Weapon/TriggerType.hs +++ b/src/Dodge/Item/Weapon/TriggerType.hs @@ -385,11 +385,19 @@ withMuzFlareI f it cr w = makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) flashPos . muzFlareAt (V4 5 5 0 2) flarePos cdir $ f it cr w where - flarePos = addZ 0 (_crPos cr) +.+.+ rotate3z cdir (muzzleOffset +.+.+ V3 0 0 20) - flashPos = addZ 0 (_crPos cr) +.+.+ rotate3z cdir (muzzleOffset +.+.+ V3 5 0 20) - muzzleOffset = V3 (_muzPos (_dimPortage (_itDimension it))) 0 0 + flarePos = addZ 0 (_crPos cr) +.+.+ rotate3z cdir (muzzleOffset cr it +.+.+ V3 0 0 20) + flashPos = addZ 0 (_crPos cr) +.+.+ rotate3z cdir (muzzleOffset cr it +.+.+ V3 5 0 20) +-- muzzleOffset = V3 (_muzPos (_dimPortage (_itDimension it))) 0 0 cdir = _crDir cr +muzzleOffset :: Creature -> Item -> Point3 +muzzleOffset cr it = V3 (holdOffset + 5 + _muzPos dimPort - _handlePos dimPort) 0 0 + where + dimPort = _dimPortage $ _itDimension it + holdOffset + | crInStance OneHand cr = 10 + | otherwise = 0 + withMuzPos :: (Point3 -> World -> World) -> ChainEffect withMuzPos = withMuzPosShift (V2 0 0) withMuzPosShift :: Point2 -> (Point3 -> World -> World) -> ChainEffect diff --git a/src/Dodge/Item/Weapon/Utility.hs b/src/Dodge/Item/Weapon/Utility.hs index ca85ef2db..2e4e02307 100644 --- a/src/Dodge/Item/Weapon/Utility.hs +++ b/src/Dodge/Item/Weapon/Utility.hs @@ -27,7 +27,7 @@ rewindGun = defaultGun , _wpCharge = 0 } , _itEffect = ItRewindEffect rewindEffect [] - , _itUse = defaultlUse {_lUse = \itm cr -> useRewindGun itm cr} + , _itUse = defaultlUse {_lUse = useRewindGun} } rewindEffect :: Item -> Creature -> World -> World rewindEffect itm cr w @@ -109,7 +109,7 @@ aSelf :: Creature -> World -> World aSelf = blinkAction aSelfL :: Item -> Creature -> World -> World -aSelfL _ cr = blinkAction cr +aSelfL _ = blinkAction effectGun :: String -> (Creature -> World -> World) -> Item effectGun name eff = defaultGun diff --git a/src/ShapePicture.hs b/src/ShapePicture.hs index f1a22ffc0..925aa6971 100644 --- a/src/ShapePicture.hs +++ b/src/ShapePicture.hs @@ -49,11 +49,11 @@ rotateSP :: Float -> SPic -> SPic rotateSP a = bimap (rotateSH a) (rotate a) mirrorSPxz :: SPic -> SPic -mirrorSPxz = bimap (reverse . overPosSH flipy) (mirrorxz) +mirrorSPxz = bimap (reverse . overPosSH flipy) mirrorxz where flipy (V3 x y z) = V3 x (negate y) z mirrorSPyz :: SPic -> SPic -mirrorSPyz = bimap (reverse . overPosSH flipx) (mirroryz) +mirrorSPyz = bimap (reverse . overPosSH flipx) mirroryz where flipx (V3 x y z) = V3 (negate x) y z