Commit before messing with item tree orientation etc
This commit is contained in:
@@ -24,6 +24,7 @@ module Dodge.Creature.Test (
|
||||
crSafeDistFromTarg,
|
||||
) where
|
||||
|
||||
import Dodge.Item.Grammar
|
||||
import Dodge.Creature.Radius
|
||||
import Dodge.Data.Equipment.Misc
|
||||
import Dodge.Data.AimStance
|
||||
@@ -94,8 +95,8 @@ crInAimStance as cr = crIsAiming cr && mitstance == Just as
|
||||
where
|
||||
mitstance = do
|
||||
i <- cr ^? crManipulation . manObject . imRootSelectedItem
|
||||
itm <- cr ^? crInv . ix i
|
||||
return $ aStance itm
|
||||
itm <- invRootTrees (cr ^. crInv) ^? ix i
|
||||
return $ aimStance itm
|
||||
--cr ^? crInv . ix i . itUse . heldAim . aimStance
|
||||
|
||||
oneH :: Creature -> Bool
|
||||
|
||||
@@ -140,7 +140,7 @@ setAimPosture = (crStance . posture .~ Aiming) . doAimTwist (- twoHandTwistAmoun
|
||||
doAimTwist :: Float -> Creature -> Creature
|
||||
doAimTwist x cr = fromMaybe cr $ do
|
||||
itRef <- cr ^? crManipulation . manObject . imRootSelectedItem
|
||||
astance <- fmap aStance $ cr ^? crInv . ix itRef
|
||||
astance <- fmap itemBaseStance $ cr ^? crInv . ix itRef
|
||||
guard $ astance == TwoHandOver || astance == TwoHandUnder
|
||||
return $ cr & crDir +~ x
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -18,10 +18,7 @@ makeButton ::
|
||||
-- | Effect when pressed
|
||||
WdWd ->
|
||||
Button
|
||||
makeButton col eff =
|
||||
defaultButton
|
||||
{ _btEvent = ButtonPress False eff col
|
||||
}
|
||||
makeButton col eff = defaultButton { _btEvent = ButtonPress False eff col }
|
||||
|
||||
-- TODO remove duplication
|
||||
drawSwitchWire :: Color -> Color -> Button -> SPic
|
||||
|
||||
Reference in New Issue
Block a user