Make optical scope relative to camera rotation
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
module Dodge.Base.You
|
||||
(you
|
||||
, yourScopeInvID
|
||||
-- , yourScopeInvID
|
||||
, yourInv
|
||||
, yourScrollAttachment
|
||||
, yourItem
|
||||
@@ -30,11 +30,11 @@ yourScrollAttachment w = do
|
||||
guard (canHeldScrollAttach itm atparams)
|
||||
return (i - 1, atparams)
|
||||
|
||||
yourScopeInvID :: World -> Maybe Int
|
||||
yourScopeInvID w = do
|
||||
(i, params) <- yourScrollAttachment w
|
||||
_ <- params ^? opticPos
|
||||
return i
|
||||
--yourScopeInvID :: World -> Maybe Int
|
||||
--yourScopeInvID w = do
|
||||
-- (i, params) <- yourScrollAttachment w
|
||||
-- _ <- params ^? opticPos
|
||||
-- return i
|
||||
|
||||
yourInv :: World -> IM.IntMap Item
|
||||
yourInv = _crInv . you
|
||||
|
||||
@@ -104,7 +104,7 @@ data HeldMod
|
||||
| ExplodeRemoteShellMod
|
||||
| DoNothingMod
|
||||
-- | ForceFieldMod
|
||||
| DetectorMod Detector
|
||||
-- | DetectorMod Detector
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
makeLenses ''Euse
|
||||
|
||||
@@ -12,8 +12,16 @@ import Geometry.Data
|
||||
|
||||
data Scope
|
||||
= NoScope
|
||||
| RemoteScope
|
||||
| OpticScope
|
||||
{ -- | a camera offset
|
||||
_opticPos :: Point2 -- this should be relative to the camera rotation
|
||||
-- this means that when the camera rotates when firing etc,
|
||||
-- this doesn't need to be changed
|
||||
, _opticZoom :: Float
|
||||
, _opticDefaultZoom :: Float
|
||||
}
|
||||
| RemoteScope
|
||||
{ -- | a camera offset, note unlike the optic pos this is absolute
|
||||
_remotePos :: Point2
|
||||
, _remoteZoom :: Float
|
||||
}
|
||||
|
||||
@@ -121,15 +121,15 @@ data AmmoParams = BulletParams {_ampBullet :: Bullet}
|
||||
deriving (Eq, Show, Read) --Generic, Flat)
|
||||
|
||||
data ScrollAttachParams
|
||||
= ZoomScrollParams
|
||||
{ -- | a camera offset
|
||||
_opticPos :: Point2 -- this should be relative to the camera rotation
|
||||
-- then when the camera rotates when firing etc,
|
||||
-- this doesn't need to be changed
|
||||
, _opticZoom :: Float
|
||||
, _opticDefaultZoom :: Float
|
||||
}
|
||||
| CharScrollParams
|
||||
= -- ZoomScrollParams
|
||||
-- { -- | a camera offset
|
||||
-- _opticPos :: Point2 -- this should be relative to the camera rotation
|
||||
-- -- then when the camera rotates when firing etc,
|
||||
-- -- this doesn't need to be changed
|
||||
-- , _opticZoom :: Float
|
||||
-- , _opticDefaultZoom :: Float
|
||||
-- }
|
||||
CharScrollParams
|
||||
{ _scrollChar :: Seq.Seq Char}
|
||||
deriving (Eq, Show, Read) --Generic, Flat)
|
||||
|
||||
|
||||
+5
-644
@@ -10,7 +10,7 @@ import Dodge.Inventory.Lock
|
||||
import Dodge.WorldEvent.Cloud
|
||||
import Dodge.LightSource
|
||||
import qualified SDL
|
||||
import Dodge.Base.You
|
||||
--import Dodge.Base.You
|
||||
import Dodge.Data.MuzzleEffect
|
||||
import ListHelp
|
||||
import Dodge.Data.ComposedItem
|
||||
@@ -43,313 +43,11 @@ import Sound.Data
|
||||
|
||||
heldEffect :: HeldMod -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
|
||||
heldEffect effecttype = case effecttype of
|
||||
-- HeldModNothing -> const $ const id
|
||||
-- PoisonSprayerMod -> gasEffect
|
||||
-- [ useAmmoAmount 1
|
||||
-- , withSoundForI foamSprayLoopS 5
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- FlameSpitterMod -> gasEffect
|
||||
-- [ withSidePushAfterI 20
|
||||
-- , withSidePushI 5
|
||||
-- , useAmmoAmount 1
|
||||
-- , withRandomItemParams f
|
||||
-- , repeatOnFrames [1 .. 9] FlameSpitterRepeatMod
|
||||
-- , lockInvFor 10
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- FlameSpitterRepeatMod -> gasEffect
|
||||
-- [ withSidePushAfterI 20
|
||||
-- , withSidePushI 5
|
||||
-- , useAmmoAmount 1
|
||||
-- , withRandomItemParams f
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- FlameThrowerMod -> gasEffect
|
||||
-- [ withSidePushAfterI 20
|
||||
-- , --, withTempLight 1 100 (V3 1 0 0)
|
||||
-- withSidePushI 5
|
||||
-- , useAmmoAmount 1
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- LauncherMod -> foldl' (&) usePjCreation
|
||||
-- --[ useAmmoAmount 1
|
||||
---- , withSoundStart tap4S
|
||||
-- [ useTimeCheck
|
||||
---- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- TeslaMod -> foldl' (&) (shootTeslaArc . _ldtValue)
|
||||
-- [ useAmmoAmount 1
|
||||
-- , withSoundForI elecCrackleS 1
|
||||
-- , withTempLight 1 100 (V3 0 0 1)
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- LasWideMod n -> foldl' (&) (shootLaser . _ldtValue)
|
||||
-- [ useAmmoAmount 1
|
||||
-- , withItem $ \it ->
|
||||
-- duplicateNumBarrels
|
||||
---- ( min
|
||||
---- (it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded)
|
||||
-- (it ^?! itParams . lasCycle `div` lasWideRate)
|
||||
---- )
|
||||
-- , withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
-- , withSoundForI tone440sawtoothquietS 2
|
||||
-- , withItemUpdateFirst (increasecycleLasWide n)
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- DualBeamMod -> foldl' (&) (shootDualLaser . _ldtValue)
|
||||
-- [ useAmmoAmount 1
|
||||
-- , withSoundForI tone440sawtoothquietS 2
|
||||
-- , withItem $ \it -> withCrPosShift (V2 0 (- thegapDualBeam it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8
|
||||
-- , withItem $ \it -> withCrPosShift (V2 0 (thegapDualBeam it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- LasMod -> foldl' (&) (shootLaser . _ldtValue)
|
||||
-- [ useAmmoAmount 1
|
||||
-- , withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
-- , withSoundForI tone440sawtoothquietS 2
|
||||
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- LauncherXMod _ -> foldl' (&) usePjCreationX
|
||||
-- --[ useAmmoAmount i
|
||||
-- --, withSoundStart tap4S
|
||||
-- [ useTimeCheck
|
||||
-- --, ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- ShatterMod -> foldl' (&) (shootShatter . _ldtValue)
|
||||
-- [ useAmmoAmount 1
|
||||
-- , -- , withSoundStart tap3S
|
||||
-- useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- BangCaneMod -> bulletGunEffect
|
||||
-- [ withFlare
|
||||
-- , withSmoke 1 black 20 200 5
|
||||
-- , withRecoil
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundStart tap3S
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- VolleyGunMod -> bulletGunEffect
|
||||
-- [ withRecoil
|
||||
-- , withFlare
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , useAllAmmo
|
||||
-- , withSoundItemChoiceStart caneStickSoundChoice
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- MultiGunMod -> bulletGunEffect
|
||||
-- [ withRecoil
|
||||
-- , withFlare
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , useAllAmmo
|
||||
-- , withSoundItemChoiceStart caneStickSoundChoice
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- AutoRifleMod -> bulletGunEffect
|
||||
-- -- note this is the same as BangCanemMod with the first changed
|
||||
-- [ withFlare
|
||||
-- , withSmoke 1 black 20 200 5
|
||||
-- , withRecoil
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundStart tap3S
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- BangRodMod -> bulletGunEffect
|
||||
-- [ withRecoil
|
||||
-- , withFlare
|
||||
-- , withThickSmokeI
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundStart bangEchoS
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- ElephantGunMod -> bulletGunEffect
|
||||
-- [ withRecoil
|
||||
-- , withFlare
|
||||
-- , withThickSmokeI
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundStart bangEchoS
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- AutoAmrMod -> bulletGunEffect
|
||||
-- [ withRecoil
|
||||
-- , withFlare
|
||||
-- , withThickSmokeI
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundStart bangEchoS
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI -- cf ElephantGun
|
||||
-- ]
|
||||
-- MachineGunMod -> bulletGunEffect
|
||||
-- [ withFlare
|
||||
-- , withThinSmokeI
|
||||
-- , withSoundStart bangEchoS
|
||||
-- , rateIncAB (torqueBeforeAtLeast 0.1 0.1) withTorqueAfter
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- BangStickMod -> bulletGunEffect
|
||||
-- [ withRecoil
|
||||
-- , useAllAmmo
|
||||
-- , withSoundItemChoiceStart bangStickSoundChoice
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , withFlare
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
PistolMod -> bulGunEffect
|
||||
-- AutoPistolMod -> bulletGunEffect
|
||||
-- [ withFlare
|
||||
-- , withSidePushI 50
|
||||
-- , withRecoil
|
||||
-- , withTorqueAfter
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withSoundStart tap3S
|
||||
-- , useAmmoAmount 1
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- MachinePistolMod -> bulletGunEffect
|
||||
-- [ withFlare
|
||||
-- , withRecoil
|
||||
-- , withSidePushI 50
|
||||
-- , withTorqueAfter
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withSoundStart tap1S
|
||||
-- , useAmmoAmount 1
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- BurstRifleMod -> bulletGunEffect
|
||||
-- [ withRecoil
|
||||
-- , withFlare
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundStart tap3S
|
||||
-- , repeatOnFrames [3, 6] BurstRifleRepeatMod
|
||||
-- , lockInvFor 7
|
||||
-- , sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- BurstRifleRepeatMod -> bulletGunEffect
|
||||
-- [ withRecoil
|
||||
-- , withFlare
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundStart tap3S
|
||||
-- , sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- MiniGunMod i -> bulletGunEffect
|
||||
-- [ duplicateNumBarrels 1
|
||||
-- , repeatTransformed
|
||||
-- [ (id, modcrpos x)
|
||||
-- | x <- map ((/ (fromIntegral i - 1)) . fromIntegral) [0 .. i -1]
|
||||
-- ]
|
||||
-- , afterRecoil (fromIntegral i * 5)
|
||||
-- , torqueBefore (fromIntegral i * 0.05)
|
||||
-- , withSidePushI (fromIntegral i * 25)
|
||||
-- , withMuzFlare
|
||||
-- , withSmoke 1 black 20 200 5
|
||||
-- , useAmmoAmount i
|
||||
-- , withSoundForI mini1S 2
|
||||
-- , withWarmUp crankSlowS
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- SmgMod -> bulletGunEffect
|
||||
-- [ withFlare
|
||||
-- , withSidePushI 30
|
||||
-- , withRecoil
|
||||
-- , withTorqueAfter
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withSoundStart tap3S
|
||||
-- , useAmmoAmount 1
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- BangConeMod -> bulletGunEffect
|
||||
-- [ withRandomItem coneRandItemParams
|
||||
-- , withRandomItemUpdate coneRandItemUpdate
|
||||
-- , withRandomOffset
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , duplicateLoaded
|
||||
-- , withMuzFlare
|
||||
-- , withRecoil
|
||||
-- , withTorqueAfter
|
||||
-- , useAllAmmo
|
||||
-- , withSoundStart bangEchoS
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- TractorMod -> foldl' (&) (aTractorBeam . _ldtValue) [ammoCheckI]
|
||||
FireRemoteShellMod -> undefined
|
||||
ExplodeRemoteShellMod -> undefined
|
||||
DoNothingMod -> const $ const id
|
||||
-- ForceFieldMod -> undefined
|
||||
DetectorMod _ -> undefined
|
||||
where
|
||||
-- f = do
|
||||
-- nzpres <- state $ randomR (3, 4)
|
||||
-- return $ sprayNozzles . ix 0 . nzPressure .~ nzpres
|
||||
-- increasecycleLasWide n it = case _heldHammer (_itUse it) of
|
||||
-- HammerUp -> it & itParams . lasCycle .~ 1
|
||||
-- _ -> it & itParams . lasCycle %~ (min (n * lasWideRate) . (+ 1))
|
||||
-- thegapDualBeam = _dbGap . _itParams
|
||||
--directedTelPos _ cr w = (p, a)
|
||||
-- where
|
||||
-- p = fromMaybe (_crPos cr) $ cr ^? crTargeting . ctPos . _Just
|
||||
-- a = argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- p)
|
||||
-- modcrpos x cr = fromMaybe cr $ do
|
||||
-- invid <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
-- return $ cr & crDir %~ tweenAngles x (_crOldDir cr)
|
||||
-- & crPos %~ alongSegBy x (_crOldPos cr)
|
||||
-- & crInv . ix (invid + 1) . itUse . amagParams . ampBullet . buDelayFraction .~ x
|
||||
|
||||
--gasEffect :: [(LabelDoubleTree ComposeLinkType Item
|
||||
-- -> Creature -> World -> World)
|
||||
-- -> LabelDoubleTree ComposeLinkType Item
|
||||
-- -> Creature
|
||||
-- -> World
|
||||
-- -> World]
|
||||
-- -> LabelDoubleTree ComposeLinkType Item
|
||||
-- -> Creature
|
||||
-- -> World
|
||||
-- -> World
|
||||
--gasEffect = foldl' (&) (overNozzles useGasParams)
|
||||
|
||||
bulGunEffect :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
|
||||
bulGunEffect = hammerCheck $ useTimeCheck bulGunEffect'
|
||||
@@ -420,7 +118,7 @@ applyTorqueCME :: Item -> Creature -> World -> World
|
||||
applyTorqueCME itm cr w
|
||||
| cid == 0 = w
|
||||
& wCam . camRot +~ rot
|
||||
& rotateScope
|
||||
-- & rotateScope
|
||||
& randGen .~ g
|
||||
| otherwise = w
|
||||
& cWorld . lWorld . creatures . ix cid . crDir +~ rot
|
||||
@@ -429,9 +127,9 @@ applyTorqueCME itm cr w
|
||||
cid = _crID cr
|
||||
(rot, g) = randomR (- torque, torque) $ _randGen w
|
||||
torque = fromMaybe 0 $ itm ^? itUse . heldParams . torqueAfter
|
||||
rotateScope = fromMaybe id $ do
|
||||
i <- yourScopeInvID w
|
||||
return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
||||
-- rotateScope = fromMaybe id $ do
|
||||
-- i <- yourScopeInvID w
|
||||
-- return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
||||
|
||||
|
||||
-- (Muzzle,Int,Int) = (muzzle, amountloaded, id of mag taken from)
|
||||
@@ -600,343 +298,6 @@ makeBullet thebullet itm cr mz w =
|
||||
Just x | x /= 0 -> fst . randomR (-x,x) $ _randGen w
|
||||
_ -> 0
|
||||
|
||||
--bulletGunEffect :: [(LabelDoubleTree ComposeLinkType Item
|
||||
-- -> Creature -> World -> World)
|
||||
-- -> LabelDoubleTree ComposeLinkType Item
|
||||
-- -> Creature
|
||||
-- -> World
|
||||
-- -> World]
|
||||
-- -> LabelDoubleTree ComposeLinkType Item
|
||||
-- -> Creature
|
||||
-- -> World
|
||||
-- -> World
|
||||
--bulletGunEffect = foldl' (&) shootBullet
|
||||
|
||||
useMod :: HeldMod ->
|
||||
[(LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World)
|
||||
-> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World]
|
||||
useMod hm = case hm of
|
||||
-- TractorMod -> undefined
|
||||
FireRemoteShellMod -> undefined
|
||||
ExplodeRemoteShellMod -> undefined
|
||||
DoNothingMod -> undefined
|
||||
-- ForceFieldMod -> undefined
|
||||
DetectorMod _ -> undefined
|
||||
-- HeldModNothing -> []
|
||||
-- PoisonSprayerMod ->
|
||||
-- [ useAmmoAmount 1
|
||||
-- , withSoundForI foamSprayLoopS 5
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- FlameSpitterMod ->
|
||||
-- [ withSidePushAfterI 20
|
||||
-- , withSidePushI 5
|
||||
-- , useAmmoAmount 1
|
||||
-- , withRandomItemParams f
|
||||
-- , repeatOnFrames [1 .. 9] FlameSpitterRepeatMod
|
||||
-- , lockInvFor 10
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- FlameSpitterRepeatMod ->
|
||||
-- [ withSidePushAfterI 20
|
||||
-- , withSidePushI 5
|
||||
-- , useAmmoAmount 1
|
||||
-- , withRandomItemParams f
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- FlameThrowerMod ->
|
||||
-- [ withSidePushAfterI 20
|
||||
-- , --, withTempLight 1 100 (V3 1 0 0)
|
||||
-- withSidePushI 5
|
||||
-- , useAmmoAmount 1
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- LauncherMod ->
|
||||
-- --[ useAmmoAmount 1
|
||||
---- , withSoundStart tap4S
|
||||
-- [ useTimeCheck
|
||||
---- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- TeslaMod ->
|
||||
-- [ useAmmoAmount 1
|
||||
-- , withSoundForI elecCrackleS 1
|
||||
-- , withTempLight 1 100 (V3 0 0 1)
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- CircleLaserMod ->
|
||||
-- [ duplicateItem fLasCircle
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundForI tone440sawtoothquietS 2
|
||||
-- , withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
-- , withItemUpdateFirst increasecycleLasCircle
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- LasWideMod n ->
|
||||
-- [ useAmmoAmount 1
|
||||
-- , withItem $ \it ->
|
||||
-- duplicateNumBarrels
|
||||
---- ( min
|
||||
---- (it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded)
|
||||
-- (it ^?! itParams . lasCycle `div` lasWideRate)
|
||||
---- )
|
||||
-- , withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
-- , withSoundForI tone440sawtoothquietS 2
|
||||
-- , withItemUpdateFirst (increasecycleLasWide n)
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- DualBeamMod ->
|
||||
-- [ useAmmoAmount 1
|
||||
-- , withSoundForI tone440sawtoothquietS 2
|
||||
-- , withItem $ \it -> withCrPosShift (V2 0 (- thegapDualBeam it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8
|
||||
-- , withItem $ \it -> withCrPosShift (V2 0 (thegapDualBeam it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- LasMod ->
|
||||
-- [ useAmmoAmount 1
|
||||
-- , withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
-- , withSoundForI tone440sawtoothquietS 2
|
||||
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- LauncherXMod _ ->
|
||||
-- --[ useAmmoAmount i
|
||||
-- --, withSoundStart tap4S
|
||||
-- [ useTimeCheck
|
||||
-- --, ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- ShatterMod ->
|
||||
-- [ useAmmoAmount 1
|
||||
-- , -- , withSoundStart tap3S
|
||||
-- useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- AmmoCheckMod -> [ammoCheckI]
|
||||
-- AmmoUseCheckMod -> [useAmmoAmount 1, useTimeCheck, ammoCheckI]
|
||||
-- AmmoHammerTimeUseOneMod ->
|
||||
-- [ useAmmoAmount 1
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- BangCaneMod ->
|
||||
-- [ withFlare
|
||||
-- , withSmoke 1 black 20 200 5
|
||||
-- , withRecoil
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundStart tap3S
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- VolleyGunMod ->
|
||||
-- [ withRecoil
|
||||
-- , withFlare
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , useAllAmmo
|
||||
-- , withSoundItemChoiceStart caneStickSoundChoice
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- MultiGunMod ->
|
||||
-- [ withRecoil
|
||||
-- , withFlare
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , useAllAmmo
|
||||
-- , withSoundItemChoiceStart caneStickSoundChoice
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- AutoRifleMod ->
|
||||
-- -- note this is the same as BangCanemMod with the first changed
|
||||
-- [ withFlare
|
||||
-- , withSmoke 1 black 20 200 5
|
||||
-- , withRecoil
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundStart tap3S
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- BangRodMod ->
|
||||
-- [ withRecoil
|
||||
-- , withFlare
|
||||
-- , withThickSmokeI
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundStart bangEchoS
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- ElephantGunMod ->
|
||||
-- [ withRecoil
|
||||
-- , withFlare
|
||||
-- , withThickSmokeI
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundStart bangEchoS
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- AutoAmrMod ->
|
||||
-- [ withRecoil
|
||||
-- , withFlare
|
||||
-- , withThickSmokeI
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundStart bangEchoS
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI -- cf ElephantGun
|
||||
-- ]
|
||||
-- MachineGunMod ->
|
||||
-- [ withFlare
|
||||
-- , withThinSmokeI
|
||||
-- , withSoundStart bangEchoS
|
||||
-- , rateIncAB (torqueBeforeAtLeast 0.1 0.1) withTorqueAfter
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- ModWithDirectedTeleport hm' ->
|
||||
-- reverse $ withPosDirWallCheck directedTelPos : useMod hm'
|
||||
-- BangStickMod ->
|
||||
-- [ withRecoil
|
||||
-- , useAllAmmo
|
||||
-- , withSoundItemChoiceStart bangStickSoundChoice
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withTorqueAfter
|
||||
-- , withFlare
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
PistolMod ->
|
||||
[ withSidePushI 50
|
||||
, withRecoil
|
||||
, withFlare
|
||||
, withTorqueAfter
|
||||
, duplicateLoadedBarrels
|
||||
, withSoundStart tap3S
|
||||
, useAmmoAmount 1
|
||||
, useTimeCheck
|
||||
, ammoCheckI
|
||||
, blCheck
|
||||
]
|
||||
-- MachinePistolMod ->
|
||||
-- [ withFlare
|
||||
-- , withRecoil
|
||||
-- , withSidePushI 50
|
||||
-- , withTorqueAfter
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withSoundStart tap1S
|
||||
-- , useAmmoAmount 1
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- BurstRifleMod ->
|
||||
-- [ withRecoil
|
||||
-- , withFlare
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundStart tap3S
|
||||
-- , repeatOnFrames [3, 6] BurstRifleRepeatMod
|
||||
-- , lockInvFor 7
|
||||
-- , sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
-- BurstRifleRepeatMod ->
|
||||
-- [ withRecoil
|
||||
-- , withFlare
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , useAmmoAmount 1
|
||||
-- , withSoundStart tap3S
|
||||
-- , sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- MiniGunMod i ->
|
||||
-- [ duplicateNumBarrels 1
|
||||
-- , repeatTransformed
|
||||
-- [ (id, modcrpos x)
|
||||
-- | x <- map ((/ (fromIntegral i - 1)) . fromIntegral) [0 .. i -1]
|
||||
-- ]
|
||||
-- , afterRecoil (fromIntegral i * 5)
|
||||
-- , torqueBefore (fromIntegral i * 0.05)
|
||||
-- , withSidePushI (fromIntegral i * 25)
|
||||
-- , withMuzFlare
|
||||
-- , withSmoke 1 black 20 200 5
|
||||
-- , useAmmoAmount i
|
||||
-- , withSoundForI mini1S 2
|
||||
-- , withWarmUp crankSlowS
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- SmgMod ->
|
||||
-- [ withFlare
|
||||
-- , withSidePushI 30
|
||||
-- , withRecoil
|
||||
-- , withTorqueAfter
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , withSoundStart tap3S
|
||||
-- , useAmmoAmount 1
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- ]
|
||||
-- BangConeMod ->
|
||||
-- [ withRandomItem coneRandItemParams
|
||||
-- , withRandomItemUpdate coneRandItemUpdate
|
||||
-- , withRandomOffset
|
||||
-- , duplicateLoadedBarrels
|
||||
-- , duplicateLoaded
|
||||
-- , withMuzFlare
|
||||
-- , withRecoil
|
||||
-- , withTorqueAfter
|
||||
-- , useAllAmmo
|
||||
-- , withSoundStart bangEchoS
|
||||
-- , useTimeCheck
|
||||
-- , ammoCheckI
|
||||
-- , blCheck
|
||||
-- ]
|
||||
where
|
||||
-- f = do
|
||||
-- nzpres <- state $ randomR (3, 4)
|
||||
-- return $ sprayNozzles . ix 0 . nzPressure .~ nzpres
|
||||
--increasecycleLasCircle it = it & itParams . lasCycle %~ (flip mod 2000 . (+ 1))
|
||||
----f it = [it & itParams . lasCycle +~ x | x <- [0,100 .. 1900] ]
|
||||
--fLasCircle it = [it & itParams . lasCycle +~ x | x <- [0, 50 .. 1999]]
|
||||
-- increasecycleLasWide n it = case _heldHammer (_itUse it) of
|
||||
-- HammerUp -> it & itParams . lasCycle .~ 1
|
||||
-- _ -> it & itParams . lasCycle %~ (min (n * lasWideRate) . (+ 1))
|
||||
-- thegapDualBeam = _dbGap . _itParams
|
||||
--directedTelPos _ cr w = (p, a)
|
||||
-- where
|
||||
-- p = fromMaybe (_crPos cr) $ cr ^? crTargeting . ctPos . _Just
|
||||
-- a = argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- p)
|
||||
-- modcrpos x cr = fromMaybe cr $ do
|
||||
-- invid <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
-- return $ cr & crDir %~ tweenAngles x (_crOldDir cr)
|
||||
-- & crPos %~ alongSegBy x (_crOldPos cr)
|
||||
-- & crInv . ix (invid + 1) . itUse . amagParams . ampBullet . buDelayFraction .~ x
|
||||
|
||||
lasWideRate :: Int
|
||||
lasWideRate = 2
|
||||
|
||||
mcUseHeld :: HeldItemType -> Item -> Machine -> World -> World
|
||||
mcUseHeld hit = case hit of
|
||||
LASGUN -> mcShootLaser
|
||||
|
||||
@@ -12,7 +12,8 @@ zoomScope :: Item
|
||||
zoomScope =
|
||||
defaultHeldItem
|
||||
& itType . iyBase .~ ATTACH (SCROLLATTACH ZOOMSCOPE)
|
||||
& itUse .~ AttachUse (ScrollAttachParams (ZoomScrollParams{_opticPos = 0, _opticZoom = 1, _opticDefaultZoom = 0.5}))
|
||||
-- & itUse .~ AttachUse (ScrollAttachParams (ZoomScrollParams{_opticPos = 0, _opticZoom = 1, _opticDefaultZoom = 0.5}))
|
||||
& itScope .~ OpticScope{_opticPos = 0, _opticZoom = 1, _opticDefaultZoom = 0.5}
|
||||
|
||||
targetingScope :: TargetType -> Item
|
||||
targetingScope tt =
|
||||
|
||||
@@ -19,10 +19,10 @@ module Dodge.Item.Weapon.TriggerType (
|
||||
withItemUpdate,
|
||||
withItemUpdateFirst,
|
||||
-- rateIncAB,
|
||||
torqueBefore,
|
||||
torqueBeforeAtLeast,
|
||||
withTorqueAfter,
|
||||
torqueSideEffect,
|
||||
-- torqueBefore,
|
||||
-- torqueBeforeAtLeast,
|
||||
-- withTorqueAfter,
|
||||
-- torqueSideEffect,
|
||||
withRandomItemParams,
|
||||
withRandomItem,
|
||||
withRandomItemUpdate,
|
||||
@@ -582,76 +582,76 @@ withRandomOffset f item cr w = f item (cr & crPos %~ (+.+ offV)) $ set randGen g
|
||||
offV = rotateV (_crDir cr) (V2 0 offsetVal)
|
||||
offsetAmount = fromMaybe 0 $ item ^? ldtValue . itUse . heldParams . randomOffset
|
||||
|
||||
-- | Rotates a creature
|
||||
torqueBefore ::
|
||||
-- | Max possible rotation
|
||||
Float ->
|
||||
ChainEffect
|
||||
torqueBefore torque feff item cr w
|
||||
| cid == 0 =
|
||||
feff item (cr & crDir +~ rot) $
|
||||
w
|
||||
& randGen .~ g
|
||||
& cWorld . lWorld . creatures . ix cid . crDir +~ rot
|
||||
& wCam . camRot +~ rot
|
||||
& rotateScope
|
||||
| otherwise = feff item cr $ set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ rot) w
|
||||
where
|
||||
cid = _crID cr
|
||||
(rot, g) = randomR (- torque, torque) $ _randGen w
|
||||
rotateScope = fromMaybe id $ do
|
||||
i <- yourScopeInvID w
|
||||
return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
||||
---- | Rotates a creature
|
||||
--torqueBefore ::
|
||||
-- -- | Max possible rotation
|
||||
-- Float ->
|
||||
-- ChainEffect
|
||||
--torqueBefore torque feff item cr w
|
||||
-- | cid == 0 =
|
||||
-- feff item (cr & crDir +~ rot) $
|
||||
-- w
|
||||
-- & randGen .~ g
|
||||
-- & cWorld . lWorld . creatures . ix cid . crDir +~ rot
|
||||
-- & wCam . camRot +~ rot
|
||||
-- & rotateScope
|
||||
-- | otherwise = feff item cr $ set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ rot) w
|
||||
-- where
|
||||
-- cid = _crID cr
|
||||
-- (rot, g) = randomR (- torque, torque) $ _randGen w
|
||||
-- rotateScope = fromMaybe id $ do
|
||||
-- i <- yourScopeInvID w
|
||||
-- return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
||||
|
||||
{- | Rotates a creature with minimum rotation
|
||||
Rotates the player creature before applying the effect, other creatures after.
|
||||
-}
|
||||
torqueBeforeAtLeast ::
|
||||
-- | Minimal possible rotation
|
||||
Float ->
|
||||
-- | Extra possible rotation
|
||||
Float ->
|
||||
ChainEffect
|
||||
torqueBeforeAtLeast minTorque exTorque feff item cr w
|
||||
| cid == 0 =
|
||||
feff item (cr & crDir +~ rot') $
|
||||
w
|
||||
& randGen .~ g
|
||||
& cWorld . lWorld . creatures . ix cid . crDir +~ rot'
|
||||
& wCam . camRot +~ rot'
|
||||
& rotateScope
|
||||
| otherwise = feff item cr $ set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ rot') w
|
||||
where
|
||||
cid = _crID cr
|
||||
(rot, g) = randomR (- exTorque, exTorque) $ _randGen w
|
||||
rot'
|
||||
| rot < 0 = rot - minTorque
|
||||
| otherwise = rot + minTorque
|
||||
rotateScope = fromMaybe id $ do
|
||||
i <- yourScopeInvID w
|
||||
return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
||||
--{- | Rotates a creature with minimum rotation
|
||||
-- Rotates the player creature before applying the effect, other creatures after.
|
||||
---}
|
||||
--torqueBeforeAtLeast ::
|
||||
-- -- | Minimal possible rotation
|
||||
-- Float ->
|
||||
-- -- | Extra possible rotation
|
||||
-- Float ->
|
||||
-- ChainEffect
|
||||
--torqueBeforeAtLeast minTorque exTorque feff item cr w
|
||||
-- | cid == 0 =
|
||||
-- feff item (cr & crDir +~ rot') $
|
||||
-- w
|
||||
-- & randGen .~ g
|
||||
-- & cWorld . lWorld . creatures . ix cid . crDir +~ rot'
|
||||
-- & wCam . camRot +~ rot'
|
||||
-- & rotateScope
|
||||
-- | otherwise = feff item cr $ set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ rot') w
|
||||
-- where
|
||||
-- cid = _crID cr
|
||||
-- (rot, g) = randomR (- exTorque, exTorque) $ _randGen w
|
||||
-- rot'
|
||||
-- | rot < 0 = rot - minTorque
|
||||
-- | otherwise = rot + minTorque
|
||||
-- rotateScope = fromMaybe id $ do
|
||||
-- i <- yourScopeInvID w
|
||||
-- return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
||||
|
||||
-- | Rotate a randomly creature after applying an effect.
|
||||
withTorqueAfter :: ChainEffect
|
||||
withTorqueAfter feff item cr w
|
||||
-- | cid == 0 = rotateScope . set randGen g $ over (wCam . camRot) (+ rot) $ feff item cr w
|
||||
-- | otherwise = set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ rot) $ feff item cr w
|
||||
| cid == 0 = w
|
||||
& feff item cr
|
||||
& wCam . camRot +~ rot
|
||||
& rotateScope
|
||||
& randGen .~ g
|
||||
| otherwise = w
|
||||
& cWorld . lWorld . creatures . ix cid . crDir +~ rot
|
||||
& randGen .~ g
|
||||
where
|
||||
cid = _crID cr
|
||||
(rot, g) = randomR (- torque, torque) $ _randGen w
|
||||
torque = fromMaybe 0 $ item ^? ldtValue . itUse . heldParams . torqueAfter
|
||||
rotateScope = fromMaybe id $ do
|
||||
i <- yourScopeInvID w
|
||||
return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
||||
-- rotateScope = pointerYourItem . itScope . scopePos %~ rotateV rot
|
||||
---- | Rotate a randomly creature after applying an effect.
|
||||
--withTorqueAfter :: ChainEffect
|
||||
--withTorqueAfter feff item cr w
|
||||
---- | cid == 0 = rotateScope . set randGen g $ over (wCam . camRot) (+ rot) $ feff item cr w
|
||||
---- | otherwise = set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ rot) $ feff item cr w
|
||||
-- | cid == 0 = w
|
||||
-- & feff item cr
|
||||
-- & wCam . camRot +~ rot
|
||||
-- & rotateScope
|
||||
-- & randGen .~ g
|
||||
-- | otherwise = w
|
||||
-- & cWorld . lWorld . creatures . ix cid . crDir +~ rot
|
||||
-- & randGen .~ g
|
||||
-- where
|
||||
-- cid = _crID cr
|
||||
-- (rot, g) = randomR (- torque, torque) $ _randGen w
|
||||
-- torque = fromMaybe 0 $ item ^? ldtValue . itUse . heldParams . torqueAfter
|
||||
-- rotateScope = fromMaybe id $ do
|
||||
-- i <- yourScopeInvID w
|
||||
-- return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
||||
---- rotateScope = pointerYourItem . itScope . scopePos %~ rotateV rot
|
||||
|
||||
sideEffectOnFrame ::
|
||||
Int ->
|
||||
@@ -661,16 +661,16 @@ sideEffectOnFrame i sf f it cr w =
|
||||
f it cr w
|
||||
& cWorld . lWorld . delayedEvents .:~ (i, sf (_ldtValue it) cr)
|
||||
|
||||
torqueSideEffect :: Float -> Item -> Creature -> World -> World
|
||||
torqueSideEffect torque _ cr w
|
||||
| cid == 0 = set randGen g . rotateScope $ over (wCam . camRot) (+ rot) w
|
||||
| otherwise = set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ rot) w
|
||||
where
|
||||
cid = _crID cr
|
||||
(rot, g) = randomR (- torque, torque) $ _randGen w
|
||||
rotateScope = fromMaybe id $ do
|
||||
i <- yourScopeInvID w
|
||||
return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
||||
--torqueSideEffect :: Float -> Item -> Creature -> World -> World
|
||||
--torqueSideEffect torque _ cr w
|
||||
-- | cid == 0 = set randGen g . rotateScope $ over (wCam . camRot) (+ rot) w
|
||||
-- | otherwise = set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ rot) w
|
||||
-- where
|
||||
-- cid = _crID cr
|
||||
-- (rot, g) = randomR (- torque, torque) $ _randGen w
|
||||
-- rotateScope = fromMaybe id $ do
|
||||
-- i <- yourScopeInvID w
|
||||
-- return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
||||
|
||||
-- pump the updated creature into the chain in later frames
|
||||
repeatOnFrames :: [Int] -> HeldMod -> ChainEffect
|
||||
|
||||
+17
-15
@@ -94,19 +94,21 @@ moveZoomCamera cfig theinput cr campos =
|
||||
mscopeoffset = do
|
||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
(cr ^? crInv . ix (i - 1) . itUse . attachParams . scrollAttachParams . opticPos)
|
||||
--(cr ^? crInv . ix (i - 1) . itUse . attachParams . scrollAttachParams . opticPos)
|
||||
(fmap (rotateV camrot) (cr ^? crInv . ix i . itScope . opticPos))
|
||||
<|> (cr ^? crInv . ix i . itScope . remotePos)
|
||||
camrot = campos ^. camRot
|
||||
newcen = _crPos cr +.+ fromMaybe (V2 0 0) mscopeoffset +.+ offset
|
||||
offset =
|
||||
rotateV (campos ^. camRot) $
|
||||
((newzoom - newDefaultZoom) / (newDefaultZoom * newzoom)) *.* _mousePos theinput
|
||||
newzoom = fromMaybe (newDefaultZoom * newItemZoom) $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
(cr ^? crInv . ix (i - 1) . itUse . attachParams . scrollAttachParams . opticZoom)
|
||||
(cr ^? crInv . ix i . itScope . opticZoom)
|
||||
idealDefaultZoom = clipZoom wallZoom
|
||||
newDefaultZoom = fromMaybe (changeZoom (campos ^. camDefaultZoom) idealDefaultZoom) $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
(cr ^? crInv . ix (i - 1) . itUse . attachParams . scrollAttachParams . opticZoom)
|
||||
(cr ^? crInv . ix i . itScope . opticZoom)
|
||||
idealItemZoom = fromMaybe 1 $ do
|
||||
guard $ crIsAiming cr
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
@@ -130,7 +132,8 @@ moveZoomCamera cfig theinput cr campos =
|
||||
-- is wanted
|
||||
updateScopeZoom :: World -> World
|
||||
updateScopeZoom w = fromMaybe w $ do
|
||||
i <- yourScopeInvID w
|
||||
--i <- yourScopeInvID w
|
||||
i <- you w ^? crManipulation . manObject . inInventory . ispItem
|
||||
return $ updateScopeZoom' i w
|
||||
|
||||
updateScopeZoom' :: Int -> World -> World
|
||||
@@ -139,12 +142,13 @@ updateScopeZoom' i w
|
||||
w & wppointer %~ doScopeZoom (w ^. input . smoothScrollAmount) mp
|
||||
| otherwise = w & wppointer %~ resetscope
|
||||
where
|
||||
wppointer = cWorld . lWorld . creatures . ix 0 . crInv . ix i . itUse . attachParams . scrollAttachParams
|
||||
resetscope (ZoomScrollParams _ _ defz) = ZoomScrollParams (V2 0 0) defz defz
|
||||
wppointer = cWorld . lWorld . creatures . ix 0 . crInv . ix i . itScope
|
||||
resetscope (OpticScope _ _ defz) = OpticScope (V2 0 0) defz defz
|
||||
resetscope otherAtt = otherAtt
|
||||
mp = rotateV (w ^. wCam . camRot) $ _mousePos (_input w)
|
||||
--mp = rotateV (w ^. wCam . camRot) $ _mousePos (_input w)
|
||||
mp = _mousePos (_input w)
|
||||
|
||||
doScopeZoom :: Int -> Point2 -> ScrollAttachParams -> ScrollAttachParams
|
||||
doScopeZoom :: Int -> Point2 -> Scope -> Scope
|
||||
doScopeZoom scrollamount mp sc = case scrollamount of
|
||||
x
|
||||
| x > 10 -> (zoomInLongGun mp . zoomInLongGun mp . zoomInLongGun mp) sc
|
||||
@@ -158,7 +162,7 @@ doScopeZoom scrollamount mp sc = case scrollamount of
|
||||
zoomSpeed :: Float
|
||||
zoomSpeed = 39 / 40
|
||||
|
||||
zoomInLongGun :: Point2 -> ScrollAttachParams -> ScrollAttachParams
|
||||
zoomInLongGun :: Point2 -> Scope -> Scope
|
||||
zoomInLongGun mousep sc = fromMaybe sc $ do
|
||||
curzoom <- sc ^? opticZoom
|
||||
guard $ curzoom < 8
|
||||
@@ -166,7 +170,7 @@ zoomInLongGun mousep sc = fromMaybe sc $ do
|
||||
sc & opticPos .+.+~ (1 - zoomSpeed) * zoomSpeed / curzoom *.* mousep
|
||||
& opticZoom %~ (/ zoomSpeed)
|
||||
|
||||
zoomOutLongGun :: ScrollAttachParams -> ScrollAttachParams
|
||||
zoomOutLongGun :: Scope -> Scope
|
||||
zoomOutLongGun sc = fromMaybe sc $ do
|
||||
curzoom <- sc ^? opticZoom
|
||||
guard $ curzoom > 0.5
|
||||
@@ -206,15 +210,13 @@ rotateCameraBy :: Float -> World -> World
|
||||
rotateCameraBy x w =
|
||||
w
|
||||
& wCam . camRot +~ x
|
||||
& cWorld %~ rotateanyscope
|
||||
-- & cWorld %~ rotateanyscope
|
||||
where
|
||||
rotateanyscope = fromMaybe id $ do
|
||||
i <- w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . inInventory . ispItem
|
||||
return $
|
||||
lWorld . creatures . ix 0 . crInv . ix (i - 1)
|
||||
. itUse
|
||||
. attachParams
|
||||
. scrollAttachParams
|
||||
lWorld . creatures . ix 0 . crInv . ix i
|
||||
. itScope
|
||||
. opticPos
|
||||
%~ rotateV x
|
||||
|
||||
|
||||
Reference in New Issue
Block a user