Start more sensibly separating avatar from ai creatures
This commit is contained in:
+18
-12
@@ -6,7 +6,6 @@ module Dodge.HeldUse (
|
||||
mcUseHeld,
|
||||
) where
|
||||
|
||||
import Dodge.Item.HeldOffset
|
||||
import Color
|
||||
import Control.Monad
|
||||
import Data.Maybe
|
||||
@@ -18,6 +17,7 @@ import Dodge.Data.MuzzleEffect
|
||||
import Dodge.Data.World
|
||||
import Dodge.Gas
|
||||
import Dodge.Inventory.Lock
|
||||
import Dodge.Item.HeldOffset
|
||||
import Dodge.Item.Weapon.Radar
|
||||
import Dodge.Item.Weapon.Shatter
|
||||
import Dodge.Item.Weapon.TriggerType
|
||||
@@ -152,18 +152,19 @@ makeMuzzleFlare mz itmtree cr = case mz ^. mzFlareType of
|
||||
HeavySmokeFlare -> basicMuzFlare pos dir
|
||||
LasGunFlare ->
|
||||
flareCircleAt (getLaserColor itmtree) 0.8 (pos `v2z` 20)
|
||||
-- . ( cWorld . lWorld . tempLightSources
|
||||
-- .:~ tlsTimeRadColPos 1 100 (xyzV4 $ getLaserColor itmtree) (pos `v2z` 10)
|
||||
-- . ( cWorld . lWorld . tempLightSources
|
||||
-- .:~ tlsTimeRadColPos 1 100 (xyzV4 $ getLaserColor itmtree) (pos `v2z` 10)
|
||||
. ( cWorld . lWorld . lights
|
||||
.:~ LSParam (pos `v2z` 10) 100 (xyzV4 $ getLaserColor itmtree)
|
||||
)
|
||||
TeslaGunFlare ->
|
||||
cWorld . lWorld . lights
|
||||
.:~ LSParam (pos `v2z` 10) 100 (V3 0 0 1)
|
||||
-- .:~ tlsTimeRadColPos 1 100 (V3 0 0 1) (pos `v2z` 10)
|
||||
where
|
||||
-- .:~ tlsTimeRadColPos 1 100 (V3 0 0 1) (pos `v2z` 10)
|
||||
|
||||
itm = itmtree ^. ldtValue
|
||||
(moff,mrot) = heldItemOrient2D itm cr (_mzPos mz) (_mzRot mz)
|
||||
(moff, mrot) = heldItemOrient2D itm cr (_mzPos mz) (_mzRot mz)
|
||||
pos = _crPos cr + rotateV (_crDir cr) moff
|
||||
dir = _crDir cr + mrot
|
||||
|
||||
@@ -203,7 +204,7 @@ getLaserColor = const yellow
|
||||
|
||||
basicMuzFlare :: Point2 -> Float -> World -> World
|
||||
basicMuzFlare pos dir =
|
||||
-- makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) (pos `v2z` 20)
|
||||
-- makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) (pos `v2z` 20)
|
||||
(cWorld . lWorld . lights .:~ LSParam (pos `v2z` 20) 100 (V3 1 1 0.5))
|
||||
. muzFlareAt (V4 10 10 1 3) (pos `v2z` 20) dir
|
||||
. muzFlareAt (V4 10 10 1 3) (pos `v2z` 20) dir
|
||||
@@ -296,7 +297,7 @@ shootLaser itmtree cr mz w =
|
||||
}
|
||||
where
|
||||
itm = itmtree ^. ldtValue
|
||||
(moff,mrot) = heldItemOrient2D itm cr (_mzPos mz) (_mzRot mz)
|
||||
(moff, mrot) = heldItemOrient2D itm cr (_mzPos mz) (_mzRot mz)
|
||||
pos = _crPos cr + rotateV (_crDir cr) moff
|
||||
dir = _crDir cr + mrot + a
|
||||
(a, g) = randomR (- inacc, inacc) $ _randGen w
|
||||
@@ -365,7 +366,7 @@ getBulletTrajectory mz itm bt tp cr w = case bt of
|
||||
BezierTrajectoryType -> BezierTrajectory bulpos tp (mouseWorldPos (w ^. input) (w ^. wCam))
|
||||
MagnetTrajectoryType -> MagnetTrajectory tp
|
||||
where
|
||||
(moff,_) = heldItemOrient2D itm cr (_mzPos mz + V2 0 offset) (_mzRot mz)
|
||||
(moff, _) = heldItemOrient2D itm cr (_mzPos mz + V2 0 offset) (_mzRot mz)
|
||||
bulpos = _crPos cr + rotateV (_crDir cr) moff
|
||||
offset = case itm ^? itUse . heldParams . randomOffset of
|
||||
Just x | x /= 0 -> fst . randomR (- x, x) $ _randGen w
|
||||
@@ -395,7 +396,7 @@ makeBullet thebullet itm cr mz w =
|
||||
& buDrag *~ drag
|
||||
)
|
||||
where
|
||||
(moff,mrot) = heldItemOrient2D itm cr (_mzPos mz + V2 0 offset) (_mzRot mz)
|
||||
(moff, mrot) = heldItemOrient2D itm cr (_mzPos mz + V2 0 offset) (_mzRot mz)
|
||||
bulpos = _crPos cr + rotateV (_crDir cr) moff
|
||||
(a, g'') = randomR (- inacc, inacc) $ _randGen w
|
||||
inacc = _mzInaccuracy mz
|
||||
@@ -440,7 +441,7 @@ useGasParams mmagid mz itm cr w =
|
||||
gc <- itm ^? itUse . heldParams . gasCreation
|
||||
return $ gasCreate fueltype gc
|
||||
--pos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm)
|
||||
(moff,mrot) = heldItemOrient2D itm cr (_mzPos mz) (_mzRot mz)
|
||||
(moff, mrot) = heldItemOrient2D itm cr (_mzPos mz) (_mzRot mz)
|
||||
pos = _crPos cr + rotateV (_crDir cr) moff
|
||||
(a, g') = randomR (- inacc, inacc) g
|
||||
inacc = _mzInaccuracy mz
|
||||
@@ -490,7 +491,7 @@ shootTeslaArc itm cr mz w =
|
||||
-- use items item location instead
|
||||
itRef = cr ^?! crManipulation . manObject . imRootSelectedItem -- unsafe!! TODO change
|
||||
(w', ip) = makeTeslaArc (_itParams itm) pos dir w
|
||||
(moff,mrot) = heldItemOrient2D itm cr (_mzPos mz) (_mzRot mz)
|
||||
(moff, mrot) = heldItemOrient2D itm cr (_mzPos mz) (_mzRot mz)
|
||||
pos = _crPos cr + rotateV (_crDir cr) moff
|
||||
dir = _crDir cr + mrot
|
||||
|
||||
@@ -522,7 +523,12 @@ createProjectile magtree muz itmtree cr = fromMaybe failsound $ do
|
||||
. startthesound
|
||||
where
|
||||
-- the sound should be moved to the projectile firing
|
||||
startthesound = soundMultiFrom [CrWeaponSound (_crID cr) j | j <- [0 .. 3]] (_crPos cr) tap4S Nothing
|
||||
startthesound =
|
||||
soundMultiFrom
|
||||
[CrWeaponSound (_crID cr) j | j <- [0 .. 3]]
|
||||
(_crPos cr)
|
||||
tap4S
|
||||
Nothing
|
||||
failsound w' = case w' ^? input . mouseButtons . ix SDL.ButtonLeft of
|
||||
Just 0 -> soundStart (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing w'
|
||||
_ -> soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing w'
|
||||
|
||||
Reference in New Issue
Block a user