Fix bug in item item location

This commit is contained in:
2024-09-24 22:29:25 +01:00
parent df80e87427
commit f765b02f2c
6 changed files with 130 additions and 188 deletions
+7 -10
View File
@@ -23,36 +23,33 @@ transToHandle itm = fromMaybe id $ do
heldItemOffset :: Item -> Creature -> Point3 -> Point3
heldItemOffset itm cr
| isroot && _posture (_crStance cr) == Aiming =
| _posture (_crStance cr) == Aiming =
(+.+.+ aimingWeaponZeroPos cr itm `v2z` shoulderHeight)
| isroot && isTwoHandFlat =
| isTwoHandFlat =
(+.+.+ V3 (_crRad cr) 0 handD)
. rotate3 (twoFlatHRot cr)
. transToHandle itm
| isroot && isOneHand =
| isOneHand =
(+.+.+ V3 0 0 handD)
. (+.+.+ V3 (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7) 0)
. (+.+.+ V3 (-2) 0 0)
. transToHandle itm
| isroot =
| otherwise =
(+.+.+ V3 0 0 handD)
. (+.+.+ V3 (_crRad cr) 0 0)
. rotate3 (strideRot cr + 1.2)
. (+.+.+ V3 (-8) 0 0)
-- . (+.+.+ V3 (-5) 0 0)
. transToHandle itm
| otherwise = id
where
handD = 15
isroot = _ilIsRoot $ _itLocation itm -- should make safe?
handPos = case cr ^? crStance . carriage of
Just (Walking x LeftForward) -> f x * 50
_ -> 0
theIt = itm
isOneHand =
theIt ^? itUseAimStance == Just OneHand
|| isNothing (theIt ^? itUseAimStance)
isTwoHandFlat = theIt ^? itUseAimStance == Just TwoHandFlat
itm ^? itUseAimStance == Just OneHand
|| isNothing (itm ^? itUseAimStance)
isTwoHandFlat = itm ^? itUseAimStance == Just TwoHandFlat
itUseAimStance = itUse . heldAim . aimStance
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
sLen = _strideLength $ _crStance cr