Commit before messing with item tree orientation etc

This commit is contained in:
2025-06-26 20:29:48 +01:00
parent ab82bcbe20
commit 494c7a4f89
9 changed files with 73 additions and 71 deletions
+11 -6
View File
@@ -1,16 +1,21 @@
{-# LANGUAGE LambdaCase #-}
module Dodge.Item.AimStance (aStance) where
module Dodge.Item.AimStance (aimStance,itemBaseStance) where
import Dodge.Data.Item
--import Dodge.Data.ComposedItem
--import Dodge.Data.DoubleTree
import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
import Control.Lens
import Dodge.Data.AimStance
--aStance :: LocationLDT ItemLink ComposedItem -> AimStance
--aStance :: LocationLDT ItemLink CItem -> AimStance
--aStance loc = case loc ^. locLDT . ldtValue . _1 . itType of
aStance :: Item -> AimStance
aStance itm = case itm ^. itType of
--
aimStance :: LabelDoubleTree ItemLink CItem -> AimStance
aimStance ldt = itemBaseStance $ ldt ^. ldtValue . _1
itemBaseStance :: Item -> AimStance
itemBaseStance itm = case itm ^. itType of
HELD hit -> heldAimStance hit
_ -> OneHand
+1 -1
View File
@@ -135,7 +135,7 @@ extraWeaponLinks itm = case itm ^. itType of
extraWeaponLinksBelow :: Item -> [(ItemStructuralFunction, CLinkType)]
extraWeaponLinksBelow itm
-- | Just TwoHandUnder <- itm ^? itUse . heldAim . aimStance
| TwoHandUnder <- aStance itm
| TwoHandUnder <- itemBaseStance itm
= [(UnderBarrelSlotSF,UnderBarrelSlotLink)]
| otherwise = []
+3 -3
View File
@@ -36,11 +36,11 @@ heldItemRelativeOrient
heldItemRelativeOrient itm cr (p,q)
| Aiming {} <- _posture (_crStance cr) =
(p + aimingWeaponZeroPos cr itm `v2z` shoulderHeight, Q.qID * q)
| TwoHandFlat <- aStance itm =
| TwoHandFlat <- itemBaseStance itm =
( V3 (crRad $ cr ^. crType) 0 handD + rotate3 (twoFlatHRot cr) (transToHandle itm p)
, Q.axisAngle (V3 0 0 1) (twoFlatHRot cr) * q
)
| OneHand <- aStance itm =
| OneHand <- itemBaseStance itm =
( V3 (crRad (cr ^. crType) * 0.7 + handPos) (crRad (cr ^. crType) * negate 0.7) handD
+ transToHandle itm p
, Q.qID * q
@@ -63,7 +63,7 @@ aimingWeaponZeroPos cr it = aimStanceHandlePos cr it - handlePos it
-- the position of a weapon handle
aimStanceHandlePos :: Creature -> Item -> Point2
aimStanceHandlePos _ it = case aStance it of
aimStanceHandlePos _ it = case itemBaseStance it of
TwoHandUnder -> V2 (-2) 0
TwoHandOver -> V2 (-7) 0
OneHand -> V2 10 (-2)
+1 -1
View File
@@ -238,7 +238,7 @@ itmUsageInfo itm = case itm ^. itType of
_ -> "THIS SHOULD NOT BE DISPLAYED"
heldPositionInfo :: Item -> String
heldPositionInfo = aimStanceInfo . aStance
heldPositionInfo = aimStanceInfo . itemBaseStance
aimStanceInfo :: AimStance -> String
aimStanceInfo as = case as of