Improve weapon handle offsets
This commit is contained in:
@@ -9,14 +9,14 @@ import Geometry
|
||||
import ShapePicture
|
||||
|
||||
-- the position of a weapon handle
|
||||
aimingWeaponHandlePos :: Creature -> Item -> Float
|
||||
aimingWeaponHandlePos cr it = case it ^? itUse . heldAim . aimStance of
|
||||
Just TwoHandTwist -> -5
|
||||
Just OneHand -> 14
|
||||
Just TwoHandFlat -> 1.2 * _crRad cr
|
||||
aimingWeaponHandlePos :: Creature -> Item -> Point2
|
||||
aimingWeaponHandlePos _ it = case it ^? itUse . heldAim . aimStance of
|
||||
Just TwoHandTwist -> 0
|
||||
Just OneHand -> V2 10 0
|
||||
Just TwoHandFlat -> V2 10 0
|
||||
Nothing -> 0
|
||||
|
||||
aimingWeaponZeroPos :: Creature -> Item -> Float
|
||||
aimingWeaponZeroPos :: Creature -> Item -> Point2
|
||||
aimingWeaponZeroPos cr it =
|
||||
aimingWeaponHandlePos cr it
|
||||
- fromMaybe 0 (it ^? itUse . heldAim . aimHandlePos)
|
||||
@@ -24,12 +24,12 @@ aimingWeaponZeroPos cr it =
|
||||
aimingMuzzlePos :: Creature -> Item -> [Point2]
|
||||
aimingMuzzlePos cr it = fmap ((+ zp) . _mzPos) (it ^.. itUse . heldAim . aimMuzzles . folded)
|
||||
where
|
||||
zp = V2 (aimingWeaponZeroPos cr it) 0
|
||||
zp = aimingWeaponZeroPos cr it
|
||||
|
||||
aimingMuzzleOff :: Creature -> Item -> [Point2]
|
||||
aimingMuzzleOff cr it = fmap (rotateV (_crDir cr) . (+ zp) . _mzPos) (it ^.. itUse . heldAim . aimMuzzles . folded)
|
||||
where
|
||||
zp = V2 (aimingWeaponZeroPos cr it) 0
|
||||
zp = aimingWeaponZeroPos cr it
|
||||
|
||||
aimingMuzzleLength :: Creature -> Item -> Float
|
||||
aimingMuzzleLength cr it = head (aimingMuzzlePos cr it) ^. _x
|
||||
|
||||
@@ -72,7 +72,7 @@ data AimParams = AimParams
|
||||
, _aimRange :: Float
|
||||
, _aimZoom :: ItZoom
|
||||
, _aimStance :: AimStance
|
||||
, _aimHandlePos :: Float
|
||||
, _aimHandlePos :: V2 Float
|
||||
, _aimMuzzles :: [Muzzle]
|
||||
}
|
||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
@@ -11,7 +11,8 @@ defaultAimParams =
|
||||
, _aimRange = 0
|
||||
, _aimZoom = ItZoom 20 0.2 1
|
||||
, _aimStance = OneHand
|
||||
, _aimHandlePos = 10
|
||||
--, _aimHandlePos = 10
|
||||
, _aimHandlePos = 3
|
||||
, _aimMuzzles = [Muzzle (V2 20 0) 0 0]
|
||||
-- , _aimMuzPos = 20
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ rifle =
|
||||
& itUse . heldAim . aimWeight .~ 6
|
||||
& itUse . heldAim . aimRange .~ 1
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 25 0) 0 0.01]
|
||||
& itType . iyModules . at ModHeldAttach ?~ EMPTYMODULE
|
||||
|
||||
repeater :: Item
|
||||
|
||||
@@ -33,7 +33,6 @@ bangStick i =
|
||||
& itDimension . dimCenter .~ V3 5 0 0
|
||||
& itUse . heldDelay . rateMax .~ 8
|
||||
& itUse . heldMods .~ BangStickMod
|
||||
& itUse . heldAim . aimHandlePos .~ 5
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 10 0) a 0.01 | a <- spreadAroundCenter i baseStickSpread]
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
|
||||
|
||||
@@ -14,13 +14,13 @@ turretItemOffset it tu mc =
|
||||
|
||||
transToHandle :: Item -> Point3 -> Point3
|
||||
transToHandle itm = fromMaybe id $ do
|
||||
x <- itm ^? itUse . heldAim . aimHandlePos
|
||||
return (-.-.- V3 x 0 0)
|
||||
V2 x y <- itm ^? itUse . heldAim . aimHandlePos
|
||||
return (-.-.- V3 x y 0)
|
||||
|
||||
heldItemOffset :: Item -> Creature -> Point3 -> Point3
|
||||
heldItemOffset itm cr
|
||||
| isSelected && _posture (_crStance cr) == Aiming =
|
||||
(+.+.+ V3 (aimingWeaponZeroPos cr itm) 0 shoulderHeight)
|
||||
(+.+.+ aimingWeaponZeroPos cr itm `v2z` shoulderHeight)
|
||||
| isSelected && isTwoHandFlat =
|
||||
(+.+.+ V3 (_crRad cr) 0 handD)
|
||||
. rotate3 (twoFlatHRot cr)
|
||||
|
||||
@@ -59,6 +59,7 @@ module Dodge.Item.Weapon.TriggerType (
|
||||
blCheck,
|
||||
) where
|
||||
|
||||
import Dodge.Creature.HandPos
|
||||
import Data.Foldable
|
||||
import Data.Maybe
|
||||
import Dodge.Base
|
||||
@@ -456,9 +457,9 @@ withMuzFlareI :: ChainEffect
|
||||
withMuzFlareI f it cr =
|
||||
makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) (cpos `v2z` 20)
|
||||
-- . muzFlareAt (V4 5 5 0 2) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 5 5 1 3) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 5 5 1 3) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 5 5 1 3) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
|
||||
. f it cr
|
||||
where
|
||||
cdir = _crDir cr
|
||||
@@ -634,7 +635,7 @@ duplicateNumBarrels n eff itm cr w = foldr f w (take n $ itm ^?! itUse . heldAim
|
||||
f brl w' =
|
||||
eff
|
||||
itm
|
||||
( cr & crPos +~ rotateV (_crDir cr) (_mzPos brl)
|
||||
( cr & crPos +~ rotateV (_crDir cr) (_mzPos brl + aimingWeaponZeroPos cr itm)
|
||||
& crDir +~ (_mzRot brl + a)
|
||||
)
|
||||
(w' & randGen .~ g)
|
||||
|
||||
+3
-4
@@ -35,7 +35,6 @@ module Shape (
|
||||
overPosSH,
|
||||
upperCylinder,
|
||||
upperRounded,
|
||||
xCylinder',
|
||||
) where
|
||||
|
||||
import Color
|
||||
@@ -130,10 +129,10 @@ upperPrismPoly ::
|
||||
upperPrismPoly size shad h ps = prismPoly size shad (map (addZ h) ps) (map (addZ 0) ps)
|
||||
|
||||
xCylinderST :: Float -> Float -> Shape
|
||||
xCylinderST = xCylinder' Small Typical
|
||||
xCylinderST = xCylinder Small Typical
|
||||
|
||||
xCylinder' :: Size -> Importance -> Float -> Float -> Shape
|
||||
xCylinder' size shad r x =
|
||||
xCylinder :: Size -> Importance -> Float -> Float -> Shape
|
||||
xCylinder size shad r x =
|
||||
translateSHz r . rotateSHq (V3 0 1 0) (pi / 2) . upperCylinder size shad x $
|
||||
[ V2 r r
|
||||
, V2 (- r / 2) (r / 2)
|
||||
|
||||
Reference in New Issue
Block a user