Tweak dual beams
This commit is contained in:
@@ -191,7 +191,7 @@ testInventory = IM.fromList $ zip [0..]
|
||||
-- , makeTypeCraftNum 1 TRANSMITTER
|
||||
, makeTypeCraftNum 10 HARDWARE
|
||||
, makeTypeCraftNum 3 SPRING
|
||||
-- , makeTypeCraftNum 10 CAN
|
||||
, makeTypeCraftNum 10 CAN
|
||||
-- , makeTypeCraftNum 3 TIN
|
||||
, makeTypeCraftNum 3 PLANK
|
||||
-- , makeTypeCraftNum 1 MOTOR
|
||||
|
||||
@@ -525,6 +525,10 @@ data Beam = Beam
|
||||
data BeamType
|
||||
= BeamCombine
|
||||
{_beamCombine :: (Point2 , (Point2,Point2,Beam) , (Point2,Point2,Beam)) -> World -> World}
|
||||
| BeamItemParamsCombine
|
||||
{_beamCombine :: (Point2 , (Point2,Point2,Beam) , (Point2,Point2,Beam)) -> World -> World
|
||||
,_beamItemParams :: ItemParams
|
||||
}
|
||||
| BeamSimple
|
||||
|
||||
{- Objects without ids.
|
||||
|
||||
@@ -223,8 +223,8 @@ lasGunDual = lasGun
|
||||
& itType .~ LASGUNDUAL
|
||||
& itParams .~ DualBeam
|
||||
{ _phaseV = 1
|
||||
, _lasColor = yellow
|
||||
, _lasColor2 = yellow
|
||||
, _lasColor = orange
|
||||
, _lasColor2 = blue
|
||||
, _lasCycle = 0
|
||||
, _lasDamage = 11
|
||||
, _lasBeam = BeamCombine lasBeamCombine
|
||||
@@ -388,14 +388,23 @@ tractorGunPic it =
|
||||
col = brightX 2 1.5 $ mixColors amFrac (1-amFrac) green red
|
||||
-- | assumes that the item is held
|
||||
shootTeslaArc :: Item -> Creature -> World -> World
|
||||
shootTeslaArc it cr w = w & randGen .~ g
|
||||
& instantParticles .:~ aTeslaArcAt col newarc
|
||||
& creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itParams . currentArc ?~ newarc
|
||||
shootTeslaArc it cr w = w'
|
||||
& creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itParams .~ ip
|
||||
where
|
||||
(w',ip) = shootTeslaArc' (_itParams it) pos dir w
|
||||
pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
||||
dir = _crDir cr
|
||||
|
||||
shootTeslaArc' :: ItemParams -> Point2 -> Float -> World -> (World,ItemParams)
|
||||
shootTeslaArc' ip pos dir w =
|
||||
(w & randGen .~ g
|
||||
& instantParticles .:~ aTeslaArcAt col newarc
|
||||
, ip & currentArc .~ Just newarc
|
||||
)
|
||||
where
|
||||
(col,g) = takeOne [white,azure,blue,cyan] & runState $ _randGen w
|
||||
newarc = createArc (_itParams it) w pos dir & evalState $ _randGen w
|
||||
newarc = createArc ip w pos dir & evalState $ _randGen w
|
||||
|
||||
|
||||
createArc :: ItemParams
|
||||
-> World
|
||||
@@ -540,8 +549,11 @@ splitBeamCombine (p,(a,b,_),(x,y,_))
|
||||
|
||||
teslaBeamCombine :: (Point2,(Point2,Point2,Beam),(Point2,Point2,Beam))
|
||||
-> World -> World
|
||||
teslaBeamCombine (p,(a,b,_),(x,y,_))
|
||||
= instantParticles .:~ lasRayAt yellow 11 1 p (argV (normalizeV (b-.-a)+.+normalizeV (y-.-x)))
|
||||
teslaBeamCombine (p,(a,b,bm),(x,y,_)) w
|
||||
= w'
|
||||
where
|
||||
dir = argV (normalizeV (b-.-a)+.+normalizeV (y-.-x))
|
||||
(w',ip) = shootTeslaArc' (_beamItemParams $ _bmType bm) p dir w
|
||||
|
||||
lasRayAt :: Color -> Int -> Float -> Point2 -> Float -> Particle
|
||||
lasRayAt col dam phasev pos dir = LaserParticle
|
||||
|
||||
Reference in New Issue
Block a user