Refactor flash lighting, improve laser scope lighting

This commit is contained in:
jgk
2021-03-23 19:36:59 +01:00
parent 3e2eaeece2
commit 021ff857fc
4 changed files with 25 additions and 39 deletions
+4 -1
View File
@@ -2144,7 +2144,7 @@ itemLaserScopeEffect
| invid == _crInvSel cr
= w & particles' %~ (:) (makeLaserScope sp ep d reloadFrac)
& creatures . ix (_crID cr) . crInv . ix invid . itHammer %~ moveHammerUp
& flareWidth 2 1 15 32 col 0.05 0.1 (ep -.- 4 *.* unitVectorAtAngle d)
& laserScopeTargetGlow col glowPoint
-- this flare MAY be buggy... something to do with the creature glare
| otherwise = w
where
@@ -2156,6 +2156,9 @@ itemLaserScopeEffect
ep = case listToMaybe $ thingsHitLongLine sp xp w of
Just (p,_) -> p
Nothing -> xp
glowPoint = case listToMaybe $ thingsHitLongLine sp xp w of
Just (p,E3x2 wl) -> p +.+ 2 *.* wallNormal wl
_ -> (ep -.- 2 *.* unitVectorAtAngle d)
it = (cr ^. crInv) IM.! invid
reloadFrac
| _wpLoadedAmmo it == 0 = 1
+2 -2
View File
@@ -3,7 +3,7 @@ module Dodge.Item.Weapon.TriggerType
import Dodge.Data
import Dodge.SoundLogic
import Dodge.CreatureAction (reloadWeapon)
import Dodge.WorldEvent (muzFlareAt,lowLightAt,tempLightForAt)
import Dodge.WorldEvent (muzzleFlashAt,tempLightForAt)
import Dodge.RandomHelp
import Dodge.Item.Weapon.Bullet
@@ -95,7 +95,7 @@ shoot f cid w | fireCondition = over (pointerToItem . wpLoadedAmmo) (\ammo -> am
withMuzFlare :: (Int -> World -> World) -> Int -> World -> World
withMuzFlare f cid w = tempLightForAt 3 pos
. muzFlareAt pos2 $ f cid w
. muzzleFlashAt pos2 $ f cid w
where cr = _creatures w IM.! cid
dir = _crDir cr
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)