From ecefba21d69f7a5421e526423e0ae5162fb496e9 Mon Sep 17 00:00:00 2001 From: justin Date: Fri, 21 Jun 2024 14:50:08 +0100 Subject: [PATCH] Implement reloading of single external magazines --- ghcidOutput | 189 +--------------- graph/itemCombinations.gv | 2 +- src/Dodge/Base/You.hs | 2 +- src/Dodge/Default/Item/Use/Consumption.hs | 2 +- src/Dodge/Euse.hs | 4 +- src/Dodge/HeldUse.hs | 2 +- src/Dodge/Item.hs | 1 + src/Dodge/Item/Display.hs | 12 +- src/Dodge/Item/Draw/SPic.hs | 262 +++++++++++----------- src/Dodge/Item/Held/BatteryGuns.hs | 2 +- src/Dodge/Item/Held/Cane.hs | 2 +- src/Dodge/Item/Held/Cone.hs | 2 +- src/Dodge/Item/Held/Launcher.hs | 2 +- src/Dodge/Item/Held/Rod.hs | 2 +- src/Dodge/Item/Held/SprayGuns.hs | 2 +- src/Dodge/Item/Held/Stick.hs | 2 +- src/Dodge/Item/Info.hs | 3 +- src/Dodge/Item/Weapon/TriggerType.hs | 2 +- src/Dodge/Reloading.hs | 2 +- 19 files changed, 157 insertions(+), 340 deletions(-) diff --git a/ghcidOutput b/ghcidOutput index de3b7e3fb..6ed120ffe 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1,188 +1 @@ -/home/justin/Haskell/loop/src/Dodge/Item/Draw/SPic.hs:68:1-12: warning: [-Wunused-top-binds] - Defined but not used: ‘ammoPosition’ - | -68 | ammoPosition itm hit = case hit of - | ^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Draw/SPic.hs:119:1-16: warning: [-Wunused-top-binds] - Defined but not used: ‘bangStickAmmoPos’ - | -119 | bangStickAmmoPos _ itm = - | ^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Draw/SPic.hs:125:1-16: warning: [-Wunused-top-binds] - Defined but not used: ‘volleygunAmmoPos’ - | -125 | volleygunAmmoPos i = - | ^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Draw/SPic.hs:132:1-15: warning: [-Wunused-top-binds] - Defined but not used: ‘multigunAmmoPos’ - | -132 | multigunAmmoPos i = - | ^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Draw/SPic.hs:259:1-10: warning: [-Wunused-top-binds] - Defined but not used: ‘drawBullet’ - | -259 | drawBullet itm p q = - | ^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Draw/SPic.hs:337:1-17: warning: [-Wunused-top-binds] - Defined but not used: ‘bulletEffectColor’ - | -337 | bulletEffectColor x = case x of - | ^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Draw/SPic.hs:343:1-15: warning: [-Wunused-top-binds] - Defined but not used: ‘bulletTrajColor’ - | -343 | bulletTrajColor x = case x of - | ^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Draw/SPic.hs:350:1-18: warning: [-Wunused-top-binds] - Defined but not used: ‘bulletPayloadColor’ - | -350 | bulletPayloadColor x = case x of - | ^^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Draw/SPic.hs:358:1-15: warning: [-Wunused-top-binds] - Defined but not used: ‘energyBallColor’ - | -358 | energyBallColor ebt = case ebt of - | ^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Draw/SPic.hs:407:11-12: warning: [-Wunused-matches] - Defined but not used: ‘it’ - | -407 | flamerPic it = - | ^^ -/home/justin/Haskell/loop/src/Dodge/Item/Draw/SPic.hs:448:11-12: warning: [-Wunused-matches] - Defined but not used: ‘it’ - | -448 | lasGunPic it = - | ^^ -/home/justin/Haskell/loop/src/Dodge/Item/Held/SprayGuns.hs:12:1-29: warning: [-Wunused-imports] - The import of ‘Dodge.Reloading.Action’ is redundant - | -12 | import Dodge.Reloading.Action - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Held/Launcher.hs:4:1-29: warning: [-Wunused-imports] - The import of ‘Dodge.Reloading.Action’ is redundant - | -4 | import Dodge.Reloading.Action - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Held/Cone.hs:6:1-29: warning: [-Wunused-imports] - The import of ‘Dodge.Reloading.Action’ is redundant - | -6 | import Dodge.Reloading.Action - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Base/You.hs:45:19-20: warning: [-Wunused-matches] - Defined but not used: ‘cr’ - | -45 | upDownAttachments cr i j s = s - | ^^ -/home/justin/Haskell/loop/src/Dodge/Base/You.hs:45:22: warning: [-Wunused-matches] - Defined but not used: ‘i’ - | -45 | upDownAttachments cr i j s = s - | ^ -/home/justin/Haskell/loop/src/Dodge/Base/You.hs:45:24: warning: [-Wunused-matches] - Defined but not used: ‘j’ - | -45 | upDownAttachments cr i j s = s - | ^ -/home/justin/Haskell/loop/src/Dodge/Item/Held/Stick.hs:12:1-29: warning: [-Wunused-imports] - The import of ‘Dodge.Reloading.Action’ is redundant - | -12 | import Dodge.Reloading.Action - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Held/BatteryGuns.hs:10:1-29: warning: [-Wunused-imports] - The import of ‘Dodge.Reloading.Action’ is redundant - | -10 | import Dodge.Reloading.Action - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Weapon/TriggerType.hs:657:55: warning: [-Wtype-defaults] - • Defaulting the following constraints to type ‘Integer’ - (Num a0) - arising from the literal ‘1’ - at /home/justin/Haskell/loop/src/Dodge/Item/Weapon/TriggerType.hs:657:55 - (Enum a0) - arising from the arithmetic sequence ‘1 .. ’ - at /home/justin/Haskell/loop/src/Dodge/Item/Weapon/TriggerType.hs:657:54-60 - • In the expression: 1 - In the second argument of ‘take’, namely ‘[1 .. ]’ - In the third argument of ‘foldr’, namely ‘(take numbul [1 .. ])’ - | -657 | duplicateLoaded eff it cr w = foldr f w (take numbul [1 .. ]) - | ^ -/home/justin/Haskell/loop/src/Dodge/Euse.hs:4:1-20: warning: [-Wunused-imports] - The import of ‘Control.Monad’ is redundant - | -4 | import Control.Monad - | ^^^^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Euse.hs:47:15-17: warning: [-Wunused-matches] - Defined but not used: ‘itm’ - | -47 | trySiphonFuel itm cr = id - | ^^^ -/home/justin/Haskell/loop/src/Dodge/Euse.hs:47:19-20: warning: [-Wunused-matches] - Defined but not used: ‘cr’ - | -47 | trySiphonFuel itm cr = id - | ^^ -/home/justin/Haskell/loop/src/Dodge/Item/Held/Rod.hs:13:1-29: warning: [-Wunused-imports] - The import of ‘Dodge.Reloading.Action’ is redundant - | -13 | import Dodge.Reloading.Action - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Held/Cane.hs:14:1-29: warning: [-Wunused-imports] - The import of ‘Dodge.Reloading.Action’ is redundant - | -14 | import Dodge.Reloading.Action - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item.hs:(29,25)-(34,40): warning: [-Wincomplete-patterns] - Pattern match(es) are non-exhaustive - In a case alternative: Patterns not matched: AMMOATTACH REVOLVEMAG - | -29 | itemFromAttachType at = case at of - | ^^^^^^^^^^... -/home/justin/Haskell/loop/src/Dodge/HeldUse.hs:488:22-23: warning: [-Wunused-matches] - Defined but not used: ‘it’ - | -488 | caneStickSoundChoice it = tap3S - | ^^ -/home/justin/Haskell/loop/src/Dodge/Item/Info.hs:(62,16)-(107,62): warning: [-Wincomplete-patterns] - Pattern match(es) are non-exhaustive - In a case alternative: Patterns not matched: MULTIGUN _ - | -62 | heldInfo hit = case hit of - | ^^^^^^^^^^^... -/home/justin/Haskell/loop/src/Dodge/Item/Display.hs:11:1-26: warning: [-Wunused-imports] - The import of ‘Control.Applicative’ is redundant - | -11 | import Control.Applicative - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Display.hs:12:1-20: warning: [-Wunused-imports] - The import of ‘Control.Monad’ is redundant - | -12 | import Control.Monad - | ^^^^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Display.hs:15:1-22: warning: [-Wunused-imports] - The import of ‘Dodge.Item.Info’ is redundant - | -15 | import Dodge.Item.Info - | ^^^^^^^^^^^^^^^^^^^^^^ -/home/justin/Haskell/loop/src/Dodge/Item/Display.hs:87:16-17: warning: [-Wname-shadowing] - This binding for ‘at’ shadows the existing binding - imported from ‘LensHelp’ at /home/justin/Haskell/loop/src/Dodge/Item/Display.hs:18:1-15 - (and originally defined in ‘Control.Lens.At’) - | -87 | showAttachItem at = case at of - | ^^ -/home/justin/Haskell/loop/src/Dodge/Item/Display.hs:132:21-22: warning: [-Wunused-matches] - Defined but not used: ‘cr’ - | -132 | showEquipmentNumber cr itm = case _eeUse ee of - | ^^ -/home/justin/Haskell/loop/src/Dodge/Item/Display.hs:155:20-21: warning: [-Wunused-matches] - Defined but not used: ‘cr’ - | -155 | showReloadProgress cr itm = fromMaybe [] $ do - | ^^ -/home/justin/Haskell/loop/src/Dodge/Default/Item/Use/Consumption.hs:6:1-29: warning: [-Wunused-imports] - The import of ‘Dodge.Reloading.Action’ is redundant - | -6 | import Dodge.Reloading.Action - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +All good (615 modules, at 14:45:15) diff --git a/graph/itemCombinations.gv b/graph/itemCombinations.gv index fd7438c3c..66d8e434c 100644 --- a/graph/itemCombinations.gv +++ b/graph/itemCombinations.gv @@ -22,7 +22,7 @@ digraph { 28 [shape=box ,label="EQUIP {_ibtEquip = TARGETINGHAT TargetCursor}"]; 31 [shape=box - ,label="ATTACH {_ibtAttach = AMMOATTACH REVOLVEMAG}"]; + ,label="ATTACH {_ibtAttach = AMMOATTACH TINMAG}"]; 35 [shape=box ,label="HELD {_ibtHeld = BANGSTICK {_xNum = 1}}"]; 39 [shape=box diff --git a/src/Dodge/Base/You.hs b/src/Dodge/Base/You.hs index 85f0e0504..cecf0c081 100644 --- a/src/Dodge/Base/You.hs +++ b/src/Dodge/Base/You.hs @@ -42,7 +42,7 @@ attachmentTree cr = fromMaybe mempty $ do return $ upDownAttachments cr i i mempty upDownAttachments :: Creature -> Int -> Int -> M.Map AttachType Int -> M.Map AttachType Int -upDownAttachments cr i j s = s +upDownAttachments _ _ _ s = s --yourInvSel :: World -> Int --yourInvSel = crSel . you diff --git a/src/Dodge/Default/Item/Use/Consumption.hs b/src/Dodge/Default/Item/Use/Consumption.hs index a82347db9..bf6510294 100644 --- a/src/Dodge/Default/Item/Use/Consumption.hs +++ b/src/Dodge/Default/Item/Use/Consumption.hs @@ -3,7 +3,7 @@ module Dodge.Default.Item.Use.Consumption where import Control.Lens import Dodge.Data.Item.Use.Consumption import Dodge.Item.Weapon.Bullet -import Dodge.Reloading.Action +--import Dodge.Reloading.Action defaultLoadable :: HeldConsumption defaultLoadable = diff --git a/src/Dodge/Euse.hs b/src/Dodge/Euse.hs index f9999ec02..63760d77e 100644 --- a/src/Dodge/Euse.hs +++ b/src/Dodge/Euse.hs @@ -1,7 +1,7 @@ module Dodge.Euse where import Color -import Control.Monad +--import Control.Monad import Data.Maybe import Dodge.Creature.HandPos import Dodge.Creature.Test @@ -44,7 +44,7 @@ tryChargeBattery :: Item -> Creature -> World -> World tryChargeBattery _ _ w = w trySiphonFuel :: Item -> Creature -> World -> World -trySiphonFuel itm cr = id +trySiphonFuel _ _ = id --trySiphonFuel itm cr w = fromMaybe w $ do -- eix <- itm ^? itLocation . ipInvID -- hix <- cr ^? crManipulation . manObject . inInventory . ispItem diff --git a/src/Dodge/HeldUse.hs b/src/Dodge/HeldUse.hs index 1a8b27a5f..f36ebf877 100644 --- a/src/Dodge/HeldUse.hs +++ b/src/Dodge/HeldUse.hs @@ -485,7 +485,7 @@ fireRemoteShell it cr w = j = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change caneStickSoundChoice :: Item -> SoundID -caneStickSoundChoice it = tap3S +caneStickSoundChoice _ = tap3S -- -- | (it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded) < 2 = tap3S -- -- | otherwise = shotgunS diff --git a/src/Dodge/Item.hs b/src/Dodge/Item.hs index 8a21b05bf..99a70ee77 100644 --- a/src/Dodge/Item.hs +++ b/src/Dodge/Item.hs @@ -30,6 +30,7 @@ itemFromAttachType at = case at of SCROLLATTACH ZOOMSCOPE -> zoomScope AMMOATTACH DRUMMAG -> drumMag AMMOATTACH TINMAG -> tinMag + AMMOATTACH REVOLVEMAG -> revolveMag AMMOATTACH BULLETBELT -> beltMag TARGETATTACH tt -> targetingScope tt diff --git a/src/Dodge/Item/Display.hs b/src/Dodge/Item/Display.hs index 7a2ab032c..019382fe3 100644 --- a/src/Dodge/Item/Display.hs +++ b/src/Dodge/Item/Display.hs @@ -8,11 +8,11 @@ module Dodge.Item.Display ( basicItemDisplay, ) where -import Control.Applicative -import Control.Monad +--import Control.Applicative +--import Control.Monad import Data.Maybe import Dodge.Data.Creature -import Dodge.Item.Info +--import Dodge.Item.Info import Dodge.Item.SlotsTaken import Dodge.Module import LensHelp @@ -84,7 +84,7 @@ itemBaseName it = case _iyBase $ _itType it of ATTACH ait -> showAttachItem ait showAttachItem :: AttachType -> String -showAttachItem at = case at of +showAttachItem t = case t of SCROLLATTACH x -> show x AMMOATTACH x -> show x TARGETATTACH x -> show x @@ -129,7 +129,7 @@ itemNumberDisplay cr itm = case iu of iu = itm ^?! itUse showEquipmentNumber :: Creature -> Item -> [String] -showEquipmentNumber cr itm = case _eeUse ee of +showEquipmentNumber _ itm = case _eeUse ee of EFuelSource x _ -> [show x] EAmmoSource{_euseAmmoAmount = x} -> [show x]--showAmmoSource cr itm EBatterySource{_euseBatteryAmount = x} -> [show x] @@ -152,7 +152,7 @@ showEquipmentNumber cr itm = case _eeUse ee of -- <|> Just [x] showReloadProgress :: Creature -> Item -> String -showReloadProgress cr itm = fromMaybe [] $ do +showReloadProgress _ itm = fromMaybe [] $ do ia <- itm ^? itUse . attachParams . ammoAttachParams return $ case ia ^? iaProgress . _Just . ix 0 of Nothing -> maybe "" show $ ia ^? iaLoaded diff --git a/src/Dodge/Item/Draw/SPic.hs b/src/Dodge/Item/Draw/SPic.hs index 3f2ede4bc..155cca24b 100644 --- a/src/Dodge/Item/Draw/SPic.hs +++ b/src/Dodge/Item/Draw/SPic.hs @@ -4,13 +4,13 @@ module Dodge.Item.Draw.SPic ( import Color import qualified Data.Map.Strict as M -import Data.Maybe +--import Data.Maybe import Dodge.Data.Item -import Dodge.Item.AmmoPosition +--import Dodge.Item.AmmoPosition --import Dodge.Item.Weapon.FractionLoaded import Geometry import LensHelp -import qualified Linear.Quaternion as Q +--import qualified Linear.Quaternion as Q import Picture import Shape import ShapePicture @@ -64,76 +64,76 @@ leftItemSPic lt _ = case lt of BLINKER -> defSPic _ -> defSPic -ammoPosition :: Item -> HeldItemType -> AmmoPosition -ammoPosition itm hit = case hit of - FLATSHIELD -> NoAmmoPosition - FORCEFIELDGUN -> NoAmmoPosition - TORCH -> NoAmmoPosition - BANGSTICK i -> bangStickAmmoPos i itm - PISTOL -> Magazine (V3 5 2 0) lhs - MACHINEPISTOL -> Magazine (V3 5 2 0) lhs - AUTOPISTOL -> Magazine (V3 5 2 0) lhs - SMG -> Magazine (V3 7 (-2) 0) rhs - BANGCONE -> NoAmmoPosition - BLUNDERBUSS -> NoAmmoPosition - GRAPECANNON _ -> NoAmmoPosition - MINIGUNX _ -> NoAmmoPosition - VOLLEYGUN i -> volleygunAmmoPos i - MULTIGUN i -> multigunAmmoPos i - RIFLE -> Bullets [(V3 5 0 3, Q.axisAngle (V3 1 0 0) 0)] - REPEATER -> Magazine (V3 10 (-2) 0) rhs - AUTORIFLE -> Magazine (V3 10 (-2) 0) rhs - BURSTRIFLE -> Magazine (V3 10 (-2) 0) rhs - BANGROD -> Bullets [(V3 5 0 3, Q.axisAngle (V3 1 0 0) 0)] - ELEPHANTGUN -> Bullets [(V3 5 0 3, Q.axisAngle (V3 1 0 0) 0)] - AMR -> Magazine (V3 10 (-2) 0) rhs - AUTOAMR -> Magazine (V3 10 (-2) 0) rhs - SNIPERRIFLE -> Bullets [(V3 5 0 3, Q.axisAngle (V3 1 0 0) 0)] - MACHINEGUN -> Magazine (V3 10 (-2) 0) rhs - FLAMESPITTER -> NoAmmoPosition - FLAMETHROWER -> NoAmmoPosition - FLAMETORRENT -> NoAmmoPosition - FLAMEWALL -> NoAmmoPosition - BLOWTORCH -> NoAmmoPosition - SPARKGUN -> NoAmmoPosition - TESLAGUN -> NoAmmoPosition - LASGUN -> NoAmmoPosition - LASCIRCLE -> NoAmmoPosition - DUALBEAM -> NoAmmoPosition - LASWIDE _ -> NoAmmoPosition - --SONICGUN -> noPic baseSonicShape - TRACTORGUN -> NoAmmoPosition - LAUNCHER -> NoAmmoPosition - LAUNCHERX _ -> NoAmmoPosition - REMOTELAUNCHER -> NoAmmoPosition - POISONSPRAYER -> NoAmmoPosition - DRONELAUNCHER -> NoAmmoPosition - SHATTERGUN -> NoAmmoPosition - HELDDETECTOR _ -> NoAmmoPosition - KEYCARD _ -> NoAmmoPosition - where - lhs = Q.axisAngle (V3 1 0 0) pi - rhs = Q.axisAngle (V3 1 0 0) 0 +--ammoPosition :: Item -> HeldItemType -> AmmoPosition +--ammoPosition itm hit = case hit of +-- FLATSHIELD -> NoAmmoPosition +-- FORCEFIELDGUN -> NoAmmoPosition +-- TORCH -> NoAmmoPosition +-- BANGSTICK i -> bangStickAmmoPos i itm +-- PISTOL -> Magazine (V3 5 2 0) lhs +-- MACHINEPISTOL -> Magazine (V3 5 2 0) lhs +-- AUTOPISTOL -> Magazine (V3 5 2 0) lhs +-- SMG -> Magazine (V3 7 (-2) 0) rhs +-- BANGCONE -> NoAmmoPosition +-- BLUNDERBUSS -> NoAmmoPosition +-- GRAPECANNON _ -> NoAmmoPosition +-- MINIGUNX _ -> NoAmmoPosition +-- VOLLEYGUN i -> volleygunAmmoPos i +-- MULTIGUN i -> multigunAmmoPos i +-- RIFLE -> Bullets [(V3 5 0 3, Q.axisAngle (V3 1 0 0) 0)] +-- REPEATER -> Magazine (V3 10 (-2) 0) rhs +-- AUTORIFLE -> Magazine (V3 10 (-2) 0) rhs +-- BURSTRIFLE -> Magazine (V3 10 (-2) 0) rhs +-- BANGROD -> Bullets [(V3 5 0 3, Q.axisAngle (V3 1 0 0) 0)] +-- ELEPHANTGUN -> Bullets [(V3 5 0 3, Q.axisAngle (V3 1 0 0) 0)] +-- AMR -> Magazine (V3 10 (-2) 0) rhs +-- AUTOAMR -> Magazine (V3 10 (-2) 0) rhs +-- SNIPERRIFLE -> Bullets [(V3 5 0 3, Q.axisAngle (V3 1 0 0) 0)] +-- MACHINEGUN -> Magazine (V3 10 (-2) 0) rhs +-- FLAMESPITTER -> NoAmmoPosition +-- FLAMETHROWER -> NoAmmoPosition +-- FLAMETORRENT -> NoAmmoPosition +-- FLAMEWALL -> NoAmmoPosition +-- BLOWTORCH -> NoAmmoPosition +-- SPARKGUN -> NoAmmoPosition +-- TESLAGUN -> NoAmmoPosition +-- LASGUN -> NoAmmoPosition +-- LASCIRCLE -> NoAmmoPosition +-- DUALBEAM -> NoAmmoPosition +-- LASWIDE _ -> NoAmmoPosition +-- --SONICGUN -> noPic baseSonicShape +-- TRACTORGUN -> NoAmmoPosition +-- LAUNCHER -> NoAmmoPosition +-- LAUNCHERX _ -> NoAmmoPosition +-- REMOTELAUNCHER -> NoAmmoPosition +-- POISONSPRAYER -> NoAmmoPosition +-- DRONELAUNCHER -> NoAmmoPosition +-- SHATTERGUN -> NoAmmoPosition +-- HELDDETECTOR _ -> NoAmmoPosition +-- KEYCARD _ -> NoAmmoPosition +-- where +-- lhs = Q.axisAngle (V3 1 0 0) pi +-- rhs = Q.axisAngle (V3 1 0 0) 0 -bangStickAmmoPos :: Int -> Item -> AmmoPosition -bangStickAmmoPos _ itm = - Bullets - [(rotate3z a (V3 5 0 3), Q.axisAngle (V3 0 0 1) a) - | a <- map _mzRot (itm ^?! itUse . heldAim . aimMuzzles)] +--bangStickAmmoPos :: Int -> Item -> AmmoPosition +--bangStickAmmoPos _ itm = +-- Bullets +-- [(rotate3z a (V3 5 0 3), Q.axisAngle (V3 0 0 1) a) +-- | a <- map _mzRot (itm ^?! itUse . heldAim . aimMuzzles)] -volleygunAmmoPos :: Int -> AmmoPosition -volleygunAmmoPos i = - Bullets - [(V3 5 (f n) 3, Q.axisAngle (V3 1 0 0) 0) | n <- [0 .. i -1]] - where - f n = fromIntegral n * 5 - ((fromIntegral i - 1) * 2.5) - -multigunAmmoPos :: Int -> AmmoPosition -multigunAmmoPos i = - Bullets - [(V3 5 (f n) 3, Q.axisAngle (V3 1 0 0) 0) | n <- [0 .. i -1]] - where - f n = fromIntegral n * 5 - ((fromIntegral i - 1) * 2.5) +--volleygunAmmoPos :: Int -> AmmoPosition +--volleygunAmmoPos i = +-- Bullets +-- [(V3 5 (f n) 3, Q.axisAngle (V3 1 0 0) 0) | n <- [0 .. i -1]] +-- where +-- f n = fromIntegral n * 5 - ((fromIntegral i - 1) * 2.5) +-- +--multigunAmmoPos :: Int -> AmmoPosition +--multigunAmmoPos i = +-- Bullets +-- [(V3 5 (f n) 3, Q.axisAngle (V3 1 0 0) 0) | n <- [0 .. i -1]] +-- where +-- f n = fromIntegral n * 5 - ((fromIntegral i - 1) * 2.5) --revolverAmmoPos :: AmmoPosition --revolverAmmoPos = @@ -254,39 +254,39 @@ baseRifleShape = colorSH red $ xCylinderST 3 25 -- ps <- fmap (take x) $ ammoPosition itm hit ^? amPosDirs -- return $ foldMap (uncurry (drawBullet itm)) ps --- why is this duplicated? -drawBullet :: Item -> Point3 -> Q.Quaternion Float -> Shape -drawBullet itm p q = - translateSH p $ - overPosSH (Q.rotate q) $ - colorSH - midcol - ( upperPrismPolyTS 0.2 $ - reverse - (rectNSWE 0.2 (- 0.2) (-1) 1) - ) - <> tip - <> foot - where - midcol = - maybe - black - bulletEffectColor - (itm ^? itUse . heldConsumption . laAmmoType . amBullet . buEffect) - tip = fromMaybe mempty $ do - ebt <- itm ^? itUse . heldConsumption . laAmmoType . amBullet . buSpawn - return $ - colorSH (bulletPayloadColor ebt) $ - upperPrismPolyTS 0.2 $ - reverse $ - rectNSWE 0.2 (- 0.2) 1 2 - foot = fromMaybe mempty $ do - ebt <- itm ^? itUse . heldConsumption . laAmmoType . amBullet . buTrajectory - return $ - colorSH (bulletTrajColor ebt) $ - upperPrismPolyTS 0.2 $ - reverse $ - rectNSWE 0.2 (- 0.2) (-2) (-1) +---- why is this duplicated? +--drawBullet :: Item -> Point3 -> Q.Quaternion Float -> Shape +--drawBullet itm p q = +-- translateSH p $ +-- overPosSH (Q.rotate q) $ +-- colorSH +-- midcol +-- ( upperPrismPolyTS 0.2 $ +-- reverse +-- (rectNSWE 0.2 (- 0.2) (-1) 1) +-- ) +-- <> tip +-- <> foot +-- where +-- midcol = +-- maybe +-- black +-- bulletEffectColor +-- (itm ^? itUse . heldConsumption . laAmmoType . amBullet . buEffect) +-- tip = fromMaybe mempty $ do +-- ebt <- itm ^? itUse . heldConsumption . laAmmoType . amBullet . buSpawn +-- return $ +-- colorSH (bulletPayloadColor ebt) $ +-- upperPrismPolyTS 0.2 $ +-- reverse $ +-- rectNSWE 0.2 (- 0.2) 1 2 +-- foot = fromMaybe mempty $ do +-- ebt <- itm ^? itUse . heldConsumption . laAmmoType . amBullet . buTrajectory +-- return $ +-- colorSH (bulletTrajColor ebt) $ +-- upperPrismPolyTS 0.2 $ +-- reverse $ +-- rectNSWE 0.2 (- 0.2) (-2) (-1) addTinClip :: Item -> Shape addTinClip _ = mempty @@ -333,33 +333,33 @@ addTinClip _ = mempty -- reverse $ -- rectNSWE 0 (- y) (-2) (-1) -bulletEffectColor :: BulletEffect -> Color -bulletEffectColor x = case x of - DestroyBullet -> black - BounceBullet -> mixColors 0.5 0.5 black yellow - PenetrateBullet -> mixColors 0.5 0.5 black blue +--bulletEffectColor :: BulletEffect -> Color +--bulletEffectColor x = case x of +-- DestroyBullet -> black +-- BounceBullet -> mixColors 0.5 0.5 black yellow +-- PenetrateBullet -> mixColors 0.5 0.5 black blue -bulletTrajColor :: BulletTrajectory -> Color -bulletTrajColor x = case x of - BasicBulletTrajectory -> black - BezierTrajectory{} -> chartreuse - FlechetteTrajectory{} -> white - MagnetTrajectory{} -> yellow +--bulletTrajColor :: BulletTrajectory -> Color +--bulletTrajColor x = case x of +-- BasicBulletTrajectory -> black +-- BezierTrajectory{} -> chartreuse +-- FlechetteTrajectory{} -> white +-- MagnetTrajectory{} -> yellow -bulletPayloadColor :: BulletSpawn -> Color -bulletPayloadColor x = case x of - BulBall y -> energyBallColor y - BulSpark -> black - BulFlak -> chartreuse - BulFrag -> magenta - BulGas -> green +--bulletPayloadColor :: BulletSpawn -> Color +--bulletPayloadColor x = case x of +-- BulBall y -> energyBallColor y +-- BulSpark -> black +-- BulFlak -> chartreuse +-- BulFrag -> magenta +-- BulGas -> green -energyBallColor :: EnergyBallType -> Color -energyBallColor ebt = case ebt of - IncBall -> orange - TeslaBall -> cyan - ConcBall -> white - FlashBall -> yellow +--energyBallColor :: EnergyBallType -> Color +--energyBallColor ebt = case ebt of +-- IncBall -> orange +-- TeslaBall -> cyan +-- ConcBall -> white +-- FlashBall -> yellow volleyGunShape :: Int -> Shape volleyGunShape i = @@ -404,7 +404,8 @@ baseSMGShape :: Shape baseSMGShape = colorSH green $ xCylinderST 3 20 flamerPic :: Item -> SPic -flamerPic it = +--flamerPic it = +flamerPic _ = ( colorSH yellow $ translateSHxy tx ty (upperPrismPolyST tz $ polyCirc 3 r) <> xCylinderST 5 18 @@ -445,7 +446,8 @@ teslaGunPic = xb = 9 lasGunPic :: Item -> SPic -lasGunPic it = +--lasGunPic it = +lasGunPic _ = ( colorSH blue $ upperBoxST 4 (rectNESW 3 30 1 0) <> upperBoxSU 4 (rectNESW (-1) 30 (-3) 0) diff --git a/src/Dodge/Item/Held/BatteryGuns.hs b/src/Dodge/Item/Held/BatteryGuns.hs index 31b6aa69a..a8a64fd62 100644 --- a/src/Dodge/Item/Held/BatteryGuns.hs +++ b/src/Dodge/Item/Held/BatteryGuns.hs @@ -7,7 +7,7 @@ import Color import Control.Lens import qualified Data.Map.Strict as M import Dodge.Data.Item -import Dodge.Reloading.Action +--import Dodge.Reloading.Action import Dodge.Tesla.ItemParams import Geometry.Data import qualified IntMapHelp as IM diff --git a/src/Dodge/Item/Held/Cane.hs b/src/Dodge/Item/Held/Cane.hs index 37302dea7..c4ce37142 100644 --- a/src/Dodge/Item/Held/Cane.hs +++ b/src/Dodge/Item/Held/Cane.hs @@ -11,7 +11,7 @@ module Dodge.Item.Held.Cane ( import Dodge.Base import Dodge.Data.Item import Dodge.Default -import Dodge.Reloading.Action +--import Dodge.Reloading.Action import Geometry.Data import LensHelp diff --git a/src/Dodge/Item/Held/Cone.hs b/src/Dodge/Item/Held/Cone.hs index 83eb4e797..036994580 100644 --- a/src/Dodge/Item/Held/Cone.hs +++ b/src/Dodge/Item/Held/Cone.hs @@ -3,7 +3,7 @@ module Dodge.Item.Held.Cone where import Control.Lens import Dodge.Data.Item import Dodge.Default.Item -import Dodge.Reloading.Action +--import Dodge.Reloading.Action import Geometry.Data import Linear diff --git a/src/Dodge/Item/Held/Launcher.hs b/src/Dodge/Item/Held/Launcher.hs index b10f0ac0f..c823fd29d 100644 --- a/src/Dodge/Item/Held/Launcher.hs +++ b/src/Dodge/Item/Held/Launcher.hs @@ -1,7 +1,7 @@ module Dodge.Item.Held.Launcher where import Dodge.Default.Item -import Dodge.Reloading.Action +--import Dodge.Reloading.Action import Control.Lens import Dodge.Data.Item import qualified IntMapHelp as IM diff --git a/src/Dodge/Item/Held/Rod.hs b/src/Dodge/Item/Held/Rod.hs index de8345a8a..d1291f00e 100644 --- a/src/Dodge/Item/Held/Rod.hs +++ b/src/Dodge/Item/Held/Rod.hs @@ -10,7 +10,7 @@ module Dodge.Item.Held.Rod ( import Dodge.Data.Item import Dodge.Default import Dodge.Item.Weapon.Bullet -import Dodge.Reloading.Action +--import Dodge.Reloading.Action import Geometry import LensHelp diff --git a/src/Dodge/Item/Held/SprayGuns.hs b/src/Dodge/Item/Held/SprayGuns.hs index 2ea7bac40..79e01c2ce 100644 --- a/src/Dodge/Item/Held/SprayGuns.hs +++ b/src/Dodge/Item/Held/SprayGuns.hs @@ -9,7 +9,7 @@ module Dodge.Item.Held.SprayGuns ( import Dodge.Data.Item import Dodge.Default.Item -import Dodge.Reloading.Action +--import Dodge.Reloading.Action import Geometry import LensHelp diff --git a/src/Dodge/Item/Held/Stick.hs b/src/Dodge/Item/Held/Stick.hs index 18dc7abbc..8db79a2ac 100644 --- a/src/Dodge/Item/Held/Stick.hs +++ b/src/Dodge/Item/Held/Stick.hs @@ -9,7 +9,7 @@ module Dodge.Item.Held.Stick ( import Dodge.Base import Dodge.Data.Item import Dodge.Default.Item -import Dodge.Reloading.Action +--import Dodge.Reloading.Action import Geometry import LensHelp diff --git a/src/Dodge/Item/Info.hs b/src/Dodge/Item/Info.hs index 9331cbb32..29597a494 100644 --- a/src/Dodge/Item/Info.hs +++ b/src/Dodge/Item/Info.hs @@ -71,7 +71,8 @@ heldInfo hit = case hit of GRAPECANNON 1 -> "A large container for debris on the end of a stick. Explosive action propels the debris away from the user." GRAPECANNON i -> "An " ++ replicate (i -1) 'X' ++ "L container for debris on the end of a stick. Explosive action propels the debris away from the user." MINIGUNX i -> over _head toUpper (showInt i) ++ " gun barrels that revolve rapidly around a central stick. Requires considerable time to warm up, but has an extremely rapid rate of fire. It is also extremely difficult to stabilise." - VOLLEYGUN i -> over _head toUpper (showInt i) ++ " gun barrels lined up to be roughly parallel. Each barrel must be individually loaded, but not all need be loaded for the weapon to fire. All loaded barrels discharge simultaneously." + VOLLEYGUN i -> over _head toUpper (showInt i) ++ " gun barrels lined up to be roughly parallel. Draws bullets from a single magazine. All loaded barrels discharge simultaneously." + MULTIGUN i -> over _head toUpper (showInt i) ++ " gun barrels lined up to be roughly parallel. Each barrel requires a separate magazine. All barrels must be loaded to fire." RIFLE -> "A firearm with a mid length barrel that requires reloading after each shot." REPEATER -> "A firearm fed by a magazine. The entire magazine must be replaced when reloading the weapon." AUTORIFLE -> "A firearm automatically fed by a magazine. The entire magazine must be replaced when reloading the weapon." diff --git a/src/Dodge/Item/Weapon/TriggerType.hs b/src/Dodge/Item/Weapon/TriggerType.hs index 7d369583d..e15587ada 100644 --- a/src/Dodge/Item/Weapon/TriggerType.hs +++ b/src/Dodge/Item/Weapon/TriggerType.hs @@ -654,7 +654,7 @@ repeatOnFrames is hm f it cr w = -- return $ f it cr' w' duplicateLoaded :: ChainEffect -duplicateLoaded eff it cr w = foldr f w (take numbul [1 .. ]) +duplicateLoaded eff it cr w = foldr f w (take numbul [1::Int .. ]) where f _ = eff it cr numbul = fromMaybe 0 $ do diff --git a/src/Dodge/Reloading.hs b/src/Dodge/Reloading.hs index ddc3f1b06..f897b0ee3 100644 --- a/src/Dodge/Reloading.hs +++ b/src/Dodge/Reloading.hs @@ -34,7 +34,7 @@ stepReloading cr = case cr ^? crManipulation . manObject . inInventory of tryNextLoadAction :: Creature -> Creature tryNextLoadAction cr = case cr ^? crManipulation . manObject . inInventory of - Just (SelItem i _) -> case cr ^? crInv . ix i . itUse . attachParams . ammoAttachParams . iaProgress . _Just . ix 0 of + Just (SelItem i _) -> case cr ^? crInv . ix (i + 1) . itUse . attachParams . ammoAttachParams . iaProgress . _Just . ix 0 of Nothing -> cr & crManipulation . manObject . inInventory . iselAction .~ NoInvSelAction Just la -> cr & crManipulation . manObject . inInventory . iselAction . actionProgress .~ _actionTime la