Add various capabilities for generating graphs, fixes to lasgun
This commit is contained in:
@@ -5,4 +5,4 @@ import Dodge.Item.Weapon.BulletGuns
|
||||
|
||||
|
||||
randBlockBreakWeapon :: RandomGen g => State g Item
|
||||
randBlockBreakWeapon = takeOne [bangStick 1,bangCane]
|
||||
randBlockBreakWeapon = takeOne [bangStick 1]
|
||||
|
||||
@@ -433,7 +433,7 @@ basicBeamAt itid w col dam phasev pos dir = Beam
|
||||
, _bmType = BeamCombine $ const id
|
||||
}
|
||||
where
|
||||
(_,ps) = reflectLaserAlong phasev [] pos (pos +.+ 800 *.* unitVectorAtAngle dir) w
|
||||
(_,ps) = reflectLaserAlong phasev pos (pos +.+ 800 *.* unitVectorAtAngle dir) w
|
||||
|
||||
dualRayAt :: BeamType -> Int -> World -> Color -> Int -> Float -> Point2 -> Float -> Beam
|
||||
dualRayAt bt itid w col dam phasev pos dir = basicBeamAt itid w col dam phasev pos dir
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
module Dodge.Item.Weapon.BulletGun.Cane
|
||||
( bangCane
|
||||
, bangCaneX
|
||||
( volleyGun
|
||||
, repeater
|
||||
, rifle
|
||||
, autoRifle
|
||||
, burstRifle
|
||||
, completeBurstRifle
|
||||
, fastBurstRifle
|
||||
-- , completeBurstRifle
|
||||
-- , fastBurstRifle
|
||||
, miniGunX
|
||||
) where
|
||||
--import Dodge.Particle.Bullet.HitEffect
|
||||
@@ -31,14 +30,8 @@ import Shape
|
||||
import Sound.Data
|
||||
import LensHelp
|
||||
|
||||
--import qualified Data.Map.Strict as M
|
||||
--import qualified Data.Sequence as Seq
|
||||
--import Control.Lens
|
||||
--import Control.Monad.State
|
||||
--import System.Random
|
||||
|
||||
bangCane :: Item
|
||||
bangCane = defaultBulletWeapon
|
||||
defaultBangCane :: Item
|
||||
defaultBangCane = defaultBulletWeapon
|
||||
{ _itParams = BulletShooter
|
||||
{ _muzVel = 0.8
|
||||
, _rifling = 0.9
|
||||
@@ -72,11 +65,11 @@ bangCane = defaultBulletWeapon
|
||||
<> makeSingleClipAt (V3 5 0 3) it
|
||||
}
|
||||
} & itUse . useAim . aimStance .~ OneHand
|
||||
& itType . iyBase .~ BANGCANE
|
||||
& itType . iyBase .~ error "undefined bangCane baseitemtype"
|
||||
& itConsumption . laMax .~ 1
|
||||
& itConsumption . laCycle .~ [loadPartialInsert 10 1]
|
||||
bangCaneX :: Int -> Item
|
||||
bangCaneX i = defaultBulletWeapon
|
||||
volleyGun :: Int -> Item
|
||||
volleyGun i = defaultBulletWeapon
|
||||
& itUse .~ ruseAmmoParamsRate 6 upHammer
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
@@ -123,7 +116,7 @@ bangCaneX i = defaultBulletWeapon
|
||||
,_brlInaccuracy = 0.1
|
||||
}
|
||||
& itParams . torqueAfter .~ 0.48 + 0.2 * fromIntegral i
|
||||
& itType . iyBase .~ BANGCANEX i
|
||||
& itType . iyBase .~ VOLLEYGUN i
|
||||
caneStickSoundChoice :: Item -> SoundID
|
||||
caneStickSoundChoice it
|
||||
| _laLoaded (_itConsumption it) < 2 = tap3S
|
||||
@@ -136,7 +129,7 @@ caneClipX i it = case it ^? itConsumption . laLoaded of
|
||||
[0..la-1]
|
||||
_ -> mempty
|
||||
rifle :: Item
|
||||
rifle = bangCane
|
||||
rifle = defaultBangCane
|
||||
{ _itDimension = ItemDimension
|
||||
{ _dimRad = 8
|
||||
, _dimCenter = V3 5 0 0
|
||||
@@ -195,41 +188,41 @@ burstRifle = repeater
|
||||
, withMuzFlareI
|
||||
, withRecoil
|
||||
]
|
||||
fastBurstRifle :: Item
|
||||
fastBurstRifle = repeater
|
||||
& itType . iyBase .~ FASTBURSTRIFLE
|
||||
& itParams . gunBarrels . brlInaccuracy .~ 0.06
|
||||
& itUse . useDelay . rateMax .~ 18
|
||||
& itUse . useMods .~
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
, sideEffectOnFrame 9 (torqueSideEffect 0.4)
|
||||
, lockInvFor 9
|
||||
, \f it -> repeatOnFrames (take (_laLoaded (_itConsumption it) - 1) [2,4,6,8]) f it
|
||||
, withSoundStart tap3S
|
||||
, useAmmoAmount 1
|
||||
, applyInaccuracy
|
||||
, withMuzFlareI
|
||||
, withRecoil
|
||||
]
|
||||
completeBurstRifle :: Item
|
||||
completeBurstRifle = repeater
|
||||
& itType . iyBase .~ COMPLETEBURSTRIFLE
|
||||
& itType . iyModules . at ModRifleMag .~ Nothing
|
||||
& itParams . gunBarrels . brlInaccuracy .~ 0.1
|
||||
& itUse . useDelay . rateMax .~ 28
|
||||
& itUse . useMods .~
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
, sideEffectOnFrame 15 (torqueSideEffect 0.8)
|
||||
, lockInvFor 15
|
||||
, \f it -> repeatOnFrames (take (_laLoaded (_itConsumption it) - 1) [1..14]) f it
|
||||
, withSoundStart tap3S
|
||||
, useAmmoAmount 1
|
||||
, applyInaccuracy
|
||||
, withMuzFlareI
|
||||
, withRecoil
|
||||
]
|
||||
--fastBurstRifle :: Item
|
||||
--fastBurstRifle = repeater
|
||||
-- & itType . iyBase .~ FASTBURSTRIFLE
|
||||
-- & itParams . gunBarrels . brlInaccuracy .~ 0.06
|
||||
-- & itUse . useDelay . rateMax .~ 18
|
||||
-- & itUse . useMods .~
|
||||
-- [ ammoHammerCheck
|
||||
-- , useTimeCheck
|
||||
-- , sideEffectOnFrame 9 (torqueSideEffect 0.4)
|
||||
-- , lockInvFor 9
|
||||
-- , \f it -> repeatOnFrames (take (_laLoaded (_itConsumption it) - 1) [2,4,6,8]) f it
|
||||
-- , withSoundStart tap3S
|
||||
-- , useAmmoAmount 1
|
||||
-- , applyInaccuracy
|
||||
-- , withMuzFlareI
|
||||
-- , withRecoil
|
||||
-- ]
|
||||
--completeBurstRifle :: Item
|
||||
--completeBurstRifle = repeater
|
||||
-- & itType . iyBase .~ COMPLETEBURSTRIFLE
|
||||
-- & itType . iyModules . at ModRifleMag .~ Nothing
|
||||
-- & itParams . gunBarrels . brlInaccuracy .~ 0.1
|
||||
-- & itUse . useDelay . rateMax .~ 28
|
||||
-- & itUse . useMods .~
|
||||
-- [ ammoHammerCheck
|
||||
-- , useTimeCheck
|
||||
-- , sideEffectOnFrame 15 (torqueSideEffect 0.8)
|
||||
-- , lockInvFor 15
|
||||
-- , \f it -> repeatOnFrames (take (_laLoaded (_itConsumption it) - 1) [1..14]) f it
|
||||
-- , withSoundStart tap3S
|
||||
-- , useAmmoAmount 1
|
||||
-- , applyInaccuracy
|
||||
-- , withMuzFlareI
|
||||
-- , withRecoil
|
||||
-- ]
|
||||
miniGunUse :: Int -> ItemUse
|
||||
miniGunUse i = ruseInstant (useAmmoParams $ Just 1) NoHammer $
|
||||
[ ammoCheckI
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
module Dodge.Item.Weapon.BulletGuns
|
||||
( bangCone
|
||||
, blunderbuss
|
||||
, bigBlunderbuss
|
||||
, biggerBlunderbuss
|
||||
, biggestBlunderbuss
|
||||
, grapeCannon
|
||||
, grenadeLauncher
|
||||
, autogunSpread
|
||||
, autoGun
|
||||
@@ -164,30 +162,14 @@ blunderbuss = bangCone
|
||||
& itUse . useAim . aimStance .~ TwoHandTwist
|
||||
& itUse . useAim . aimWeight .~ 6
|
||||
& itType . iyBase .~ BLUNDERBUSS
|
||||
bigBlunderbuss :: Item
|
||||
bigBlunderbuss = blunderbuss
|
||||
& itType . iyBase .~ BIGBLUNDERBUSS
|
||||
& itConsumption . laMax .~ 50
|
||||
& itConsumption . laCycle .~ [loadEject 5, loadInsert 40 , loadPrime 5]
|
||||
& itParams . recoil .~ 200
|
||||
& itParams . torqueAfter .~ 0.3
|
||||
& itParams . randomOffset .~ 16
|
||||
biggerBlunderbuss :: Item
|
||||
biggerBlunderbuss = bigBlunderbuss
|
||||
& itType . iyBase .~ BIGGERBLUNDERBUSS
|
||||
& itConsumption . laMax .~ 75
|
||||
& itConsumption . laCycle .~ [loadEject 5, loadInsert 50 , loadPrime 5]
|
||||
& itParams . recoil .~ 250
|
||||
& itParams . torqueAfter .~ 0.5
|
||||
& itParams . randomOffset .~ 20
|
||||
biggestBlunderbuss :: Item
|
||||
biggestBlunderbuss = biggerBlunderbuss
|
||||
& itType . iyBase .~ BIGGESTBLUNDERBUSS
|
||||
& itConsumption . laMax .~ 100
|
||||
& itConsumption . laCycle .~ [loadEject 5, loadInsert 60 , loadPrime 5]
|
||||
& itParams . recoil .~ 300
|
||||
& itParams . torqueAfter .~ 0.7
|
||||
& itParams . randomOffset .~ 24
|
||||
grapeCannon :: Int -> Item
|
||||
grapeCannon i = blunderbuss
|
||||
& itType . iyBase .~ GRAPECANNON i
|
||||
& itConsumption . laMax .~ 25 + 25 * i
|
||||
& itConsumption . laCycle .~ [loadEject 5, loadInsert (30 + i * 10) , loadPrime 5]
|
||||
& itParams . recoil .~ (150 + fromIntegral i * 50)
|
||||
& itParams . torqueAfter .~ (0.1 + 0.2 * fromIntegral i)
|
||||
& itParams . randomOffset .~ (12 + 4 * fromIntegral i)
|
||||
|
||||
grenadeLauncher :: Int -> Item
|
||||
grenadeLauncher _ = bangCone
|
||||
|
||||
@@ -195,7 +195,7 @@ targetLaserUpdate _ cr w t
|
||||
& tgActive .~ False
|
||||
)
|
||||
where
|
||||
(mp, ps) = reflectLaserAlong 0.2 [] sp ep w
|
||||
(mp, ps) = reflectLaserAlong 0.2 sp ep w
|
||||
sp = _crPos cr +.+ 15 *.* unitVectorAtAngle (_crDir cr)
|
||||
ep = sp +.+ 5000 *.* normalizeV (mouseWorldPos w -.- sp)
|
||||
addLaserPic = instantParticles .:~ Particle
|
||||
|
||||
@@ -11,27 +11,29 @@ import Geometry
|
||||
--import Data.List
|
||||
import Data.Bifunctor
|
||||
import Data.Tuple
|
||||
import Streaming
|
||||
import qualified Streaming.Prelude as S
|
||||
--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
|
||||
reflectLaserAlong :: Float -> [Wall] -> Point2 -> Point2 -> World
|
||||
-- the distance of the laser should be limited
|
||||
reflectLaserAlong :: Float -> Point2 -> Point2 -> World
|
||||
-> (Maybe (Point2,Either Creature Wall),[Point2])
|
||||
reflectLaserAlong phasev seenWl sp ep w = case runIdentity . S.head_ . S.dropWhile (notseen seenWl)
|
||||
$ thingsHitExceptCr Nothing sp ep w of
|
||||
reflectLaserAlong phasev sp ep w = case thingHit sp ep w of
|
||||
Just (p,Right wl)
|
||||
| _wlReflect wl -> second (p:) $ reflectLaserAlong phasev (wl:seenWl) p
|
||||
(p +.+ 800 *.* unitVectorAtAngle (reflDirWall sp p wl)) w
|
||||
| wlIsSeeThrough wl -> second (p:) $ reflectLaserAlong phasev (wl:seenWl) p
|
||||
(refract sp ep wl p) w
|
||||
| _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
|
||||
(p +.+ normalizeV (refract sp ep wl p))
|
||||
(refract sp ep wl p)
|
||||
w
|
||||
| otherwise -> (Just (p,Right wl), [p])
|
||||
Just (p,obj) -> (Just (p,obj), [p])
|
||||
Nothing -> (Nothing, [ep])
|
||||
where
|
||||
notseen ws (_,Right wl) = not $ any (\w' -> _wlID w' == _wlID wl) ws
|
||||
notseen _ _ = True
|
||||
refract x y wl p
|
||||
| isEntering = p +.+ rotateV angleRef (normalDist wlNormal)
|
||||
| otherwise = p +.+ rotateV angleRef' (normalDist wlNormal')
|
||||
|
||||
Reference in New Issue
Block a user