Improve item location code
This commit is contained in:
@@ -19,7 +19,7 @@ autoEffect :: (Item -> Creature -> World -> World) -> Int -> SoundID -> Item ->
|
||||
autoEffect eff t sid itm cr w
|
||||
| _eparamInt (_eeParams (_equipEffect $ _itUse itm)) < 1 =
|
||||
eff itm cr w
|
||||
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID $ _itLocation itm)
|
||||
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ilInvID $ _itLocation itm)
|
||||
. itUse
|
||||
. equipEffect
|
||||
. eeParams
|
||||
@@ -28,7 +28,7 @@ autoEffect eff t sid itm cr w
|
||||
& soundStart OnceSound (_crPos cr) sid Nothing
|
||||
| otherwise =
|
||||
w
|
||||
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ipInvID $ _itLocation itm)
|
||||
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ilInvID $ _itLocation itm)
|
||||
. itUse
|
||||
. equipEffect
|
||||
. eeParams
|
||||
|
||||
@@ -8,7 +8,7 @@ import Geometry
|
||||
|
||||
setRemoteScope :: Int -> Point2 -> World -> World
|
||||
setRemoteScope itid pos w = case w ^? cWorld . lWorld . itemLocations . ix itid of
|
||||
Just (InInv cid' invid) ->
|
||||
Just (InInv cid' invid _ _) ->
|
||||
w
|
||||
& cWorld . lWorld . creatures . ix cid' . crInv . ix invid . itScope
|
||||
. remotePos
|
||||
|
||||
@@ -366,7 +366,7 @@ useAmmoAmount amAmount eff item cr = fromMaybe id $ do
|
||||
atype <- item ^? ldtValue . itUse . heldAmmoTypes . ix 0
|
||||
leftitms <- item ^? ldtLeft
|
||||
mag <- lookup (AmmoInLink 0 atype) leftitms
|
||||
magid <- mag ^? ldtValue . itLocation . ipInvID
|
||||
magid <- mag ^? ldtValue . itLocation . ilInvID
|
||||
-- invid <- ams ^? ix 0 . itLocation . ipInvID
|
||||
return $ eff item cr
|
||||
. (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix magid . itUse . amagLoadStatus . iaLoaded -~ amAmount)
|
||||
@@ -443,7 +443,7 @@ shootL f item cr w
|
||||
| otherwise = w
|
||||
where
|
||||
cid = _crID cr
|
||||
invid = _ipInvID $ _itLocation item
|
||||
invid = _ilInvID $ _itLocation item
|
||||
fireCondition =
|
||||
_rateTime (_leftDelay (_itUse item)) == 0
|
||||
&& _arLoaded (_leftConsumption (_itUse item)) > 0
|
||||
|
||||
Reference in New Issue
Block a user