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
+1 -9
View File
@@ -48,7 +48,6 @@ itemBaseName itm = case _itType itm of
HELD hit -> case hit ^? xNum of
Just i -> takeWhile (/= ' ') (show hit) ++ show i
Nothing -> show hit
LEFT lit -> show lit
EQUIP eit -> showEquipItem eit
CONSUMABLE cit -> show cit
ATTACH ait -> showAttachItem ait itm
@@ -72,13 +71,6 @@ showEquipItem eit = case eit of
INVISIBILITYEQUIPMENT esite -> "INVISIBILITY " ++ show esite
_ -> show eit
showAutoRechargeProgress :: LeftConsumption -> String
showAutoRechargeProgress lc = case lc of
AutoRecharging{}
| _arLoaded lc < _arMax lc -> show (_arProgress lc) ++ "C" ++ show (_arLoaded lc)
| otherwise -> show (_arLoaded lc)
ChargeableAmmo{} -> show (_wpCharge lc)
itemNumberDisplay :: Creature -> ComposedItem -> [String]
itemNumberDisplay cr ci = case (ci ^. _2, itm ^?! itUse, itm ^. itType) of
(_,_,EQUIP WRIST_ECG) -> [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
@@ -87,7 +79,7 @@ itemNumberDisplay cr ci = case (ci ^. _2, itm ^?! itUse, itm ^. itType) of
_ | hasammo -> [maybe "" shortShow
$ itm ^? itConsumables . magLoadStatus . iaLoaded]
(_,UseHeld{},_) -> []
(_,UseHotkey{_leftConsumption=lc},_) -> [showAutoRechargeProgress lc]
-- (_,UseHotkey{_leftConsumption=lc},_) -> [showAutoRechargeProgress lc]
(_,UseEquip{},_) -> mempty
(_,UseNothing,_) -> []
(_,UseConsume {},_) -> []
+5 -6
View File
@@ -35,7 +35,6 @@ itemSPic :: Item -> SPic
itemSPic it = case it ^. itType of
CRAFT _ -> defSPic
HELD ht -> heldItemSPic ht it
LEFT lt -> leftItemSPic lt it
EQUIP et -> equipItemSPic et it
CONSUMABLE{} -> defSPic
ATTACH{} -> defSPic
@@ -95,11 +94,6 @@ equipItemSPic et _ = case et of
backpackShape :: Shape
backpackShape = upperPrismPolyMT 10 $ rectNSWE 5 (-5) (-4) 4
leftItemSPic :: LeftItemType -> Item -> SPic
leftItemSPic lt _ = case lt of
BLINKER -> defSPic
_ -> defSPic
--ammoPosition :: Item -> HeldItemType -> AmmoPosition
--ammoPosition itm hit = case hit of
-- FLATSHIELD -> NoAmmoPosition
@@ -207,6 +201,11 @@ heldItemSPic ht it = case ht of
LAUNCHERX _ -> launcherPic it
POISONSPRAYER -> flamerPic it
DRONELAUNCHER -> defSPic
BLINKER -> defSPic
BLINKERUNSAFE -> defSPic
REWINDER -> defSPic
TIMESTOPPER -> defSPic
TIMESCROLLER -> defSPic
SHATTERGUN -> shatterGunSPic
DETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPolySU 3 $ rectWH 2 2)
KEYCARD _ -> noShape (setDepth 0 $ translate (-5) (-5) $ rotate (pi / 2.5) keyPic)
-2
View File
@@ -1,5 +1,4 @@
module Dodge.Item.Equipment (
module Dodge.Item.Equipment.Booster,
magShield,
powerLegs,
wristInvisibility,
@@ -22,7 +21,6 @@ import Dodge.Item.Weapon.Bullet
import Geometry.Data
import Dodge.Data.Item
import Dodge.Default
import Dodge.Item.Equipment.Booster
import LensHelp
magShield :: Item
-14
View File
@@ -1,14 +0,0 @@
module Dodge.Item.Equipment.Booster (
boosterGun,
) where
import Control.Lens
import Dodge.Data.Item
import Dodge.Default.Item
boosterGun :: Item
boosterGun =
defaultLeftItem
& itUse . leftUse .~ LBoost
& itUse . leftDelay .~ NoDelay
& itType .~ LEFT BOOSTER
+3 -3
View File
@@ -86,9 +86,10 @@ getAmmoLinks itm =
itemToFunction :: Item -> ItemStructuralFunction
itemToFunction itm = case itm ^. itType of
HELD DETECTOR{} -> GadgetPlatformSF
HELD LASER -> WeaponTargetingSF
HELD{} -> HeldPlatformSF
HELD{} -> case itm ^? itUse . useCondition of
Just MustBeHeld -> HeldPlatformSF
_ -> GadgetPlatformSF
AMMOMAG{} -> maybe UncomposableIsolateSF AmmoMagSF $ itm ^? itConsumables . magType
ATTACH REMOTESCREEN -> RemoteScreenSF
ATTACH BULLETSYNTH -> AmmoModifierSF BulletAmmo
@@ -99,7 +100,6 @@ itemToFunction itm = case itm ^. itType of
BULLETMOD BulletModPayload{} -> AmmoPayloadSF BulletAmmo
BULLETMOD BulletModEffect{} -> AmmoEffectSF BulletAmmo
TARGETING{} -> WeaponTargetingSF
LEFT{} -> EquipmentPlatformSF
EQUIP WRIST_ECG -> TriggerSF
EQUIP{} -> EquipmentPlatformSF
_ -> UncomposableIsolateSF
+7 -1
View File
@@ -11,6 +11,7 @@ module Dodge.Item.Held (
module Dodge.Item.Held.BatteryGuns,
) where
import Dodge.Item.Weapon.Utility
import Dodge.Data.Item
import Dodge.Item.Held.Launcher
import Dodge.Item.Held.BatteryGuns
@@ -24,6 +25,11 @@ import Dodge.Item.Held.SprayGuns
itemFromHeldType :: HeldItemType -> Item
itemFromHeldType ht = case ht of
REWINDER -> rewinder
TIMESTOPPER -> timeStopper
TIMESCROLLER -> timeScroller
BLINKERUNSAFE -> unsafeBlinker
BLINKER -> blinker
KEYCARD i -> keyCard i
TORCH -> torch
SHATTERGUN -> shatterGun
@@ -64,5 +70,5 @@ itemFromHeldType ht = case ht of
-- REMOTELAUNCHER -> remoteLauncher
POISONSPRAYER -> poisonSprayer
DRONELAUNCHER -> undefined
DETECTOR d -> clickDetector d
DETECTOR d -> detector d
FLATSHIELD -> flatShield
+3 -2
View File
@@ -32,9 +32,10 @@ torch =
{- |
Sends out pulses that display walls.
-}
clickDetector :: Detector -> Item
clickDetector dt =
detector :: Detector -> Item
detector dt =
defaultHeldItem
& itUse . useCondition .~ UseableAnytime
& itUse . heldDelay . rateMax .~ 20
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1}
+8 -14
View File
@@ -23,7 +23,6 @@ itmSpaceInfo itm = case itInvHeight itm of
itmBaseInfo :: Item -> String
itmBaseInfo itm = case itm ^. itType of
HELD hit -> heldInfo hit
LEFT lit -> leftInfo lit
EQUIP eit -> equipInfo eit
CONSUMABLE cit -> consumableInfo cit
CRAFT fit -> craftInfo fit
@@ -48,6 +47,8 @@ showInt i = case i of
heldInfo :: HeldItemType -> String
heldInfo hit = case hit of
BLINKERUNSAFE -> "A device that allows local teleportation. Potentially hazardous around walls."
BLINKER -> "A device that allows local teleportation."
BANGSTICK 1 -> "A firearm with a short barrel that requires reloading after each shot."
BANGSTICK i -> over _head toUpper (showInt i) ++ " small gun barrels strapped together. Each barrel must be individually loaded, but not all need be loaded for the weapon to fire. All loaded barrels discharge simultaneously, with significant spread."
PISTOL -> "A small firearm fed by a magazine. The entire magazine must be replaced when reloading the weapon."
@@ -90,16 +91,9 @@ heldInfo hit = case hit of
TORCH -> "A stick with a light on the end."
FLATSHIELD -> "A panel of metal that blocks unwanted objects from the front of the user."
KEYCARD i -> "A keycard. It is labelled " ++ show i ++ "."
leftInfo :: LeftItemType -> String
leftInfo lit = case lit of
BOOSTER -> "A device that allows travel at speed."
STOPWATCH -> "A device that temporarily pauses time."
REWINDWATCH -> "A device that rewinds time a short amount."
SCROLLWATCH -> "A device that can be used to scroll through recent events."
BLINKER -> "A device that allows local teleportation."
BLINKERUNSAFE -> "A device that allows local teleportation. Potentially hazardous around walls."
SPAWNER -> "A device that spawns creatures."
TIMESTOPPER -> "A device that temporarily pauses time."
REWINDER -> "A device that rewinds time a short amount."
TIMESCROLLER -> "A device that can be used to scroll through recent events."
equipInfo :: EquipItemType -> String
equipInfo eit = case eit of
@@ -197,9 +191,9 @@ detectorInfo d = case d of
itmUsageInfo :: Item -> String
itmUsageInfo itm = case itm ^. itType of
HELD _ -> heldPositionInfo itm
LEFT _ ->
"This item can be equipped" ++ itmEquipSiteInfo itm
++ ". When equipped, it can be activated."
-- LEFT _ ->
-- "This item can be equipped" ++ itmEquipSiteInfo itm
-- ++ ". When equipped, it can be activated."
EQUIP _ -> "This item can be equipped " ++ itmEquipSiteInfo itm ++ "."
CONSUMABLE _ -> "This item can be consumed."
CRAFT _ -> ""
+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