Cleanup
This commit is contained in:
+24
-33
@@ -419,8 +419,7 @@ itemSidePush = \case
|
||||
|
||||
applyInvLock :: Item -> Creature -> World -> World
|
||||
applyInvLock itm cr = case itemInvLock itm of
|
||||
i
|
||||
| i > 0 && cid == 0 ->
|
||||
i | i > 0 && cid == 0 ->
|
||||
(cWorld . lWorld . delayedEvents .:~ (i, UnlockInv)) . lockInv
|
||||
_ -> id
|
||||
where
|
||||
@@ -668,12 +667,11 @@ makeMuzzleFlare mz loc cr = case mz ^. mzFlareType of
|
||||
|
||||
--{-# OPTIONS -Wno-incomplete-uni-patterns #-}
|
||||
muzFlareAt :: Color -> Point3 -> Float -> World -> World
|
||||
muzFlareAt col tranv dir w =
|
||||
w & randGen .~ g
|
||||
& cWorld . lWorld . flares <>~ thepic
|
||||
muzFlareAt col x dir w =
|
||||
w & randGen .~ g & cWorld . lWorld . flares <>~ thepic
|
||||
where
|
||||
thepic =
|
||||
setLayer BloomLayer . translate3 tranv . color col . rotate dir . polygon $
|
||||
setLayer BloomLayer . translate3 x . color col . rotate dir . polygon $
|
||||
[ V2 0 0
|
||||
, V2 a (- b)
|
||||
, V2 c d
|
||||
@@ -779,11 +777,7 @@ itemDetectorEffect itm mitid armitid cr w = fromMaybe w $ do
|
||||
walkNozzle :: Muzzle -> Item -> World -> World
|
||||
walkNozzle mz itm w =
|
||||
w
|
||||
& cWorld . lWorld . items
|
||||
. ix (itm ^. itID . unNInt)
|
||||
. itParams
|
||||
. nzAngle
|
||||
%~ f
|
||||
& cWorld . lWorld . items . ix (itm ^. itID . unNInt) . itParams . nzAngle %~ f
|
||||
& randGen .~ g
|
||||
where
|
||||
nz = _mzEffect mz
|
||||
@@ -1118,8 +1112,13 @@ mcUseHeld hit = case hit of
|
||||
LASER -> mcShootLaser
|
||||
_ -> mcShootAuto
|
||||
|
||||
useGasParams :: Maybe (NewInt InvInt)
|
||||
-> Muzzle -> LocationDT OItem -> Creature -> World -> World
|
||||
useGasParams ::
|
||||
Maybe (NewInt InvInt) ->
|
||||
Muzzle ->
|
||||
LocationDT OItem ->
|
||||
Creature ->
|
||||
World ->
|
||||
World
|
||||
useGasParams mmagid mz loc cr w =
|
||||
w
|
||||
& createGas gastype pressure pos dir cr
|
||||
@@ -1319,25 +1318,17 @@ createProjectile ::
|
||||
Creature ->
|
||||
World ->
|
||||
World
|
||||
createProjectile x pjtype magtree stab muz cr w =
|
||||
w
|
||||
& ( fromMaybe failsound $ do
|
||||
magid <- magtree ^? dtValue . _1 . itLocation . ilInvID
|
||||
ammoitem <- cr ^? crInv . ix magid >>= \k -> w ^? cWorld . lWorld . items . ix k
|
||||
let rdetonate =
|
||||
(^. dtValue . _1 . itID)
|
||||
<$> find isrdet (magtree ^. dtLeft)
|
||||
rscreen =
|
||||
(^. dtValue . _1 . itID)
|
||||
<$> find isrscreen (magtree ^. dtLeft)
|
||||
aparams <-
|
||||
((magtree ^? dtLeft) >>= find isampay >>= (^? dtValue . _1 . itType . ibtAttach . shellPayload))
|
||||
-- <|> ammoitem ^? itConsumables . magParams . ampPayload
|
||||
<|> magAmmoParams ammoitem ^? _Just . ampPayload
|
||||
return $
|
||||
createShell x rdetonate rscreen stab pjtype aparams muz cr
|
||||
. startthesound
|
||||
)
|
||||
createProjectile x pjtype mtree stab muz cr w = fromMaybe (failsound w) $ do
|
||||
magitid <- mtree ^? dtValue . _1 . itID . unNInt
|
||||
ammoitem <- w ^? cWorld . lWorld . items . ix magitid
|
||||
let rdetonate =
|
||||
(^. dtValue . _1 . itID) <$> find isrdet (mtree ^. dtLeft)
|
||||
rscreen =
|
||||
(^. dtValue . _1 . itID) <$> find isrscreen (mtree ^. dtLeft)
|
||||
aparams <-
|
||||
((mtree ^? dtLeft) >>= find isampay >>= (^? dtValue . _1 . itType . ibtAttach . shellPayload))
|
||||
<|> magAmmoParams ammoitem ^? _Just . ampPayload
|
||||
return . makesound $ createShell x rdetonate rscreen stab pjtype aparams muz cr w
|
||||
where
|
||||
isrdet :: DTree OItem -> Bool
|
||||
isrdet y = case y ^. dtValue . _2 of
|
||||
@@ -1353,7 +1344,7 @@ createProjectile x pjtype magtree stab muz cr w =
|
||||
_ -> False
|
||||
|
||||
-- the sound should be moved to the projectile firing
|
||||
startthesound =
|
||||
makesound =
|
||||
soundMultiFrom
|
||||
[CrWeaponSound (_crID cr) j | j <- [0 .. 3]]
|
||||
(_crPos cr)
|
||||
|
||||
Reference in New Issue
Block a user