Held item rclick use, tweak reload on lclick
This commit is contained in:
@@ -3,7 +3,7 @@ module Dodge.Item.Weapon.BatteryGuns (
|
||||
flameBeamCombine,
|
||||
teslaBeamCombine,
|
||||
splitBeamCombine,
|
||||
-- shootTeslaArc,
|
||||
-- shootTeslaArc,
|
||||
shootLaser,
|
||||
circleLaser,
|
||||
shootDualLaser,
|
||||
@@ -22,8 +22,6 @@ import Picture
|
||||
|
||||
--import Control.Monad.State
|
||||
|
||||
|
||||
|
||||
--lasPulse :: Item
|
||||
--lasPulse = lasGun
|
||||
-- & itType . iyBase .~ LASPULSE
|
||||
@@ -42,8 +40,6 @@ import Picture
|
||||
-- & itParams . lasColor .~ frac it * orange
|
||||
-- frac it = 0.5 * (1 + sin (pi * fromIntegral (_lasCycle $ _itParams it) * 0.1))
|
||||
|
||||
|
||||
|
||||
--lasWidePulse :: Item
|
||||
--lasWidePulse = lasGun
|
||||
-- & itType . iyBase .~ LASGUNWIDEPULSE
|
||||
@@ -109,7 +105,6 @@ import Picture
|
||||
-- n' = 9 * n
|
||||
-- xs = [ 0.25 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
|
||||
|
||||
|
||||
--lasSwing :: Item
|
||||
--lasSwing = lasGun
|
||||
-- & itType . iyBase .~ LASGUNSWING
|
||||
@@ -129,16 +124,15 @@ import Picture
|
||||
-- y = 15 * sin (pi * fromIntegral x' * 0.01)
|
||||
-- x' = _lasCycle $ _itParams it
|
||||
|
||||
|
||||
|
||||
shootLaser :: Item -> Creature -> World -> World
|
||||
shootLaser it cr = cWorld . lWorld . lasers .:~ lasRayAt (_lasColor $ _itParams it) dam phasev pos dir
|
||||
where
|
||||
pos = _crPos cr
|
||||
dir = _crDir cr
|
||||
phasev = _phaseV . _itParams $ _crInv cr IM.! itRef
|
||||
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||
dam = _lasDamage $ _itParams it
|
||||
shootLaser it cr =
|
||||
cWorld . lWorld . lasers
|
||||
.:~ lasRayAt
|
||||
(_lasColor $ _itParams it)
|
||||
(_lasDamage $ _itParams it)
|
||||
(_phaseV $ _itParams it)
|
||||
(_crPos cr)
|
||||
(_crDir cr)
|
||||
|
||||
-- this has the feel of a left click item
|
||||
circleLaser :: Item -> Creature -> World -> World
|
||||
|
||||
@@ -9,16 +9,15 @@ module Dodge.Item.Weapon.TriggerType (
|
||||
useAmmoUpTo,
|
||||
lockInvFor,
|
||||
withMuzFlareI,
|
||||
withMuzPos,
|
||||
withMuzPosShift,
|
||||
crAtMuzPos,
|
||||
withCrPos,
|
||||
withCrPosShift,
|
||||
withOldDir,
|
||||
trigDoAlso,
|
||||
trigDoAlso',
|
||||
withTempLight,
|
||||
withItem,
|
||||
withItemUpdate,
|
||||
withItemUpdate',
|
||||
withItemUpdateFirst,
|
||||
rateIncAB,
|
||||
torqueBefore,
|
||||
torqueBeforeAtLeast,
|
||||
@@ -48,6 +47,7 @@ module Dodge.Item.Weapon.TriggerType (
|
||||
sideEffectOnFrame,
|
||||
duplicateItem,
|
||||
duplicateLoadedBarrels,
|
||||
duplicateNumBarrels,
|
||||
duplicateLoaded,
|
||||
duplicateOffsetsV2,
|
||||
duplicateOffsetsFocus,
|
||||
@@ -429,8 +429,8 @@ withItem :: (Item -> ChainEffect) -> ChainEffect
|
||||
withItem g f it = g it f it
|
||||
|
||||
-- not ideal
|
||||
withItemUpdate' :: (Item -> Item) -> ChainEffect
|
||||
withItemUpdate' up f it cr = f (up it) cr . (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itRef %~ up)
|
||||
withItemUpdateFirst :: (Item -> Item) -> ChainEffect
|
||||
withItemUpdateFirst up f it cr = f (up it) cr . (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itRef %~ up)
|
||||
where
|
||||
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||
|
||||
@@ -475,23 +475,13 @@ withMuzFlareI f it cr w =
|
||||
-- | crInAimStance OneHand cr = 10
|
||||
-- | otherwise = 0
|
||||
|
||||
withMuzPos :: (Point3 -> World -> World) -> ChainEffect
|
||||
withMuzPos = withMuzPosShift (V2 0 0)
|
||||
withCrPos :: (Point3 -> World -> World) -> ChainEffect
|
||||
withCrPos = withCrPosShift (V2 0 0)
|
||||
|
||||
withMuzPosShift :: Point2 -> (Point3 -> World -> World) -> ChainEffect
|
||||
withMuzPosShift p g f it cr = g thepos . f it cr
|
||||
withCrPosShift :: Point2 -> (Point3 -> World -> World) -> ChainEffect
|
||||
withCrPosShift p g f it cr = g thepos . f it cr
|
||||
where
|
||||
thepos = (_crPos cr `v2z` 20)
|
||||
--thepos = (pos `v2z` 20)
|
||||
--pos =
|
||||
-- _crPos cr
|
||||
-- +.+ rotateV dir p
|
||||
-- +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir
|
||||
--dir = _crDir cr
|
||||
|
||||
crAtMuzPos :: ChainEffect
|
||||
--crAtMuzPos f it cr = f it (cr & crPos +.+.~ (aimingMuzzlePos cr it *.* unitVectorAtAngle (_crDir cr)))
|
||||
crAtMuzPos f it cr = f it cr
|
||||
thepos = (_crPos cr +.+ rotateV (_crDir cr) p) `v2z` 20
|
||||
|
||||
-- | Applies the effect to a randomly rotated creature.
|
||||
withRandomDirI ::
|
||||
@@ -641,14 +631,13 @@ duplicateLoaded eff it cr w = foldr f w [1 .. numBul]
|
||||
f _ = eff it cr
|
||||
numBul = it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
|
||||
duplicateLoadedBarrels :: ChainEffect
|
||||
duplicateLoadedBarrels eff itm cr w = foldr f w (take numbul $ itm ^?! itUse . heldAim . aimMuzzles)
|
||||
duplicateNumBarrels :: Int -> ChainEffect
|
||||
duplicateNumBarrels n eff itm cr w = foldr f w (take n $ itm ^?! itUse . heldAim . aimMuzzles)
|
||||
where
|
||||
numbul = itm ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
f brl w' =
|
||||
eff
|
||||
itm
|
||||
( cr & crPos +~ (rotateV (_crDir cr) (_mzPos brl))
|
||||
( cr & crPos +~ rotateV (_crDir cr) (_mzPos brl)
|
||||
& crDir +~ (_mzRot brl + a)
|
||||
)
|
||||
(w' & randGen .~ g)
|
||||
@@ -656,6 +645,11 @@ duplicateLoadedBarrels eff itm cr w = foldr f w (take numbul $ itm ^?! itUse . h
|
||||
inacc = _mzInaccuracy brl
|
||||
(a,g) = randomR (-inacc,inacc) $ _randGen w'
|
||||
|
||||
duplicateLoadedBarrels :: ChainEffect
|
||||
duplicateLoadedBarrels eff itm = duplicateNumBarrels numbul eff itm
|
||||
where
|
||||
numbul = itm ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
|
||||
duplicateOffsetsFocus :: [Float] -> ChainEffect
|
||||
duplicateOffsetsFocus xs eff item cr w = foldr f w poss
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user