Tweak module display and logic

This commit is contained in:
2023-01-12 12:51:24 +00:00
parent 94c0af97fd
commit 37e26f53e6
19 changed files with 250 additions and 80 deletions
+67 -5
View File
@@ -9,10 +9,11 @@ import LensHelp
import Picture
import Shape
import ShapePicture
import qualified Data.Map.Strict as M
itemSPic :: Item -> SPic
itemSPic it =
foldMap (modulesSPic it) (_iyModules $ _itType it) <> case it ^. itType . iyBase of
M.foldMapWithKey (modulesSPic it) (_iyModules $ _itType it) <> case it ^. itType . iyBase of
NoItemType -> over _1 (colorSH magenta) defSPic
CRAFT _ -> defSPic
HELD ht -> heldItemSPic ht it
@@ -55,6 +56,56 @@ leftItemSPic lt _ = case lt of
BLINKER -> defSPic
_ -> defSPic
magazinePosition :: HeldItemType -> Maybe (Point3, Point3)
magazinePosition hit = case hit of
FLATSHIELD -> Nothing
FORCEFIELDGUN -> Nothing
TORCH -> Nothing
BANGSTICK _ -> Nothing
PISTOL -> Just (V3 5 2 0, V3 0 1 0)
REVOLVER -> Nothing
REVOLVERX _ -> Nothing
MACHINEPISTOL -> Just (V3 5 2 0, V3 0 1 0)
AUTOPISTOL -> Just (V3 5 2 0, V3 0 1 0)
SMG -> Just (V3 7 (-2) 0 , V3 0 0 0)
BANGCONE -> Nothing
BLUNDERBUSS -> Nothing
GRAPECANNON _ -> Nothing
MINIGUNX _ -> Nothing
VOLLEYGUN _ -> Nothing
RIFLE -> Nothing
REPEATER -> Just (V3 10 (-2) 0 , V3 0 0 0)
AUTORIFLE -> Just (V3 10 (-2) 0 , V3 0 0 0)
BURSTRIFLE -> Just (V3 10 (-2) 0 , V3 0 0 0)
BANGROD -> Nothing
ELEPHANTGUN -> Nothing
AMR -> Just (V3 10 (-2) 0 , V3 0 0 0)
AUTOAMR -> Just (V3 10 (-2) 0 , V3 0 0 0)
SNIPERRIFLE -> Nothing
MACHINEGUN -> Just (V3 10 (-2) 0 , V3 0 0 0)
FLAMESPITTER -> Nothing
FLAMETHROWER -> Nothing
FLAMETORRENT -> Nothing
FLAMEWALL -> Nothing
BLOWTORCH -> Nothing
SPARKGUN -> Nothing
TESLAGUN -> Nothing
LASGUN -> Nothing
LASCIRCLE -> Nothing
DUALBEAM -> Nothing
LASWIDE _ -> Nothing
--SONICGUN -> noPic baseSonicShape
TRACTORGUN -> Nothing
LAUNCHER -> Nothing
LAUNCHERX _ -> Nothing
REMOTELAUNCHER -> Nothing
POISONSPRAYER -> Nothing
DRONELAUNCHER -> Nothing
SHATTERGUN -> Nothing
HELDDETECTOR _ -> Nothing
KEYCARD _ -> Nothing
BINOCULARS -> Nothing
heldItemSPic :: HeldItemType -> Item -> SPic
heldItemSPic ht it = case ht of
FLATSHIELD -> flatShieldEquipSPic
@@ -131,8 +182,8 @@ torchShape =
bot = upperPrismPoly 0.5 $ rectXH 9 2
back = upperPrismPoly 3 $ rectXH 1 2
modulesSPic :: Item -> ItemModuleType -> SPic
modulesSPic it imt = case imt of
modulesSPic :: Item -> ModuleSlot -> ItemModuleType -> SPic
modulesSPic it _ imt = case imt of
ATTACHTORCH -> noPic (overPosSH (+.+.+ _dimAttachPos (_itDimension it)) torchShape)
_ -> mempty
@@ -189,12 +240,23 @@ makeSingleClipAt p it = case it ^? itUse . heldConsumption . laLoaded of
makeTinClipAt :: Float -> Point3 -> Item -> Shape
makeTinClipAt r p it =
translateSH p . overPosSH (rotate3z r) $
upperPrismPoly 1 $
(upperPrismPoly 1 $
reverse $
rectNSWE 0 (- y) (-2) 2
rectNSWE 0 (- y) (-2) 2) <> tips
where
y = fromIntegral y' * 0.3
y' = fromMaybe 0 $ it ^? itUse . heldConsumption . laLoaded
tips = fromMaybe mempty $ do
ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buSpawn . spawnEBT
return $ colorSH (bulletPayloadColor ebt) $ upperPrismPoly 1.1 $
reverse $
rectNSWE 0 (- y) (-2) (-1)
bulletPayloadColor :: EnergyBallType -> Color
bulletPayloadColor ebt = case ebt of
IncBall -> orange
TeslaBall -> cyan
ConcBall -> white
volleyGunSPic :: Int -> Item -> SPic
volleyGunSPic i it =