Hack machine pistol whir down when no ammo
This commit is contained in:
@@ -377,6 +377,7 @@ doHeldUseEffect t cr w = case t ^. ldtValue . itType of
|
||||
-- itm & ldtValue . itUse . heldParams . weaponRepeat .~ []
|
||||
-- & ldtValue . itUse . heldFrame .~ x
|
||||
|
||||
-- should probably unify failure with time use check in some way...
|
||||
applyCME :: Item -> Creature -> Bool -> World -> World
|
||||
applyCME itm cr cme
|
||||
| cme =
|
||||
@@ -385,8 +386,15 @@ applyCME itm cr cme
|
||||
. applySidePush spush cr
|
||||
. applyTorqueCME itm cr
|
||||
. applyRecoil itm cr
|
||||
| otherwise = failsound
|
||||
| otherwise = case itm ^. itType of
|
||||
HELD MACHINEPISTOL ->
|
||||
cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itid . itParams .~
|
||||
WarmTime (coolstart - 1) True Nothing
|
||||
-- the above is quite hacky for now
|
||||
_ -> failsound
|
||||
where
|
||||
coolstart = fromMaybe 0 $ useDelay itm ^? coolStart
|
||||
itid = itm ^?! itLocation . ilInvID -- unsafe
|
||||
spush = maybe 0 itemSidePush $ itm ^? itType . ibtHeld
|
||||
failsound w = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
|
||||
Just 0 -> soundStart (CrWeaponFailSound (_crID cr)) (_crPos cr) click1S Nothing w
|
||||
|
||||
Reference in New Issue
Block a user