Start work on lasguns
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
module Dodge.Item.Weapon.BatteryGuns
|
||||
( lasGun
|
||||
, lasDual
|
||||
, lasWide
|
||||
, lasGunWide
|
||||
, lasWidePulse
|
||||
, lasSway
|
||||
, lasSwing
|
||||
@@ -122,8 +122,8 @@ lasPulse = lasGun
|
||||
frac it = 0.5 * (1 + sin (pi * fromIntegral (_lasCycle $ _itParams it) * 0.1))
|
||||
|
||||
|
||||
lasWide :: Int -> Item
|
||||
lasWide n = lasGun
|
||||
lasGunWide :: Int -> Item
|
||||
lasGunWide n = lasGun
|
||||
& itType . iyBase .~ LASGUNWIDE n
|
||||
& itParams . lasColor .~ orange
|
||||
& itParams . lasDamage .~ 2
|
||||
@@ -141,7 +141,7 @@ lasWide n = lasGun
|
||||
)
|
||||
where
|
||||
n' = 9 * n
|
||||
xs = [ 0.25 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
|
||||
xs = [ 0.5 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
|
||||
lasWidePulse :: Item
|
||||
lasWidePulse = lasGun
|
||||
& itType . iyBase .~ LASGUNWIDEPULSE
|
||||
@@ -192,7 +192,7 @@ lasSway = lasGun
|
||||
where
|
||||
x' = _lasCycle $ _itParams it
|
||||
lasFocus :: Int -> Item
|
||||
lasFocus n = lasWide n
|
||||
lasFocus n = lasGunWide n
|
||||
& itType . iyBase .~ LASGUNFOCUS n
|
||||
& itParams . lasColor .~ red
|
||||
& itUse . useMods .~
|
||||
|
||||
@@ -14,19 +14,17 @@ import Data.Tuple
|
||||
--import Streaming
|
||||
--import qualified Streaming.Prelude as S
|
||||
|
||||
-- not sure why we need to keep a list of seen walls, but seems to loop
|
||||
-- infinitely when removed
|
||||
-- this needs to be tested with both reflections and refractions
|
||||
-- the distance of the laser should be limited
|
||||
reflectLaserAlong :: Float -> Point2 -> Point2 -> World
|
||||
-> (Maybe (Point2,Either Creature Wall),[Point2])
|
||||
reflectLaserAlong phasev sp ep w = case thingHit sp ep w of
|
||||
{-# INLINE reflectLaserAlong #-}
|
||||
reflectLaserAlong phasev sp ep w = case thingHitFilt (const True) _wlDraw sp ep w of
|
||||
Just (p,Right wl)
|
||||
| _wlReflect wl -> second (p:) $ reflectLaserAlong phasev
|
||||
(p +.+ unitVectorAtAngle (reflDirWall sp p wl))
|
||||
(p +.+ (dist p ep) *.* unitVectorAtAngle (reflDirWall sp p wl))
|
||||
w
|
||||
| wlIsSeeThrough wl && _wlSeen wl -> second (p:) $ reflectLaserAlong phasev
|
||||
| wlIsSeeThrough wl -> second (p:) $ reflectLaserAlong phasev
|
||||
(p +.+ normalizeV (refract sp ep wl p))
|
||||
(refract sp ep wl p)
|
||||
w
|
||||
|
||||
@@ -595,4 +595,4 @@ duplicateOffsets xs eff item cr w = foldr f w poss
|
||||
where
|
||||
poss :: [V2 Float]
|
||||
poss = map (rotateV (_crDir cr) . V2 0 ) xs
|
||||
f pos = eff item (cr & crPos %~ (+.+ pos))
|
||||
f pos = eff item (cr & crPos +.+.~ pos)
|
||||
|
||||
Reference in New Issue
Block a user