Remove left click/hotkey item data types

This commit is contained in:
2024-12-19 21:55:18 +00:00
parent 910c683eac
commit 3da9490dd4
34 changed files with 708 additions and 883 deletions
+41 -41
View File
@@ -23,8 +23,8 @@ module Dodge.Item.Weapon.TriggerType (
-- withPositionWallCheck,
-- withPosDirWallCheck,
--withWarmUp,
hammerCheckL,
shootL,
-- hammerCheckL,
-- shootL,
useTimeCheck,
-- ammoCheckI,
-- modClock,
@@ -79,8 +79,8 @@ lockInvFor i f it cr =
-- pos = addZ 0 $ _crPos cr +.+ (_crRad cr + 15) *.* unitVectorAtAngle dir
-- ps = replicateM 20 randOnUnitSphere & evalState $ _randGen w
itUseCharge :: Int -> Item -> Item
itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
--itUseCharge :: Int -> Item -> Item
--itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
--{- | Fires at an increasing rate.
--Has different effect after first fire.
@@ -145,41 +145,41 @@ useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of
itRef = item ^?! ldtValue . itLocation . ilInvID
userate = fromMaybe 0 $ item ^? ldtValue . itUse . heldDelay . rateMax
{- | Applies a world effect after a hammer position check.
Arbitrary inventory position.
-}
hammerCheckL ::
-- | Underlying effect
(Item -> Creature -> World -> World) ->
Item ->
Creature ->
World ->
World
hammerCheckL f itm cr w = case itm ^? itUse . leftHammer of
Just HammerUp -> f itm cr w
_ -> w
--{- | Applies a world effect after a hammer position check.
--Arbitrary inventory position.
---}
--hammerCheckL ::
-- -- | Underlying effect
-- (Item -> Creature -> World -> World) ->
-- Item ->
-- Creature ->
-- World ->
-- World
--hammerCheckL f itm cr w = case itm ^? itUse . leftHammer of
-- Just HammerUp -> f itm cr w
-- _ -> w
{- | Applies a world effect after an ammo check.
Arbitrary inventory position -- cannot be replaced with ammoUseCheck.
-}
shootL ::
-- | Underlying effect
(Item -> Creature -> World -> World) ->
Item ->
Creature ->
World ->
World
shootL f item cr w
| fireCondition =
f item cr w & cWorld . lWorld . creatures . ix cid . crInv . ix invid
%~ ( itUseCharge 1
. (itUse . leftDelay . rateTime .~ _rateMax (_leftDelay (_itUse item)))
)
-- | reloadCondition = fromMaybe w $ startReloadingWeapon cr w
| otherwise = w
where
cid = _crID cr
invid = _ilInvID $ _itLocation item
fireCondition =
_rateTime (_leftDelay (_itUse item)) == 0
&& _arLoaded (_leftConsumption (_itUse item)) > 0
--{- | Applies a world effect after an ammo check.
--Arbitrary inventory position -- cannot be replaced with ammoUseCheck.
---}
--shootL ::
-- -- | Underlying effect
-- (Item -> Creature -> World -> World) ->
-- Item ->
-- Creature ->
-- World ->
-- World
--shootL f item cr w
-- | fireCondition =
-- f item cr w & cWorld . lWorld . creatures . ix cid . crInv . ix invid
-- %~ ( itUseCharge 1
-- . (itUse . leftDelay . rateTime .~ _rateMax (_leftDelay (_itUse item)))
-- )
-- -- | reloadCondition = fromMaybe w $ startReloadingWeapon cr w
-- | otherwise = w
-- where
-- cid = _crID cr
-- invid = _ilInvID $ _itLocation item
-- fireCondition =
-- _rateTime (_leftDelay (_itUse item)) == 0
-- && _arLoaded (_leftConsumption (_itUse item)) > 0
+40 -46
View File
@@ -1,57 +1,51 @@
module Dodge.Item.Weapon.Utility
( stopWatch
, rewindWatch
, scrollWatch
, blinkGun
, unsafeBlinkGun
( timeStopper
, rewinder
, timeScroller
, blinker
, unsafeBlinker
) where
import Control.Lens
import Dodge.Data.Item
import Dodge.Default
stopWatch :: Item
stopWatch =
defaultLeftItem
& itUse
.~ ( defaultLeftUse
& leftUse .~ LTimePause
& uequipEffect . eeSite .~ GoesOnWrist
)
& itEffect . ieInv .~ ChargeIfEquipped
& itEffect . ieOnDrop .~ SetCharge 0
& itType .~ LEFT STOPWATCH
& itUse . leftConsumption
.~ ChargeableAmmo
{ _wpMaxCharge = 100
, _wpCharge = 0
}
scrollWatch :: Item
scrollWatch =
stopWatch
& itUse . leftUse .~ LTimeScroll
& itType .~ LEFT SCROLLWATCH
blinker :: Item
blinker =
defaultHeldItem
& itUse . useCondition .~ UseableAnytime
& itUse . heldDelay . rateMax .~ 20
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1}
& itAmmoSlots .~ singleAmmo ElectricalAmmo
& itUse . heldParams .~ DefaultHeldParams
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleBlink
& itUse . heldAim . aimMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 10000000
& itType .~ HELD BLINKER
rewindWatch :: Item
rewindWatch =
stopWatch
& itUse . leftUse .~ LRewind --useRewindGun
& itType .~ LEFT REWINDWATCH
unsafeBlinker :: Item
unsafeBlinker =
blinker
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleUnsafeBlink
& itType .~ HELD BLINKERUNSAFE
-- & itUse . uequipEffect . eeViewDist ?~ 400
blinkGun :: Item
blinkGun =
defaultLeftItem
{ _itUse =
defaultLeftUse
& leftUse .~ LBlink
& uequipEffect . eeSite .~ GoesOnWrist
}
& itType .~ LEFT BLINKER
rewinder :: Item
rewinder =
blinker
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleRewind
& itType .~ HELD REWINDER
& itUse . heldAim . aimMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 100000
unsafeBlinkGun :: Item
unsafeBlinkGun =
blinkGun
& itType .~ LEFT BLINKERUNSAFE
& itUse . leftUse .~ LUnsafeBlink
& itUse . uequipEffect . eeViewDist ?~ 400
timeStopper :: Item
timeStopper =
blinker
& itType .~ HELD TIMESTOPPER
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleStopper
timeScroller :: Item
timeScroller =
timeStopper
& itType .~ HELD TIMESCROLLER
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleScroller