Require weapon also primed on ammo check
This commit is contained in:
@@ -64,7 +64,7 @@ performAimAt cr w tcid p = ([TurnToward tpos aimSp], Just $ AimAt tcid tpos)
|
||||
aimSp = case cr ^? crMvType . mvAimSpeed of
|
||||
Just f -> f $ safeAngleVV (unitVectorAtAngle cdir) (tpos - cpos)
|
||||
Nothing -> error "creature without aiming type"
|
||||
tpos | canSee' = _crPos (_creatures w IM.! tcid)
|
||||
tpos | canSee' = _crPos (_creatures w IM.! tcid)
|
||||
| otherwise = p
|
||||
|
||||
performPathTo :: Creature -> World -> Point2 -> OutAction
|
||||
@@ -243,7 +243,9 @@ stripNoItems cr = organiseInvKeys (_crID cr) .
|
||||
|
||||
organiseInvKeys :: Int -> World -> World
|
||||
organiseInvKeys cid w = w & creatures . ix cid %~
|
||||
( ( crInvSel . iselPos .~ newSelKey ) . (crInv .~ newInv ) )
|
||||
( ( crInvSel . iselPos .~ newSelKey )
|
||||
. ( crInv .~ newInv )
|
||||
. ( crInvSel . iselAction .~ NoInvSelAction) )
|
||||
where
|
||||
cr = _creatures w IM.! cid
|
||||
pairs = IM.toList (_crInv cr)
|
||||
@@ -281,13 +283,13 @@ youDropItem' w = case yourItem w ^? _Just . itCurseStatus of
|
||||
_ -> w
|
||||
where
|
||||
cr = you w
|
||||
|
||||
{- | Copy an inventory item to the floor. -}
|
||||
copyInvItemToFloor :: Creature -> Int -> World -> World
|
||||
copyInvItemToFloor cr i = copyItemToFloor (_crPos cr)
|
||||
(_crInv cr IM.! i
|
||||
$ _crInv cr IM.! i
|
||||
& itInvPos .~ Nothing
|
||||
& itIsHeld .~ False
|
||||
)
|
||||
|
||||
sizeSelf :: Float -> Creature -> World -> Maybe World
|
||||
sizeSelf x cr w
|
||||
@@ -314,7 +316,6 @@ sizeSelf x cr w
|
||||
pickUpItemID :: Int -> Int -> World -> World
|
||||
pickUpItemID cid flid w = pickUpItem cid (_floorItems w IM.! flid) w
|
||||
|
||||
|
||||
{- | Pick up a specific item. -}
|
||||
pickUpItem :: Int -> FloorItem -> World -> World
|
||||
pickUpItem cid flit w = maybe w (soundStart (CrSound cid) (_flItPos flit) pickUpS Nothing . snd)
|
||||
|
||||
+2
-2
@@ -144,8 +144,8 @@ wheelEvent y w = case _hudElement $ _hud w of
|
||||
(Nothing,_) -> closeObjScrollDir y w
|
||||
(Just f,_) -> w & creatures . ix 0 . crInv . ix (crSel $ you w) %~ f y (you w)
|
||||
| lbDown -> w & cameraZoom +~ y
|
||||
| invKeyDown -> stopSoundFrom (CrReloadSound 0) $ changeSwapInvSel yi w
|
||||
| otherwise -> stopSoundFrom (CrReloadSound 0) $ changeAugInvSel yi w
|
||||
| invKeyDown -> changeSwapInvSel yi w
|
||||
| otherwise -> stopSoundFrom (CrReloadSound 0) $ changeAugInvSel yi w
|
||||
DisplayInventory TweakInventory
|
||||
| invKeyDown && rbDown -> w & moveTweakSel yi
|
||||
| invKeyDown -> stopSoundFrom (CrReloadSound 0) $ changeInvSel yi w
|
||||
|
||||
@@ -124,10 +124,11 @@ withThickSmokeI eff item cr w = eff item cr
|
||||
-- TODO create a trigger that does different things on first and continued
|
||||
-- fire.
|
||||
ammoCheckI :: ChainEffect
|
||||
ammoCheckI eff item cr w
|
||||
| _laLoaded (_itConsumption item) <= 0 = w -- fromMaybe w (startReloadingWeapon cr w)
|
||||
-- | _reloadState (_itConsumption item) /= Nothing' = w
|
||||
| otherwise = eff item cr $ w & creatures . ix (_crID cr) %~ crCancelReloading
|
||||
ammoCheckI eff itm cr w
|
||||
| _laLoaded ic <= 0 || not (_laPrimed ic) = w
|
||||
| otherwise = eff itm cr $ w & creatures . ix (_crID cr) %~ crCancelReloading
|
||||
where
|
||||
ic = _itConsumption itm
|
||||
|
||||
-- combined ammo and hammer check: want to be able to auto-reload even if the
|
||||
-- hammer is down?
|
||||
|
||||
Reference in New Issue
Block a user