Fix remote camera bug
This commit is contained in:
@@ -6,7 +6,7 @@ import Dodge.Picture
|
||||
--import Dodge.Picture.Layer
|
||||
import Dodge.Item.Attachment.Data
|
||||
--import Dodge.Base
|
||||
import Dodge.SoundLogic
|
||||
--import Dodge.SoundLogic
|
||||
import Dodge.WorldEvent.SpawnParticle
|
||||
import Dodge.WorldEvent.ThingsHit
|
||||
import Dodge.WorldEvent.HelperParticle
|
||||
@@ -25,7 +25,6 @@ import qualified Data.Sequence as Seq
|
||||
|
||||
aLaser :: Creature -> World -> World
|
||||
aLaser cr w = over particles (makeLaserAt phaseV pos dir : )
|
||||
$ soundFrom LasSound 24 1 0
|
||||
$ laserGunFlashAt (pos +.+ 5 *.* unitVectorAtAngle dir)
|
||||
w
|
||||
where
|
||||
|
||||
@@ -168,6 +168,35 @@ withSidePushAfter maxSide eff cr w = over (creatures . ix cid) push . eff cr $ w
|
||||
push = over crPos (+.+ rotateV (_crDir cr) (V2 0 (pushAmount / _crMass cr)))
|
||||
(pushAmount, _) = randomR (-maxSide,maxSide) $ _randGen w
|
||||
{- | Applies a world effect and sound effect after an ammo check. -}
|
||||
shootWithSoundForI
|
||||
:: Int -- ^ Sound identifier
|
||||
-> Int -- ^ Frames to play
|
||||
-> (Item -> Creature -> World -> World)
|
||||
-- ^ underlying effect
|
||||
-> Item
|
||||
-> Creature
|
||||
-> World
|
||||
-> World
|
||||
shootWithSoundForI soundid playTime f item cr w
|
||||
| fireCondition = soundFromPos (CrWeaponSound cid) cpos soundid playTime 0
|
||||
$ f item cr
|
||||
$ w
|
||||
& pointerToItem %~
|
||||
( ( wpLoadedAmmo -~ 1 )
|
||||
. ( itUseTime .~ _itUseRate item)
|
||||
)
|
||||
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
||||
| otherwise = w
|
||||
where
|
||||
cid = _crID cr
|
||||
cpos = _crPos cr
|
||||
itRef = _crInvSel cr
|
||||
pointerToItem = creatures . ix cid . crInv . ix itRef
|
||||
fireCondition = _wpReloadState item == 0
|
||||
&& _itUseTime item == 0
|
||||
&& _wpLoadedAmmo item > 0
|
||||
reloadCondition = _wpLoadedAmmo item == 0
|
||||
{- | Applies a world effect and sound effect after an ammo check. -}
|
||||
shootWithSoundFor
|
||||
:: Int -- ^ Sound identifier
|
||||
-> Int -- ^ Frames to play
|
||||
|
||||
Reference in New Issue
Block a user