Set lasGun muzzle position correctly
This commit is contained in:
@@ -6,6 +6,7 @@ module Dodge.Item.Weapon.BatteryGuns
|
||||
)
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.Creature.HandPos
|
||||
import Dodge.Particle.TeslaArc
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.WorldEvent
|
||||
@@ -24,11 +25,11 @@ import Picture
|
||||
import Shape
|
||||
import ShapePicture
|
||||
import Dodge.Picture
|
||||
import LensHelp
|
||||
|
||||
import Data.Function
|
||||
--import Data.Function
|
||||
--import qualified Data.Sequence as Seq
|
||||
import Data.List
|
||||
import Control.Lens
|
||||
import System.Random
|
||||
--import Data.Maybe
|
||||
import Data.Tuple
|
||||
@@ -76,7 +77,7 @@ lasGun = defaultAutoGun
|
||||
, _ammoLoaded = 200
|
||||
, _reloadTime = 80
|
||||
}
|
||||
, _itUse = ruseInstant (const aLaser) NoHammer
|
||||
, _itUse = ruseInstant aLaser NoHammer
|
||||
[ ammoCheckI
|
||||
, withTempLight 1 100 (V3 1 1 0)
|
||||
, withSoundForI tone440sawtoothquietS 2
|
||||
@@ -146,7 +147,7 @@ tractorGun = lasGun
|
||||
|
||||
aTeslaArc :: Creature -> World -> World
|
||||
aTeslaArc cr w = set randGen g w
|
||||
& particles %~ (makeTeslaArcAt col pos dir :)
|
||||
& particles .:~ makeTeslaArcAt col pos dir
|
||||
where
|
||||
pos = _crPos cr +.+ (_crRad cr +1) *.* unitVectorAtAngle dir
|
||||
dir = _crDir cr
|
||||
@@ -157,20 +158,14 @@ aTeslaArc cr w = set randGen g w
|
||||
chooseColor 2 = blue
|
||||
chooseColor _ = cyan
|
||||
|
||||
aLaser :: Creature -> World -> World
|
||||
aLaser cr = particles %~ (makeLaserAt phasev pos dir : )
|
||||
aLaser :: Item -> Creature -> World -> World
|
||||
aLaser it cr = particles .:~ makeLaserAt phasev pos dir
|
||||
where
|
||||
pos = _crPos cr +.+ ((_crRad cr +3) *.* unitVectorAtAngle dir)
|
||||
pos = _crPos cr +.+ (aimingMuzzlePos cr it) *.* unitVectorAtAngle dir
|
||||
dir = _crDir cr
|
||||
phasev = _phaseV . _itParams $ _crInv cr IM.! j
|
||||
j = _crInvSel cr
|
||||
|
||||
--charToPhaseV :: Fractional p => Char -> p
|
||||
--charToPhaseV 'V' = 0.2
|
||||
--charToPhaseV '/' = 1
|
||||
--charToPhaseV 'Z' = 5
|
||||
--charToPhaseV _ = error "Trying to set an undefined phaseV"
|
||||
|
||||
makeLaserAt :: Float -> Point2 -> Float -> Particle
|
||||
makeLaserAt phasev pos dir = Particle
|
||||
{ _ptDraw = const blank
|
||||
@@ -232,7 +227,7 @@ moveLaser phasev pos dir w pt
|
||||
]
|
||||
|
||||
aTractorBeam :: Item -> Creature -> World -> World
|
||||
aTractorBeam _ cr w = over props (IM.insert i (tractorBeamAt i spos outpos dir)) w
|
||||
aTractorBeam _ cr w = w & props . at i ?~ tractorBeamAt i spos outpos dir
|
||||
where
|
||||
i = newProjectileKey w
|
||||
cpos = _crPos cr
|
||||
@@ -254,7 +249,6 @@ tractorBeamAt i pos outpos dir = ProjectileTimed
|
||||
}
|
||||
where
|
||||
d = unitVectorAtAngle dir
|
||||
|
||||
{- |
|
||||
The interaction of this with objects, walls etc needs more thought. -}
|
||||
updateTractor :: Prop -> World -> World
|
||||
|
||||
Reference in New Issue
Block a user