Further implementation of poitional sound
This commit is contained in:
@@ -45,7 +45,7 @@ withWarmUp t f cid w
|
||||
w
|
||||
| t > 1 = set (pointerToItem . wpFire) (withWarmUp (t-1) f)
|
||||
$ set (pointerToItem . wpFireState) 2
|
||||
$ soundFrom (CrWeaponSound cid) 26 1 0
|
||||
$ continueSound 26
|
||||
w
|
||||
| t > 0 = set (pointerToItem . wpFire) (withWarmUp (t-1) f)
|
||||
$ set (pointerToItem . wpFireState) 2
|
||||
@@ -54,18 +54,25 @@ withWarmUp t f cid w
|
||||
$ over (pointerToItem . wpLoadedAmmo) (\ammo -> ammo-1)
|
||||
$ set (pointerToItem . wpFireState) 2
|
||||
$ f cid
|
||||
$ soundFrom (CrWeaponSound cid) 28 2 0
|
||||
$ continueSound 28
|
||||
w
|
||||
where cr = _creatures w IM.! cid
|
||||
itRef = _crInvSel cr
|
||||
item = _crInv cr IM.! itRef
|
||||
pointerToItem = creatures . ix cid . crInv . ix itRef
|
||||
fState = _wpFireState item
|
||||
fRate = _wpFireRate item
|
||||
reloadCondition = _wpLoadedAmmo item == 0
|
||||
where
|
||||
cr = _creatures w IM.! cid
|
||||
itRef = _crInvSel cr
|
||||
item = _crInv cr IM.! itRef
|
||||
pointerToItem = creatures . ix cid . crInv . ix itRef
|
||||
fState = _wpFireState item
|
||||
fRate = _wpFireRate item
|
||||
reloadCondition = _wpLoadedAmmo item == 0
|
||||
continueSound soundID
|
||||
| cid == 0 = soundFrom (CrWeaponSound cid) soundID 1 0
|
||||
| otherwise = soundFromPos (CrWeaponSound cid) (_crPos cr) soundID 1 0
|
||||
|
||||
withSound :: Int -> (Int -> World -> World) -> Int -> World -> World
|
||||
withSound soundid f cid = soundOnce soundid . f cid
|
||||
withSound soundid f 0 w = (soundOnce soundid . f 0) w
|
||||
withSound soundid f cid w = (soundOncePos soundid p . f cid) w
|
||||
where
|
||||
p = _crPos (_creatures w IM.! cid)
|
||||
|
||||
withRecoil :: Float -> (Int -> World -> World) -> Int -> World -> World
|
||||
withRecoil recoilAmount eff cid w = eff cid . over (creatures . ix cid) pushback $ w
|
||||
|
||||
Reference in New Issue
Block a user