Remove functions from left use item use field
This commit is contained in:
@@ -3,6 +3,7 @@ module Dodge.Creature.Impulse.UseItem
|
||||
, useLeftItem
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Luse
|
||||
import Dodge.Inventory
|
||||
import Dodge.Reloading
|
||||
import Dodge.Item.Location
|
||||
@@ -104,7 +105,7 @@ useLeftItem cid w
|
||||
f <- cr ^? crInv . ix invid . itUse . lUse
|
||||
return
|
||||
. (runIdentity . pointToItem (_itPos itm) (return . (itUse . useHammer .~ HammerDown)))
|
||||
. f itm cr
|
||||
. useL f itm cr
|
||||
$ w
|
||||
where
|
||||
cr = _creatures w IM.! cid
|
||||
|
||||
+1
-1
@@ -410,7 +410,7 @@ data ItemUse
|
||||
, _heldScroll :: HeldScroll --Float -> Creature -> Item -> Item
|
||||
}
|
||||
| LeftUse
|
||||
{ _lUse :: Item -> Creature -> World -> World
|
||||
{ _lUse :: Luse --Item -> Creature -> World -> World
|
||||
, _useDelay :: UseDelay
|
||||
, _useHammer :: HammerPosition
|
||||
, _eqEq :: Equipment
|
||||
|
||||
@@ -18,6 +18,13 @@ data HeldUse = HeldDoNothing
|
||||
| HeldForceField
|
||||
| HeldShatter
|
||||
|
||||
data Luse = LDoNothing
|
||||
| LRewind
|
||||
| LShrink
|
||||
| LBlink
|
||||
| LUnsafeBlink
|
||||
| LBoost
|
||||
|
||||
data HeldMod = HeldModNothing
|
||||
| PoisonSprayerMod
|
||||
| FlameSpitterMod
|
||||
|
||||
@@ -28,35 +28,6 @@ defaultBulletLoadable = defaultLoadable & laAmmoType .~ basicBullet
|
||||
defaultChargeable :: ItemConsumption
|
||||
defaultChargeable = ChargeableAmmo 100 100
|
||||
|
||||
--ruseRate :: Int
|
||||
-- -> (Item -> Creature -> World -> World)
|
||||
-- -> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
|
||||
-- -> ItemUse
|
||||
--ruseRate i f usemods = RightUse
|
||||
-- { _rUse = f
|
||||
-- , _useDelay = FixedRate
|
||||
-- { _rateMax = i
|
||||
-- , _rateTime = 0
|
||||
-- }
|
||||
-- , _useMods = usemods
|
||||
-- , _useHammer = HammerUp
|
||||
-- , _useAim = defaultAimParams
|
||||
-- , _heldScroll = \_ _ -> id
|
||||
-- }
|
||||
|
||||
--ruseInstant
|
||||
-- :: (Item -> Creature -> World -> World)
|
||||
-- -> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
|
||||
-- -> ItemUse
|
||||
--ruseInstant f usemods = RightUse
|
||||
-- { _rUse = f
|
||||
-- , _useDelay = NoDelay
|
||||
-- , _useMods = usemods
|
||||
-- , _useHammer = HammerUp
|
||||
-- , _useAim = defaultAimParams
|
||||
-- , _heldScroll = \_ _ -> id
|
||||
-- }
|
||||
|
||||
defaultrUse :: ItemUse
|
||||
defaultrUse = RightUse
|
||||
{ _rUse = HeldDoNothing
|
||||
@@ -68,7 +39,7 @@ defaultrUse = RightUse
|
||||
}
|
||||
defaultlUse :: ItemUse
|
||||
defaultlUse = LeftUse
|
||||
{ _lUse = \_ _ -> id
|
||||
{ _lUse = LDoNothing
|
||||
, _useDelay = FixedRate {_rateMax = 8, _rateTime = 0}
|
||||
, _useHammer = HammerUp
|
||||
, _eqEq = defaultEquip
|
||||
@@ -83,7 +54,7 @@ defaultEquip = Equipment
|
||||
, _eqViewDist = Nothing
|
||||
}
|
||||
|
||||
luseInstantNoH :: (Item -> Creature -> World -> World) -> ItemUse
|
||||
luseInstantNoH :: Luse -> ItemUse
|
||||
luseInstantNoH f = defaultlUse
|
||||
& lUse .~ f
|
||||
& useDelay .~ NoDelay
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
module Dodge.Item.Equipment.Booster
|
||||
( boosterGun
|
||||
, boostSelfL
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Base
|
||||
@@ -112,7 +113,7 @@ boosterGun :: Item
|
||||
boosterGun = defaultLeftItem
|
||||
{ _itInvColor = cyan
|
||||
, _itConsumption = defaultChargeable
|
||||
, _itUse = luseInstantNoH $ boostSelfL 10
|
||||
, _itUse = luseInstantNoH LBoost
|
||||
, _itEffect = resetAttachmentID
|
||||
}
|
||||
& itType . iyBase .~ LEFT BOOSTER
|
||||
|
||||
@@ -106,7 +106,6 @@ lasCircle = lasGun
|
||||
& itUse . useAim . aimWeight .~ 6
|
||||
& itUse . useAim . aimRange .~ 1
|
||||
& itUse . useAim . aimStance .~ TwoHandTwist
|
||||
where
|
||||
|
||||
lasWide :: Int -> Item
|
||||
lasWide n = lasGun
|
||||
@@ -114,7 +113,6 @@ lasWide n = lasGun
|
||||
& itParams . lasColor .~ yellow
|
||||
& itParams . lasDamage .~ 2
|
||||
& itUse . useMods .~ LasWideMod n
|
||||
where
|
||||
--lasWidePulse :: Item
|
||||
--lasWidePulse = lasGun
|
||||
-- & itType . iyBase .~ LASGUNWIDEPULSE
|
||||
@@ -201,7 +199,6 @@ dualBeam = lasGun
|
||||
& itUse . useAim . aimRange .~ 1
|
||||
& itUse . useAim . aimStance .~ TwoHandFlat
|
||||
& itType . iyModules . at ModDualBeam ?~ EMPTYMODULE
|
||||
where
|
||||
--lasSwing :: Item
|
||||
--lasSwing = lasGun
|
||||
-- & itType . iyBase .~ LASGUNSWING
|
||||
|
||||
@@ -136,7 +136,6 @@ miniGunUse i = defaultrUse
|
||||
& rUse .~ HeldUseAmmoParams
|
||||
& useDelay .~ NoDelay
|
||||
& useMods .~ MiniGunMod i
|
||||
where
|
||||
|
||||
miniGunX :: Int -> Item
|
||||
miniGunX i = defaultAutoGun
|
||||
|
||||
@@ -2,13 +2,9 @@ module Dodge.Item.Weapon.Utility where
|
||||
import Dodge.Data
|
||||
import Dodge.Base.Coordinate
|
||||
import Dodge.Default
|
||||
--import Dodge.Picture.Layer
|
||||
import Dodge.Creature.Action
|
||||
import Dodge.Item.Weapon.TriggerType
|
||||
import Dodge.Item.Weapon.ExtraEffect
|
||||
import Dodge.Wall.ForceField
|
||||
import Dodge.Wall.Move
|
||||
--import Sound.Data
|
||||
import Geometry
|
||||
import Picture
|
||||
import qualified IntMapHelp as IM
|
||||
@@ -16,10 +12,7 @@ import Shape
|
||||
import ShapePicture
|
||||
|
||||
import Data.Maybe
|
||||
--import qualified Data.Map.Strict as M
|
||||
import Control.Lens
|
||||
--import Control.Monad
|
||||
|
||||
rewindGun :: Item
|
||||
rewindGun = defaultLeftItem
|
||||
{ _itInvColor = cyan
|
||||
@@ -29,7 +22,7 @@ rewindGun = defaultLeftItem
|
||||
}
|
||||
, _itEffect = ItRewindEffect rewindEffect []
|
||||
, _itUse = defaultlUse
|
||||
& lUse .~ useRewindGun
|
||||
& lUse .~ LRewind --useRewindGun
|
||||
& eqEq . eqSite .~ GoesOnChest
|
||||
}
|
||||
& itType . iyBase .~ LEFT REWINDER
|
||||
@@ -46,24 +39,10 @@ rewindEffect itm cr w
|
||||
w' = w & rewindWorlds .~ []
|
||||
& timeFlow .~ NormalTimeFlow
|
||||
|
||||
useRewindGun :: Item -> Creature -> World -> World
|
||||
useRewindGun _ _ w = case _rewindWorlds w of
|
||||
[w'] -> rewindusing w' [w']
|
||||
(w':ws) -> rewindusing w' ws
|
||||
_ -> w
|
||||
where
|
||||
rewindusing w' ws = w
|
||||
& maybeWorld .~ Just' ( w'
|
||||
-- & creatures . ix (_crID cr) .~ cr
|
||||
& upbuts
|
||||
& rewindWorlds .~ ws
|
||||
)
|
||||
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
|
||||
|
||||
-- needs to shift this item to the current inventory slot
|
||||
shrinkGun :: Item
|
||||
shrinkGun = defaultLeftItem
|
||||
{_itUse = defaultlUse {_lUse = hammerCheckL useShrinkGun}
|
||||
{_itUse = defaultlUse & lUse .~ LShrink -- hammerCheckL useShrinkGun
|
||||
-- , _itFloorPict = shrinkGunPic
|
||||
, _itAttachment = AttachBool True
|
||||
}
|
||||
@@ -72,24 +51,12 @@ shrinkGun = defaultLeftItem
|
||||
shrinkGunPic :: Item -> SPic
|
||||
shrinkGunPic _ = noPic $ colorSH violet $ upperPrismPoly 5 $ square 5
|
||||
|
||||
-- be careful changing this around; potential problems include updating the
|
||||
-- creature but using the old crInvSel value
|
||||
-- 22.05.23 this has been changed from using invids to items
|
||||
useShrinkGun :: Item -> Creature -> World -> World
|
||||
useShrinkGun it cr w = if _atBool $ _itAttachment it
|
||||
then tryResize 0.5 $ stripNoItems cr . f False UndroppableIdentified . dropExcept cr invid
|
||||
else tryResize 1 $ f True Uncursed . setMinInvSize defaultInvSize cr
|
||||
where
|
||||
invid = _ipInvID $ _itPos it
|
||||
tryResize x g = maybe w g $ sizeSelf x cr w
|
||||
f isInUse cstatus = creatures . ix (_crID cr) . crInv . ix invid %~
|
||||
( (itAttachment . atBool .~ isInUse) . (itCurseStatus .~ cstatus) )
|
||||
|
||||
blinkGun :: Item
|
||||
blinkGun = defaultLeftItem
|
||||
{ _itInvColor = cyan
|
||||
, _itUse = defaultlUse
|
||||
& lUse .~ hammerCheckL (shootL $ const blinkAction)
|
||||
& lUse .~ LBlink --hammerCheckL (shootL $ const blinkAction)
|
||||
& eqEq . eqSite .~ GoesOnWrist
|
||||
-- , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2
|
||||
}
|
||||
@@ -98,7 +65,7 @@ blinkGun = defaultLeftItem
|
||||
unsafeBlinkGun :: Item
|
||||
unsafeBlinkGun = blinkGun
|
||||
& itType . iyBase .~ LEFT BLINKERUNSAFE
|
||||
& itUse . lUse .~ hammerCheckL (shootL $ const unsafeBlinkAction)
|
||||
& itUse . lUse .~ LUnsafeBlink --hammerCheckL (shootL $ const unsafeBlinkAction)
|
||||
& itUse . eqEq . eqViewDist ?~ 400
|
||||
|
||||
--effectGun :: String -> (Creature -> World -> World) -> Item
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
module Dodge.Luse where
|
||||
import Dodge.Data
|
||||
import Dodge.Item.Weapon.TriggerType
|
||||
import Dodge.Creature.Action
|
||||
import Dodge.Item.Equipment.Booster
|
||||
import Dodge.Default.Creature
|
||||
import LensHelp
|
||||
|
||||
useL :: Luse -> Item -> Creature -> World -> World
|
||||
useL lu = case lu of
|
||||
LDoNothing -> const $ const id
|
||||
LRewind -> useRewindGun
|
||||
LShrink -> hammerCheckL useShrinkGun
|
||||
LBlink -> hammerCheckL (shootL $ const blinkAction)
|
||||
LUnsafeBlink -> hammerCheckL (shootL $ const unsafeBlinkAction)
|
||||
LBoost -> boostSelfL 10
|
||||
|
||||
useRewindGun :: Item -> Creature -> World -> World
|
||||
useRewindGun _ _ w = case _rewindWorlds w of
|
||||
[w'] -> rewindusing w' [w']
|
||||
(w':ws) -> rewindusing w' ws
|
||||
_ -> w
|
||||
where
|
||||
rewindusing w' ws = w
|
||||
& maybeWorld .~ Just' ( w'
|
||||
-- & creatures . ix (_crID cr) .~ cr
|
||||
& upbuts
|
||||
& rewindWorlds .~ ws
|
||||
)
|
||||
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
|
||||
|
||||
-- be careful changing this around; potential problems include updating the
|
||||
-- creature but using the old crInvSel value
|
||||
-- 22.05.23 this has been changed from using invids to items
|
||||
useShrinkGun :: Item -> Creature -> World -> World
|
||||
useShrinkGun it cr w = if _atBool $ _itAttachment it
|
||||
then tryResize 0.5 $ stripNoItems cr . f False UndroppableIdentified . dropExcept cr invid
|
||||
else tryResize 1 $ f True Uncursed . setMinInvSize defaultInvSize cr
|
||||
where
|
||||
invid = _ipInvID $ _itPos it
|
||||
tryResize x g = maybe w g $ sizeSelf x cr w
|
||||
f isInUse cstatus = creatures . ix (_crID cr) . crInv . ix invid %~
|
||||
( (itAttachment . atBool .~ isInUse) . (itCurseStatus .~ cstatus) )
|
||||
Reference in New Issue
Block a user