Gunsmoke as clouds

This commit is contained in:
2021-03-24 03:02:39 +01:00
parent 03587a7906
commit 48e6779503
4 changed files with 53 additions and 72 deletions
+18
View File
@@ -4,6 +4,7 @@ import Dodge.Data
import Dodge.SoundLogic
import Dodge.CreatureAction (reloadWeapon)
import Dodge.WorldEvent (muzzleFlashAt,tempLightForAt)
import Dodge.WorldEvent.Cloud
import Dodge.RandomHelp
import Dodge.Item.Weapon.Bullet
@@ -18,6 +19,23 @@ import Control.Monad.State
import Data.Maybe
import qualified Data.IntMap.Strict as IM
withThinSmoke :: (Int -> World -> World) -> Int -> World -> World
withThinSmoke eff cid w = eff cid . foldr makeThinSmokeAt w $ map (+.+ pos) ps
where
cr = _creatures w IM.! cid
dir = _crDir cr
pos = _crPos cr +.+ ((_crRad cr +0.5) *.* unitVectorAtAngle dir)
ps = (sequence . replicate 5 . randInCirc) 8 & evalState $ _randGen w
withThickSmoke :: (Int -> World -> World) -> Int -> World -> World
withThickSmoke eff cid w = eff cid . foldr makeThickSmokeAt w $ map (+.+ pos) ps
where
cr = _creatures w IM.! cid
dir = _crDir cr
pos = _crPos cr +.+ ((_crRad cr +15) *.* unitVectorAtAngle dir)
ps = (sequence . replicate 20 . randInCirc) 8 & evalState $ _randGen w
withWarmUp :: Int -> (Int -> World -> World) -> Int -> World -> World
withWarmUp t f cid w
| reloadCondition = fromMaybe w $ reloadWeapon cid w