Start implementing attachable scroll items
This commit is contained in:
@@ -17,5 +17,5 @@ beltMag = tinMag & itType . iyBase .~ AMMO BULLETBELT
|
||||
zoomScope :: Item
|
||||
zoomScope = tinMag
|
||||
& itType . iyBase .~ ATTACH ZOOMSCOPE
|
||||
& itUse .~ AttachUse ZoomScopeParams
|
||||
& itUse .~ AttachUse (ScrollAttachParams (ZoomScrollParams {_opticPos = 0, _opticZoom = 1, _opticDefaultZoom = 0.5}))
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ showReloadProgress cr itm = case ic ^? laSource of
|
||||
Just (InternalSource ia) -> case ia ^? iaProgress . _Just . ix 0 of
|
||||
Nothing -> maybe "" show $ ic ^? laSource . _InternalSource . iaLoaded
|
||||
Just la -> showLoadActionType la (_laSource ic)
|
||||
Just AboveSource -> fromMaybe "||||" $ do
|
||||
Just AboveSource -> fromMaybe "^^^^" $ do
|
||||
i <- fmap (subtract 1) $ itm ^? itLocation . ipInvID
|
||||
_ <- cr ^? crInv . ix i . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||
return ""
|
||||
|
||||
@@ -59,7 +59,7 @@ remoteLauncher =
|
||||
launcher
|
||||
& itType . iyBase .~ HELD REMOTELAUNCHER
|
||||
& itUse . heldUse .~ HeldFireRemoteShell --fireRemoteShell
|
||||
& itScope .~ RemoteScope (V2 0 0) 1 True
|
||||
& itScope .~ RemoteScope (V2 0 0) 1
|
||||
& itUse . heldConsumption . laAmmoType . amPjDraw .~ DrawRemoteShell
|
||||
|
||||
basicAmPjMoves :: IM.IntMap TweakParam
|
||||
|
||||
@@ -68,12 +68,12 @@ sniperRifle =
|
||||
& itType . iyBase .~ HELD SNIPERRIFLE
|
||||
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5,_izFac = 1}
|
||||
& itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
|
||||
& itScope .~ ZoomScope
|
||||
{ _scopePos = (V2 0 0)
|
||||
, _scopeZoom = 1
|
||||
, _scopeDefaultZoom = 0.5
|
||||
}
|
||||
-- & itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
|
||||
-- & itScope .~ ZoomScope
|
||||
-- { _scopePos = (V2 0 0)
|
||||
-- , _scopeZoom = 1
|
||||
-- , _scopeDefaultZoom = 0.5
|
||||
-- }
|
||||
& itType . iyModules . at ModTarget ?~ TARGET TargetLaser
|
||||
-- & itUse . useTargeting ?~ TargetLaser
|
||||
|
||||
|
||||
@@ -26,16 +26,16 @@ latchkey _ = defaultHeldItem
|
||||
binoculars :: Item
|
||||
binoculars =
|
||||
defaultHeldItem
|
||||
& itScope .~ ZoomScope
|
||||
{ _scopePos = (V2 0 0)
|
||||
, _scopeZoom = 1
|
||||
, _scopeDefaultZoom = 0.5
|
||||
}
|
||||
-- & itScope .~ ZoomScope
|
||||
-- { _scopePos = (V2 0 0)
|
||||
-- , _scopeZoom = 1
|
||||
-- , _scopeDefaultZoom = 0.5
|
||||
-- }
|
||||
& itType . iyBase .~ HELD BINOCULARS
|
||||
-- & itUse . heldAim . aimHandlePos .~ 5
|
||||
-- & itUse . heldAim . aimMuzPos .~ 10
|
||||
& itUse . heldAim . aimStance .~ TwoHandFlat
|
||||
& itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
|
||||
-- & itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 0.5, _izMin = 0.5, _izFac = 1}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
module Dodge.Item.Weapon.Remote (
|
||||
setRemoteScope,
|
||||
setRemoteBombScope,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
@@ -8,22 +7,12 @@ import Dodge.Data.World
|
||||
import Dodge.Default
|
||||
import Geometry
|
||||
|
||||
setRemoteBombScope :: Int -> Prop -> World -> World
|
||||
setRemoteBombScope itid pj w = case w ^?! cWorld . lWorld . itemLocations . ix itid of
|
||||
InInv cid invid ->
|
||||
w
|
||||
& cWorld . lWorld . creatures . ix cid . crInv . ix invid . itScope
|
||||
. scopePos
|
||||
.~ (_prPos pj -.- (w ^?! cWorld . lWorld . creatures . ix cid . crPos))
|
||||
& cWorld . lWorld . creatures . ix cid . crInv . ix invid . itUse . heldAim . aimZoom
|
||||
.~ (defaultItZoom{_izMax = 0.5, _izMin = 0.5})
|
||||
_ -> w
|
||||
|
||||
setRemoteScope :: Int -> Point2 -> World -> World
|
||||
setRemoteScope itid pos w = case w ^? cWorld . lWorld . itemLocations . ix itid of
|
||||
Just (InInv cid' invid) ->
|
||||
w
|
||||
& cWorld . lWorld . creatures . ix cid' . crInv . ix invid . itScope
|
||||
. scopePos
|
||||
. remotePos
|
||||
.~ (pos -.- (w ^?! cWorld . lWorld . creatures . ix cid' . crPos))
|
||||
_ -> w
|
||||
|
||||
@@ -361,7 +361,7 @@ useAmmoUpTo amAmount eff item cr =
|
||||
useAmmoAmount :: Int -> ChainEffect
|
||||
useAmmoAmount amAmount eff item cr =
|
||||
eff item cr
|
||||
. (cWorld . lWorld . creatures . ix (_crID cr) . crInv %~ useAmmoAmount' itref amAmount) -- . _InternalSource . iaLoaded -~ amAmount)
|
||||
. (cWorld . lWorld . creatures . ix (_crID cr) . crInv %~ useAmmoAmount' itref amAmount)
|
||||
where
|
||||
itref = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||
|
||||
@@ -371,6 +371,12 @@ useAmmoAmount' itref x inv = case inv ^? ix itref . itUse . heldConsumption . la
|
||||
inv & ix itref . itUse . heldConsumption . laSource . _InternalSource . iaLoaded -~ x
|
||||
Just AboveSource ->
|
||||
inv & ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
||||
Just BelowSource ->
|
||||
inv & ix (itref + 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
||||
Just EitherSource -> case inv ^? ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount of
|
||||
Just amamount | amamount > 0 ->
|
||||
inv & ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
||||
_ -> inv & ix (itref + 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
||||
_ -> inv
|
||||
|
||||
-- . crInv . ix itRef . itUse . heldConsumption . laSource
|
||||
@@ -615,8 +621,8 @@ withTorqueAfter feff item cr w
|
||||
(rot, g) = randomR (- torque, torque) $ _randGen w
|
||||
torque = fromMaybe 0 $ item ^? itParams . torqueAfter
|
||||
|
||||
--rotateScope = cWorld . lWorld . creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
|
||||
rotateScope = pointerYourItem . itScope . scopePos %~ rotateV rot
|
||||
rotateScope = id
|
||||
-- rotateScope = pointerYourItem . itScope . scopePos %~ rotateV rot
|
||||
|
||||
sideEffectOnFrame ::
|
||||
Int ->
|
||||
|
||||
Reference in New Issue
Block a user