From 86d884ba015dd02b2dbb1a5586c8f1a33e940d57 Mon Sep 17 00:00:00 2001 From: justin Date: Wed, 18 Dec 2024 15:50:22 +0000 Subject: [PATCH] Cleanup --- src/Dodge/Combine/Combinations.hs | 6 +++--- src/Dodge/Creature.hs | 8 ++------ src/Dodge/Creature/State.hs | 2 +- src/Dodge/Data/Item/Combine.hs | 1 - src/Dodge/Data/Item/HeldUse.hs | 2 -- src/Dodge/Euse.hs | 5 ----- src/Dodge/Item.hs | 1 - src/Dodge/Item/Display.hs | 15 +-------------- src/Dodge/Item/Draw/SPic.hs | 1 - src/Dodge/Item/Info.hs | 1 - src/Dodge/Item/Weapon/Radar.hs | 18 +++--------------- src/Dodge/LockAndKey.hs | 3 +-- 12 files changed, 11 insertions(+), 52 deletions(-) diff --git a/src/Dodge/Combine/Combinations.hs b/src/Dodge/Combine/Combinations.hs index 382ae8eef..69d1c44e3 100644 --- a/src/Dodge/Combine/Combinations.hs +++ b/src/Dodge/Combine/Combinations.hs @@ -103,9 +103,9 @@ itemCombinations = , po [cr MICROCHIP, cr PRISM] (makeTypeCraft LIGHTSENSOR) , po [cr MICROCHIP, cr MICROPHONE] (makeTypeCraft SOUNDSENSOR) , po [cr MICROCHIP, cr THERMOMETER] (makeTypeCraft HEATSENSOR) - , po [cr MICROCHIP, cr TRANSMITTER, cr LIGHTSENSOR] (autoDetector ITEMDETECTOR) - , po [cr MICROCHIP, cr TRANSMITTER, cr SOUNDSENSOR] (autoDetector WALLDETECTOR) - , po [cr MICROCHIP, cr TRANSMITTER, cr HEATSENSOR] (autoDetector CREATUREDETECTOR) + , po [cr MICROCHIP, cr TRANSMITTER, cr LIGHTSENSOR] (clickDetector ITEMDETECTOR) + , po [cr MICROCHIP, cr TRANSMITTER, cr SOUNDSENSOR] (clickDetector WALLDETECTOR) + , po [cr MICROCHIP, cr TRANSMITTER, cr HEATSENSOR] (clickDetector CREATUREDETECTOR) , po [AMMOMAG BATTERY, cr LED] torch , po [hd TORCH, eq HAT] headLamp -- , po [cr LIGHTER, cr THERMOMETER, cr MICROCHIP] (energyBallCraft IncBall) diff --git a/src/Dodge/Creature.hs b/src/Dodge/Creature.hs index 3dc0b0508..261fd4d25 100644 --- a/src/Dodge/Creature.hs +++ b/src/Dodge/Creature.hs @@ -140,15 +140,12 @@ inventoryX c = case c of , makeTypeCraftNum 1 CREATURESENSOR ] 'C' -> - [ autoDetector CREATUREDETECTOR - , autoDetector WALLDETECTOR - , autoDetector ITEMDETECTOR - , wristInvisibility + [ wristInvisibility ] 'D' -> [ blinkGun , unsafeBlinkGun - , autoDetector WALLDETECTOR + , clickDetector WALLDETECTOR ] 'E' -> fold [ makeTypeCraftNum 3 PIPE @@ -264,7 +261,6 @@ testInventory = [ autoAmr , brainHat , headLamp - , autoDetector WALLDETECTOR , magShield , frontArmour , wristArmour diff --git a/src/Dodge/Creature/State.hs b/src/Dodge/Creature/State.hs index 404dd1dce..7541333bd 100644 --- a/src/Dodge/Creature/State.hs +++ b/src/Dodge/Creature/State.hs @@ -189,7 +189,7 @@ invItemLocUpdate loc w = case itm ^. itType of tryUseParent :: LocationLDT ItemLink ComposedItem -> World -> World tryUseParent loc w = fromMaybe w $ do t <- locUp loc - let t' = bimap (_iatType) (^. _1) $ t ^. locLDT + let t' = bimap (^. iatType) (^. _1) $ t ^. locLDT cr <- w ^? cWorld . lWorld . creatures . ix 0 return $ heldEffectNoHammerCheck t' cr w diff --git a/src/Dodge/Data/Item/Combine.hs b/src/Dodge/Data/Item/Combine.hs index f7338660d..ca9b00dc8 100644 --- a/src/Dodge/Data/Item/Combine.hs +++ b/src/Dodge/Data/Item/Combine.hs @@ -113,7 +113,6 @@ data EquipItemType | BULLETBELTPACK | BULLETBELTBRACER | BATTERYPACK - | AUTODETECTOR Detector | WRIST_ECG deriving (Eq, Ord, Show, Read) diff --git a/src/Dodge/Data/Item/HeldUse.hs b/src/Dodge/Data/Item/HeldUse.hs index a7f27ddce..e5ccaae3e 100644 --- a/src/Dodge/Data/Item/HeldUse.hs +++ b/src/Dodge/Data/Item/HeldUse.hs @@ -9,7 +9,6 @@ module Dodge.Data.Item.HeldUse where import Data.Aeson import Data.Aeson.TH import Dodge.Data.CamouflageStatus -import Dodge.Data.Item.Combine import Control.Lens data Cuse @@ -19,7 +18,6 @@ data Cuse data Euse = EDoNothing - | EDetector {_euseDetector :: Detector} | EMagShield | EWristShield | EHeadLamp diff --git a/src/Dodge/Euse.hs b/src/Dodge/Euse.hs index 6a2f62718..663537aa2 100644 --- a/src/Dodge/Euse.hs +++ b/src/Dodge/Euse.hs @@ -9,9 +9,6 @@ import Dodge.Data.World import Dodge.Default.Wall import Dodge.Item.HeldOffset import Dodge.Item.Location -import Dodge.Item.Weapon.ExtraEffect -import Dodge.Item.Weapon.Radar -import Dodge.SoundLogic.ExternallyGeneratedSounds import Dodge.Wall.Create import Dodge.Wall.Delete import Dodge.Wall.ForceField @@ -23,7 +20,6 @@ import LensHelp useE :: Euse -> Item -> Creature -> World -> World useE eo = case eo of EDoNothing -> const $ const id - EDetector dt -> autoEffect (detectorEffect dt) 100 click1S EMagShield -> useMagShield EWristShield -> setWristShieldPos EHeadLamp -> createHeadLamp @@ -31,7 +27,6 @@ useE eo = case eo of EonWristShield -> onEquipWristShield EoffWristShield -> onRemoveWristShield EFuelSource 0 _ -> const . const id - --EFuelSource{} -> trySiphonFuel EFuelSource{} -> const . const id EBatterySource{} -> tryChargeBattery EAmmoSource{} -> tryAttachBulletBelt diff --git a/src/Dodge/Item.hs b/src/Dodge/Item.hs index 3dd610775..fecd6e5bd 100644 --- a/src/Dodge/Item.hs +++ b/src/Dodge/Item.hs @@ -71,7 +71,6 @@ itemFromEquipType et = case et of FUELPACK -> fuelPack BULLETBELTPACK -> bulletBeltPack BULLETBELTBRACER -> bulletBeltBracer - AUTODETECTOR d -> autoDetector d WRIST_ECG -> pulseChecker itemFromLeftType :: LeftItemType -> Item diff --git a/src/Dodge/Item/Display.hs b/src/Dodge/Item/Display.hs index 7307618e4..728636b77 100644 --- a/src/Dodge/Item/Display.hs +++ b/src/Dodge/Item/Display.hs @@ -79,20 +79,6 @@ showAutoRechargeProgress lc = case lc of | otherwise -> show (_arLoaded lc) ChargeableAmmo{} -> show (_wpCharge lc) ---showReloadProgress :: Creature -> Item -> String ---showReloadProgress cr itm = case cr ^? crManipulation . manObject . inInventory . iselAction of --- Just (ReloadAction i la) -> show i ++ showLoadActionType la ic --- _ -> case ic of --- InternalSource ia -> case ia ^? iaProgress . _Just . ix 0 of --- Nothing -> show $ ia ^. iaLoaded --- Just la -> show (_actionTime la) ++ showLoadActionType la ic --- AboveSource -> fromMaybe "XXXX" $ do --- i <- fmap (subtract 1) $ itm ^? itLocation . ipInvID --- x <- cr ^? crInv . ix i . itUse . equipEffect . eeUse . euseAmmoAmount --- return $ showIntKMG' x --- where --- ic = (itm ^?! itUse . heldConsumption . laSource) - itemNumberDisplay :: Creature -> ComposedItem -> [String] itemNumberDisplay cr ci = case (ci ^. _2, itm ^?! itUse, itm ^. itType) of (_,_,EQUIP WRIST_ECG) -> [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress] @@ -112,6 +98,7 @@ itemNumberDisplay cr ci = case (ci ^. _2, itm ^?! itUse, itm ^. itType) of itm = ci ^. _1 displayPulse :: Int -> String +displayPulse 0 = "*****" displayPulse x = take 5 $ drop y "----^-----" where y = min 5 $ x `div` 3 diff --git a/src/Dodge/Item/Draw/SPic.hs b/src/Dodge/Item/Draw/SPic.hs index 236bf3174..df1b85a57 100644 --- a/src/Dodge/Item/Draw/SPic.hs +++ b/src/Dodge/Item/Draw/SPic.hs @@ -91,7 +91,6 @@ equipItemSPic et _ = case et of noPic $ colorSH green backpackShape BULLETBELTBRACER -> noPic (colorSH green $ upperPrismPolySU 3 $ rectWH 2 2) - AUTODETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPolySU 3 $ rectWH 2 2) backpackShape :: Shape backpackShape = upperPrismPolyMT 10 $ rectNSWE 5 (-5) (-4) 4 diff --git a/src/Dodge/Item/Info.hs b/src/Dodge/Item/Info.hs index 27efaa253..514d10741 100644 --- a/src/Dodge/Item/Info.hs +++ b/src/Dodge/Item/Info.hs @@ -118,7 +118,6 @@ equipInfo eit = case eit of BULLETBELTPACK -> "A container holding a long belt of bullets." BULLETBELTBRACER -> "A container holding a long belt of bullets." BATTERYPACK -> "A collection of batteries with a universal adapter." - AUTODETECTOR d -> "A device that detects " ++ detectorInfo d ++ " in an expanding radius. Pulses automatically. " WRIST_ECG -> "A wristworn device that detects the hearts electrical activity." --targetingInfo :: TargetingType -> String diff --git a/src/Dodge/Item/Weapon/Radar.hs b/src/Dodge/Item/Weapon/Radar.hs index 099306f06..024b6d504 100644 --- a/src/Dodge/Item/Weapon/Radar.hs +++ b/src/Dodge/Item/Weapon/Radar.hs @@ -1,22 +1,10 @@ -module Dodge.Item.Weapon.Radar - ( autoDetector - , detectorEffect - ) where +module Dodge.Item.Weapon.Radar ( + detectorEffect, +) where -import Control.Lens import Dodge.Data.World -import Dodge.Default import Dodge.RadarSweep -autoDetector :: Detector -> Item -autoDetector dt = - defaultEquipment - & itUse . uequipEffect . eeSite .~ GoesOnWrist - & itUse . uequipEffect . eeUse .~ EDetector dt --autoEffect (detectorEffect dt) 100 click1S - & itUse . uequipEffect . eeParams .~ EquipCounter 0 - & itUse . uequipEffect . eeViewDist ?~ 350 - & itType .~ EQUIP (AUTODETECTOR dt) - detectorEffect :: Detector -> Item -> Creature -> World -> World detectorEffect dt = case dt of ITEMDETECTOR -> const (aRadarPulse ObItem) diff --git a/src/Dodge/LockAndKey.hs b/src/Dodge/LockAndKey.hs index 120a8fddd..84611e3c6 100644 --- a/src/Dodge/LockAndKey.hs +++ b/src/Dodge/LockAndKey.hs @@ -17,8 +17,7 @@ lockRoomMultiItems = [ ( blinkAcrossChallenge , takeOne - [ [LEFT BLINKERUNSAFE, EQUIP $ AUTODETECTOR WALLDETECTOR] - , [LEFT BLINKERUNSAFE, HELD $ DETECTOR WALLDETECTOR] + [ [LEFT BLINKERUNSAFE, HELD $ DETECTOR WALLDETECTOR] ] ) ]