Destroying mounted lights flashes, move equipment datatype

This commit is contained in:
2022-07-13 19:45:23 +01:00
parent cede677560
commit 33e9b5b1f0
16 changed files with 118 additions and 96 deletions
+16 -14
View File
@@ -13,19 +13,21 @@ import Data.Maybe
itemSPic :: Item -> SPic
itemSPic it = modulesSPic it <> case it ^. itType . iyBase of
HELD ht -> heldItemSPic ht it
LEFT lt -> leftItemSPic lt it
EQUIP et -> equipItemSPic et it
NOTDEFINED -> defSPic
EFFGUN _ -> defSPic
AUTOEFFGUN _ -> defSPic
BOOSTER -> defSPic
REWINDER -> defSPic
BLINKER -> defSPic
BLINKERUNSAFE -> defSPic
SHRINKER -> defSPic
SPAWNER -> defSPic
--
CLICKDETECTOR dt -> (noPic (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2))
AUTODETECTOR dt -> (noPic (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2))
--
KEYCARD _ -> noShape (setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) keyPic)
--
MEDKIT _ -> defSPic
CRAFT _ -> defSPic
equipItemSPic :: EquipItemType -> Item -> SPic
equipItemSPic et _ = case et of
MAGSHIELD -> defSPic
FLAMESHIELD -> defSPic
FRONTARMOUR -> (emptySH , setDepth 20 $ pictures
@@ -44,12 +46,11 @@ itemSPic it = modulesSPic it <> case it ^. itType . iyBase of
JETPACK -> ((,) emptySH $ setDepth 20
$ pictures [color yellow $ polygon $ reverse $ rectNSWE 5 (-5) (-11) (-3) ]
)
--
KEYCARD _ -> noShape (setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) keyPic)
--
MEDKIT _ -> defSPic
CRAFT _ -> defSPic
AUTODETECTOR dt -> (noPic (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2))
leftItemSPic :: LeftItemType -> Item -> SPic
leftItemSPic lt _ = case lt of
BLINKER -> defSPic
_ -> defSPic
heldItemSPic :: HeldItemType -> Item -> SPic
heldItemSPic ht it = case ht of
FORCEFIELDGUN -> defSPic
@@ -98,6 +99,7 @@ heldItemSPic ht it = case ht of
POISONSPRAYER -> flamerPic it
DRONELAUNCHER -> defSPic
SHATTERGUN -> shatterGunSPic
HELDDETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2)
modulesSPic :: Item -> SPic
modulesSPic _ = mempty
+13 -13
View File
@@ -38,7 +38,7 @@ magShield = defaultEquipment
}
& itUse . eqEq . eqUse .~ useMagShield
& itUse . eqEq . eqSite .~ GoesOnWrist
& itType . iyBase .~ MAGSHIELD
& itType . iyBase .~ EQUIP MAGSHIELD
useMagShield :: Item -> Creature -> World -> World
useMagShield it cr w = w & magnets . at mgid ?~ themagnet
where
@@ -57,14 +57,14 @@ flameShield :: Item
flameShield = defaultEquipment
{ _itID = Nothing
} & itUse . eqEq . eqSite .~ GoesOnChest
& itType . iyBase .~ FLAMESHIELD
& itType . iyBase .~ EQUIP FLAMESHIELD
{- | Slows you down, blocks forward projectiles. -}
frontArmour :: Item
frontArmour = defaultEquipment
{ _itID = Nothing
}
& itUse . eqEq . eqSite .~ GoesOnChest
& itType . iyBase .~ FRONTARMOUR
& itType . iyBase .~ EQUIP FRONTARMOUR
wristArmour :: Item
wristArmour = defaultEquipment
@@ -74,7 +74,7 @@ wristArmour = defaultEquipment
& itUse . eqEq . eqOnEquip .~ onEquipWristShield
& itUse . eqEq . eqUse .~ setWristShieldPos
& itUse . eqEq . eqOnRemove .~ onRemoveWristShield
& itType . iyBase .~ WRISTARMOUR
& itType . iyBase .~ EQUIP WRISTARMOUR
onEquipWristShield :: Item -> Creature -> World -> World
onEquipWristShield itm cr w = w
@@ -128,7 +128,7 @@ flatShield = defaultEquipment
}
, _itInvSize = 3
}
& itType . iyBase .~ FLATSHIELD
& itType . iyBase .~ EQUIP FLATSHIELD
shieldWall :: Int -> Wall
shieldWall crid = defaultWall
@@ -196,7 +196,7 @@ jetPack = defaultEquipment
{ _itEffect = NoItEffect
, _itID = Nothing
} & itUse . eqEq . eqSite .~ GoesOnBack
& itType . iyBase .~ JETPACK
& itType . iyBase .~ EQUIP JETPACK
brainHat :: Item
brainHat = defaultEquipment
@@ -204,7 +204,7 @@ brainHat = defaultEquipment
, _itID = Nothing
}
& itUse . eqEq . eqSite .~ GoesOnHead
& itType . iyBase .~ BRAINHAT
& itType . iyBase .~ EQUIP BRAINHAT
headLamp1 :: Item
headLamp1 = defaultEquipment
@@ -213,7 +213,7 @@ headLamp1 = defaultEquipment
}
& itUse . eqEq . eqUse .~ createHeadLamp
& itUse . eqEq . eqSite .~ GoesOnHead
& itType . iyBase .~ HEADLAMP1
& itType . iyBase .~ EQUIP HEADLAMP1
headLamp :: Item
headLamp = defaultEquipment
{ _itEffect = NoItEffect
@@ -221,7 +221,7 @@ headLamp = defaultEquipment
}
& itUse . eqEq . eqUse .~ createHeadLamp
& itUse . eqEq . eqSite .~ GoesOnHead
& itType . iyBase .~ HEADLAMP
& itType . iyBase .~ EQUIP HEADLAMP
createHeadLamp :: Item -> Creature -> World -> World
@@ -234,13 +234,13 @@ powerLegs = defaultEquipment
, _itID = Nothing
}
& itUse . eqEq . eqSite .~ GoesOnLegs
& itType . iyBase .~ POWERLEGS
& itType . iyBase .~ EQUIP POWERLEGS
speedLegs :: Item
speedLegs = powerLegs
& itType . iyBase .~ SPEEDLEGS
& itType . iyBase .~ EQUIP SPEEDLEGS
jumpLegs :: Item
jumpLegs = powerLegs
& itType . iyBase .~ JUMPLEGS
& itType . iyBase .~ EQUIP JUMPLEGS
wristInvisibility :: Item
wristInvisibility = defaultEquipment
@@ -249,7 +249,7 @@ wristInvisibility = defaultEquipment
& itUse . eqEq . eqSite .~ GoesOnWrist
& itUse . eqEq . eqOnEquip .~ overCID (crCamouflage .~ Invisible)
& itUse . eqEq . eqOnRemove .~ overCID (crCamouflage .~ FullyVisible)
& itType . iyBase .~ INVISIBILITYEQUIPMENT GoesOnWrist
& itType . iyBase .~ EQUIP (INVISIBILITYEQUIPMENT GoesOnWrist)
overCID :: (Creature -> Creature) -> Item -> Creature -> World -> World
overCID f _ cr = creatures . ix (_crID cr) %~ f
+1 -1
View File
@@ -115,7 +115,7 @@ boosterGun = defaultLeftItem
, _itUse = luseInstantNoH $ boostSelfL 10
, _itEffect = resetAttachmentID
}
& itType . iyBase .~ BOOSTER
& itType . iyBase .~ LEFT BOOSTER
resetAttachmentID :: ItEffect
resetAttachmentID = ItInvEffect f 0
where
+2 -2
View File
@@ -22,7 +22,7 @@ clickDetector dt = defaultWeapon
]
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1}
& itType . iyBase .~ CLICKDETECTOR dt
& itType . iyBase .~ HELD (HELDDETECTOR dt)
autoDetector :: Detector -> Item
autoDetector dt = defaultEquipment
@@ -30,7 +30,7 @@ autoDetector dt = defaultEquipment
& itUse . eqEq . eqUse .~ autoEffect (detectorEffect dt) 100 click1S
& itUse . eqEq . eqParams .~ EquipCounter 0
& itUse . eqEq . eqViewDist ?~ 350
& itType . iyBase .~ AUTODETECTOR dt
& itType . iyBase .~ EQUIP (AUTODETECTOR dt)
-- , _itEffect = autoRadarEffect
detectorEffect :: Detector -> Item -> Creature -> World -> World
+1 -1
View File
@@ -22,7 +22,7 @@ spawnGun cr = defaultWeapon
[ ammoCheckI
, hammerCheckI
]
& itType . iyBase .~ SPAWNER
& itType . iyBase .~ LEFT SPAWNER
spawnCrNextTo
:: Creature -- ^ Creature to spawn
-> Creature -- ^ existing creature that will be spawned next to
+4 -4
View File
@@ -33,7 +33,7 @@ rewindGun = defaultLeftItem
& lUse .~ useRewindGun
& eqEq . eqSite .~ GoesOnChest
}
& itType . iyBase .~ REWINDER
& itType . iyBase .~ LEFT REWINDER
rewindEffect :: Item -> Creature -> World -> World
rewindEffect itm cr w
| Just invid == _crLeftInvSel cr = w & rewindWorlds %~ (take maxcharge . (w' : ))
@@ -68,7 +68,7 @@ shrinkGun = defaultLeftItem
-- , _itFloorPict = shrinkGunPic
, _itAttachment = AttachBool True
}
& itType . iyBase .~ SHRINKER
& itType . iyBase .~ LEFT SHRINKER
shrinkGunPic :: Item -> SPic
shrinkGunPic _ = noPic $ colorSH violet $ upperPrismPoly 5 $ square 5
@@ -94,11 +94,11 @@ blinkGun = defaultLeftItem
& eqEq . eqSite .~ GoesOnWrist
-- , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2
}
& itType . iyBase .~ BLINKER
& itType . iyBase .~ LEFT BLINKER
unsafeBlinkGun :: Item
unsafeBlinkGun = blinkGun
& itType . iyBase .~ BLINKERUNSAFE
& itType . iyBase .~ LEFT BLINKERUNSAFE
& itUse . lUse .~ hammerCheckL (shootL $ const unsafeBlinkAction)
& itUse . eqEq . eqViewDist ?~ 400