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