Add dust on bullet wall hit

This commit is contained in:
2021-09-13 12:23:51 +01:00
parent b27c174d93
commit 29f048cfdd
15 changed files with 93 additions and 68 deletions
+3 -2
View File
@@ -328,7 +328,7 @@ ltAutoGun = defaultAutoGun
, withRandomDirI 0.1
, torqueAfterI 0.2
, withSidePushI 50
, withMuzFlareI
, modClock 2 withMuzFlareI
]
, _wpSpread = 0.5
, _wpRange = 20
@@ -388,6 +388,7 @@ miniGun = defaultAutoGun
, withRandomOffsetI 9
, withMuzFlareI
, withOldDir od3
, withSmoke 1 black 20 200 5
]
, _wpRange = 20
, _itFloorPict = onLayer FlItLayer miniGunPict
@@ -948,7 +949,7 @@ moveRemoteShell cid itid pj w
hitWl = fst <$> collideCircWalls oldPos newPos 2 (wallsNearPoint newPos w)
thingHit = hitCr <|> hitWl
r1 = _randGen w & evalState (randInCirc 10)
smokeGen = makeSmokeCloudAt $ addZ 20 $ oldPos +.+ r1 +.+ 30 *.* normalizeV (oldPos -.- newPos)
smokeGen = shellTrailCloud $ addZ 20 $ oldPos +.+ r1 +.+ 30 *.* normalizeV (oldPos -.- newPos)
doExplosion = explodeRemoteRocket itid i
explodeRemoteRocket
+1
View File
@@ -44,6 +44,7 @@ autoGun = defaultAutoGun
, useAmmo 1
, withRandomDirI (autogunSpread/2)
, withMuzFlareI
, withSmoke 1 black 20 200 5
]
, _wpSpread = autogunSpread
, _wpRange = 20
+1 -1
View File
@@ -119,7 +119,7 @@ doThrust pj w = w
(frict,g) = randomR (0.6,0.9) $ _randGen w
(sparkD,_) = randomR (-0.2,0.2) $ _randGen w
r1 = randInCirc 10 & evalState $ _randGen w
smokeGen = makeSmokeCloudAt $ addZ 20 (oldPos +.+ r1 +.+ 30 *.* normalizeV (oldPos -.- newPos))
smokeGen = shellTrailCloud $ addZ 20 (oldPos +.+ r1 +.+ 30 *.* normalizeV (oldPos -.- newPos))
flameLauncher :: Item
flameLauncher = launcher & wpAmmo . amPayload .~ makeFlameExplosionAt
+20 -3
View File
@@ -15,6 +15,7 @@ module Dodge.Item.Weapon.TriggerType
, withSoundStart
, withSoundContinue
, withSoundForI
, withSmoke
, withThickSmokeI
, withThinSmokeI
, withRandomOffsetI
@@ -33,14 +34,15 @@ module Dodge.Item.Weapon.TriggerType
, useTimeCheckI
, ammoCheckI
, randSpreadDir
, modClock
)
where
import Dodge.Data
import Dodge.Data.SoundOrigin
import Dodge.SoundLogic
import Dodge.Creature.Action (startReloadingWeapon)
import Dodge.WorldEvent (tempLightForAt)
import Dodge.WorldEvent.Cloud
import Dodge.WorldEvent
--import Dodge.WorldEvent.Cloud
import Dodge.RandomHelp
import Dodge.Item.Attachment.Data
import Dodge.Item.Data
@@ -69,6 +71,15 @@ trigDoAlso
-> ChainEffect
trigDoAlso afterEff eff item cr = afterEff item cr . eff item cr
withSmoke :: Int -> Point4 -> Float -> Int -> Float -> ChainEffect
withSmoke num col rad t alt eff item cr w
= eff item cr
$ foldl' (flip $ smokeCloudAt col rad t alt . (+.+.+ pos) . (*8)) w ps
where
dir = _crDir cr
pos = addZ 0 $ _crPos cr +.+ (_crRad cr + 15) *.* unitVectorAtAngle dir
ps = replicateM num randOnUnitSphere & evalState $ _randGen w
withThinSmokeI :: ChainEffect
withThinSmokeI eff item cr w = eff item cr $ foldl' (flip $ makeThinSmokeAt . (+.+.+ pos) . (* 8)) w ps
where
@@ -295,8 +306,14 @@ withTempLight time rad col eff item cr = eff item cr
}
V2 x y = _crPos cr +.+ 15 *.* unitVectorAtAngle (_crDir cr)
modClock :: Int -> ChainEffect -> ChainEffect
modClock n chainEff eff it cr w
| _frameClock w `mod` n == 0 = (chainEff eff) it cr w
| otherwise = eff it cr w
withMuzFlareI :: ChainEffect
withMuzFlareI f it cr w = tempLightForAt 3 pos2 -- . muzzleFlashAt pos2
withMuzFlareI f it cr w =
makeTLight 3 100 (V3 1 1 0.5) pos2 -- . muzzleFlashAt pos2
$ f it cr w
where
--pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)