Fix bug in item item location
This commit is contained in:
@@ -14,18 +14,9 @@ import Control.Lens
|
||||
|
||||
data Huse
|
||||
= HeldDoNothing
|
||||
-- | HeldUseAmmoParams
|
||||
-- | HeldOverNozzlesUseGasParams
|
||||
-- | HeldPJCreation
|
||||
-- | HeldPJCreationX Int
|
||||
| HeldFireRemoteShell
|
||||
| HeldExplodeRemoteShell Int Int
|
||||
| HeldDetectorEffect Detector
|
||||
-- | HeldTeslaArc
|
||||
-- | HeldLaser
|
||||
-- | HeldCircleLaser
|
||||
-- | HeldDualLaser
|
||||
-- | HeldTractor
|
||||
| HeldForceField
|
||||
| HeldShatter
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
@@ -67,44 +58,9 @@ data Luse
|
||||
|
||||
data HeldMod
|
||||
= PistolMod
|
||||
-- | PoisonSprayerMod
|
||||
-- | FlameSpitterMod
|
||||
-- | FlameSpitterRepeatMod
|
||||
-- | FlameThrowerMod
|
||||
-- | LauncherMod
|
||||
-- | TeslaMod
|
||||
-- | CircleLaserMod
|
||||
-- | LasWideMod Int
|
||||
-- | DualBeamMod
|
||||
-- | LasMod
|
||||
-- | LauncherXMod Int
|
||||
-- | ShatterMod
|
||||
-- | AmmoCheckMod
|
||||
-- | AmmoUseCheckMod
|
||||
-- | AmmoHammerTimeUseOneMod
|
||||
-- | BangCaneMod
|
||||
-- | VolleyGunMod
|
||||
-- | MultiGunMod
|
||||
-- | AutoRifleMod
|
||||
-- | BangRodMod
|
||||
-- | ElephantGunMod
|
||||
-- | AutoAmrMod
|
||||
-- | MachineGunMod
|
||||
-- | ModWithDirectedTeleport HeldMod
|
||||
-- | BangStickMod
|
||||
-- | AutoPistolMod
|
||||
-- | MachinePistolMod
|
||||
-- | BurstRifleMod
|
||||
-- | BurstRifleRepeatMod
|
||||
-- | MiniGunMod Int
|
||||
-- | SmgMod
|
||||
-- | BangConeMod
|
||||
-- | TractorMod --apply with AmmoCheckMod
|
||||
| FireRemoteShellMod
|
||||
| ExplodeRemoteShellMod
|
||||
| DoNothingMod
|
||||
-- | ForceFieldMod
|
||||
-- | DetectorMod Detector
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
makeLenses ''Euse
|
||||
|
||||
@@ -58,8 +58,8 @@ crUpdateInvidLocations mo crid lw invid itm = lw
|
||||
newloc = InInv
|
||||
{ _ilCrID = crid
|
||||
, _ilInvID = invid
|
||||
, _ilIsRoot = Just invid == mo ^? imSelectedItem
|
||||
, _ilIsSelected = Just invid == mo ^? imRootItem
|
||||
, _ilIsRoot = Just invid == mo ^? imRootItem
|
||||
, _ilIsSelected = Just invid == mo ^? imSelectedItem
|
||||
, _ilIsAttached = invid `IS.member` (mo ^. imAttachedItems)
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -22,7 +22,8 @@ import qualified IntMapHelp as IM
|
||||
testStringInit :: Universe -> [String]
|
||||
testStringInit u = (topTestPart u
|
||||
<>) $ map showh $
|
||||
(IM.toList . IM.filter (\itloc -> itloc ^? ilCrID == Just 0) $ (u ^. uvWorld . cWorld . lWorld . itemLocations)) <> ( IM.elems $ fmap h (u ^?! uvWorld . cWorld . lWorld . creatures . ix 0 . crInv))
|
||||
-- (IM.toList . IM.filter (\itloc -> itloc ^? ilCrID == Just 0) $ (u ^. uvWorld . cWorld . lWorld . itemLocations)) <>
|
||||
( IM.elems $ fmap h (u ^?! uvWorld . cWorld . lWorld . creatures . ix 0 . crInv))
|
||||
where
|
||||
h itm = (_itID itm, _itLocation itm)
|
||||
showh (x,(InInv a b c d e)) = show x ++ "," ++ show a ++ "," ++ show b ++"," ++ show c ++"," ++ show d
|
||||
|
||||
Reference in New Issue
Block a user