Improve item location code
This commit is contained in:
@@ -138,7 +138,7 @@ loadMuzzle t@(LDT _ l _) mz = fromMaybe (t,(mz, 0,Nothing)) $ do
|
||||
availableammo <- mag ^? ldtValue . itUse . amagLoadStatus . iaLoaded
|
||||
let usedammo = min amamount availableammo
|
||||
return (t & ldtLeft . ix i . _2 . ldtValue . itUse . amagLoadStatus . iaLoaded -~ usedammo
|
||||
, (mz, usedammo, mag ^? ldtValue . itLocation . ipInvID)
|
||||
, (mz, usedammo, mag ^? ldtValue . itLocation . ilInvID)
|
||||
)
|
||||
|
||||
makeMuzzleFlare :: Muzzle -> Item -> Creature -> World -> World
|
||||
@@ -204,7 +204,7 @@ itemDetectorEffect itm cr w = fromMaybe w $ do
|
||||
|
||||
walkNozzle :: Int -> Muzzle -> Item -> Creature -> World -> World
|
||||
walkNozzle mzid mz itm cr w = fromMaybe w $ do
|
||||
invid <- itm ^? itLocation . ipInvID
|
||||
invid <- itm ^? itLocation . ilInvID
|
||||
return $ w
|
||||
& cWorld . lWorld . creatures . ix (_crID cr) . crInv
|
||||
. ix invid . itUse . heldAim . aimMuzzles . ix mzid . mzEffect . nzCurrentWalkAngle .~ wa
|
||||
@@ -488,7 +488,7 @@ useForceFieldGun itm cr w = fromMaybe w $ do
|
||||
return $
|
||||
w
|
||||
& cWorld . lWorld . walls %~ IM.insertWith (\_ x -> x) i forceField{_wlID = i}
|
||||
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID (_itLocation itm)) . itParams . paramMID ?~ i
|
||||
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ilInvID (_itLocation itm)) . itParams . paramMID ?~ i
|
||||
& moveWallIDUnsafe i wlline
|
||||
where
|
||||
i = fromMaybe (IM.newKey (_walls (_lWorld (_cWorld w)))) $ itm ^? itParams . paramMID . _Just
|
||||
|
||||
Reference in New Issue
Block a user