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
+2 -1
View File
@@ -4,6 +4,7 @@ import Dodge.Base.Collide
import Dodge.Material import Dodge.Material
import Dodge.Block.Debris import Dodge.Block.Debris
import Dodge.Zone import Dodge.Zone
import Dodge.LightSource
import Dodge.Wall.Zone import Dodge.Wall.Zone
import Dodge.WorldEvent.Sound import Dodge.WorldEvent.Sound
import Dodge.Wall.Delete import Dodge.Wall.Delete
@@ -87,7 +88,7 @@ destroyMounts mos w = foldr destroyMount w mos
destroyMount :: MountedObject -> World -> World destroyMount :: MountedObject -> World -> World
destroyMount mo = case mo of destroyMount mo = case mo of
MountedLS lsid -> lightSources . at lsid .~ Nothing MountedLS lsid -> destroyLS lsid
MountedProp prid -> props . at prid .~ Nothing MountedProp prid -> props . at prid .~ Nothing
stopPushing :: Maybe Int -> World -> World stopPushing :: Maybe Int -> World -> World
+1 -1
View File
@@ -70,7 +70,7 @@ itemCombinations =
, p [o (HELD SPARKGUN),p 2 $ cr PIPE] teslaGun , p [o (HELD SPARKGUN),p 2 $ cr PIPE] teslaGun
, p [o $ cr TELEPORTMODULE,p 2 $ cr MICROCHIP] blinkGun , p [o $ cr TELEPORTMODULE,p 2 $ cr MICROCHIP] blinkGun
, p [o BLINKER, p 2 $ cr MICROCHIP] unsafeBlinkGun , p [o $ LEFT BLINKER, p 2 $ cr MICROCHIP] unsafeBlinkGun
, po [cr MAGNET,cr TIN] magShield , po [cr MAGNET,cr TIN] magShield
+23 -15
View File
@@ -73,19 +73,22 @@ data ItemBaseType
| AUTOEFFGUN String | AUTOEFFGUN String
-- Weapons -- Weapons
| HELD {_ibtHeld :: HeldItemType} | HELD {_ibtHeld :: HeldItemType}
| LEFT {_ibtLeft :: LeftItemType}
| EQUIP {_ibtEquip :: EquipItemType}
-- | GRENADE -- | GRENADE
-- | REMOTEBOMB -- | REMOTEBOMB
-- Utility items -- Utility items
| BOOSTER
| REWINDER
| BLINKER
| BLINKERUNSAFE
| SHRINKER
| SPAWNER
-- Equipment -- Equipment
| CLICKDETECTOR Detector --
| AUTODETECTOR Detector | KEYCARD Int
| MAGSHIELD --
| MEDKIT Int
| CRAFT CraftType
--
deriving (Eq,Ord,Show,Read)
data EquipItemType
= MAGSHIELD
| FLAMESHIELD | FLAMESHIELD
| FRONTARMOUR | FRONTARMOUR
| WRISTARMOUR | WRISTARMOUR
@@ -98,12 +101,15 @@ data ItemBaseType
| JUMPLEGS | JUMPLEGS
| FLATSHIELD | FLATSHIELD
| JETPACK | JETPACK
-- | AUTODETECTOR Detector
| KEYCARD Int deriving (Eq,Ord,Show,Read)
-- data LeftItemType
| MEDKIT Int = BOOSTER
| CRAFT CraftType | REWINDER
-- | BLINKER
| BLINKERUNSAFE
| SHRINKER
| SPAWNER
deriving (Eq,Ord,Show,Read) deriving (Eq,Ord,Show,Read)
data HeldItemType data HeldItemType
@@ -163,6 +169,8 @@ data HeldItemType
| SHATTERGUN | SHATTERGUN
| FORCEFIELDGUN | FORCEFIELDGUN
| HELDDETECTOR Detector
deriving (Eq,Ord,Show,Read) deriving (Eq,Ord,Show,Read)
data ItemModuleType data ItemModuleType
+1 -1
View File
@@ -184,7 +184,7 @@ movementSideEff cr w
_ -> w _ -> w
| otherwise = footstepSideEffect cr w | otherwise = footstepSideEffect cr w
where where
hasJetPack = any (\it -> it ^? itType . iyBase == Just JETPACK) $ _crInv cr hasJetPack = any (\it -> it ^? itType . iyBase == Just (EQUIP JETPACK)) $ _crInv cr
oldPos = _crOldPos cr oldPos = _crOldPos cr
momentum' = 0.97 *.* (_crPos cr -.- _crOldPos cr) momentum' = 0.97 *.* (_crPos cr -.- _crOldPos cr)
momentum'' | magV momentum' > 3 = 3 *.* normalizeV momentum' momentum'' | magV momentum' > 3 = 3 *.* normalizeV momentum'
+2 -2
View File
@@ -21,8 +21,8 @@ strFromEquipment = sum . fmap equipmentStrValue . crCurrentEquipment
equipmentStrValue :: Item -> Int equipmentStrValue :: Item -> Int
equipmentStrValue itm = case _iyBase $ _itType itm of equipmentStrValue itm = case _iyBase $ _itType itm of
FRONTARMOUR -> negate 3 EQUIP FRONTARMOUR -> negate 3
POWERLEGS -> 3 EQUIP POWERLEGS -> 3
_ -> 0 _ -> 0
crCurrentEquipment :: Creature -> IM.IntMap Item crCurrentEquipment :: Creature -> IM.IntMap Item
+1 -1
View File
@@ -100,7 +100,7 @@ hasFrontArmour :: Point2 -> Creature -> Bool
hasFrontArmour p cr = fromMaybe False $ do hasFrontArmour p cr = fromMaybe False $ do
invid <- cr ^? crEquipment . ix OnChest invid <- cr ^? crEquipment . ix OnChest
ittype <- cr ^? crInv . ix invid . itType . iyBase ittype <- cr ^? crInv . ix invid . itType . iyBase
return $ FRONTARMOUR == ittype return $ EQUIP FRONTARMOUR == ittype
&& p /= _crOldPos cr && p /= _crOldPos cr
&& angleVV (unitVectorAtAngle (_crDir cr + frontarmdirection)) (p -.- _crOldPos cr) < pi/2 && angleVV (unitVectorAtAngle (_crDir cr + frontarmdirection)) (p -.- _crOldPos cr) < pi/2
-- even though angleVV can generate NaN, the comparison seems to deal with it -- even though angleVV can generate NaN, the comparison seems to deal with it
+22 -34
View File
@@ -23,18 +23,16 @@ itemFromBase ibt = case ibt of
AUTOEFFGUN _ -> undefined AUTOEFFGUN _ -> undefined
-- Weapons -- Weapons
HELD ht -> itemFromHeldType ht HELD ht -> itemFromHeldType ht
LEFT lt -> itemFromLeftType lt
EQUIP et -> itemFromEquipType et
--GRENADE --GRENADE
--REMOTEBOMB --REMOTEBOMB
-- Utility items -- Utility items
BOOSTER -> boosterGun CRAFT cr -> makeTypeCraft cr
REWINDER -> rewindGun KEYCARD i -> keyCard i
BLINKER -> blinkGun MEDKIT i -> medkit i
BLINKERUNSAFE -> unsafeBlinkGun itemFromEquipType :: EquipItemType -> Item
SHRINKER -> shrinkGun itemFromEquipType et = case et of
SPAWNER -> error "need to datify creatures first"
-- Equipment
CLICKDETECTOR d -> clickDetector d
AUTODETECTOR d -> autoDetector d
MAGSHIELD -> magShield MAGSHIELD -> magShield
FLAMESHIELD -> flameShield FLAMESHIELD -> flameShield
FRONTARMOUR -> frontArmour FRONTARMOUR -> frontArmour
@@ -49,9 +47,16 @@ itemFromBase ibt = case ibt of
JUMPLEGS -> jumpLegs JUMPLEGS -> jumpLegs
FLATSHIELD -> flatShield FLATSHIELD -> flatShield
JETPACK -> jetPack JETPACK -> jetPack
CRAFT cr -> makeTypeCraft cr AUTODETECTOR d -> autoDetector d
KEYCARD i -> keyCard i itemFromLeftType :: LeftItemType -> Item
MEDKIT i -> medkit i itemFromLeftType lt = case lt of
BOOSTER -> boosterGun
REWINDER -> rewindGun
BLINKER -> blinkGun
BLINKERUNSAFE -> unsafeBlinkGun
SHRINKER -> shrinkGun
SPAWNER -> error "need to datify creatures first"
-- Equipment
itemFromHeldType :: HeldItemType -> Item itemFromHeldType :: HeldItemType -> Item
itemFromHeldType ht = case ht of itemFromHeldType ht = case ht of
SHATTERGUN -> shatterGun SHATTERGUN -> shatterGun
@@ -109,34 +114,17 @@ itemFromHeldType ht = case ht of
POISONSPRAYER -> poisonSprayer POISONSPRAYER -> poisonSprayer
DRONELAUNCHER -> droneLauncher DRONELAUNCHER -> droneLauncher
FORCEFIELDGUN -> forceFieldGun FORCEFIELDGUN -> forceFieldGun
HELDDETECTOR d -> clickDetector d
baseToFamily :: ItemBaseType -> ItemFamily baseToFamily :: ItemBaseType -> ItemFamily
baseToFamily ibt = case ibt of baseToFamily ibt = case ibt of
NOTDEFINED -> undefined NOTDEFINED -> undefined
EFFGUN _ -> undefined EFFGUN _ -> undefined
AUTOEFFGUN _ -> undefined AUTOEFFGUN _ -> undefined
HELD _ -> HeldFamily HELD _ -> HeldFamily
BOOSTER -> LeftClickFamily LEFT _ -> LeftClickFamily
REWINDER -> LeftClickFamily EQUIP _ -> EquipmentFamily
BLINKER -> LeftClickFamily CRAFT _ -> CraftingFamily
BLINKERUNSAFE -> LeftClickFamily
SHRINKER -> LeftClickFamily
SPAWNER -> LeftClickFamily
CLICKDETECTOR _ -> HeldFamily
AUTODETECTOR _ -> LeftClickFamily
MAGSHIELD -> EquipmentFamily
FLAMESHIELD -> EquipmentFamily
FRONTARMOUR -> EquipmentFamily
WRISTARMOUR -> EquipmentFamily
INVISIBILITYEQUIPMENT _ -> EquipmentFamily
BRAINHAT -> EquipmentFamily
HEADLAMP -> EquipmentFamily
HEADLAMP1 -> EquipmentFamily
POWERLEGS -> EquipmentFamily
SPEEDLEGS -> EquipmentFamily
JUMPLEGS -> EquipmentFamily
FLATSHIELD -> EquipmentFamily
JETPACK -> EquipmentFamily
CRAFT _ -> CraftingFamily
KEYCARD _ -> HeldFamily KEYCARD _ -> HeldFamily
+16 -14
View File
@@ -13,19 +13,21 @@ import Data.Maybe
itemSPic :: Item -> SPic itemSPic :: Item -> SPic
itemSPic it = modulesSPic it <> case it ^. itType . iyBase of itemSPic it = modulesSPic it <> case it ^. itType . iyBase of
HELD ht -> heldItemSPic ht it HELD ht -> heldItemSPic ht it
LEFT lt -> leftItemSPic lt it
EQUIP et -> equipItemSPic et it
NOTDEFINED -> defSPic NOTDEFINED -> defSPic
EFFGUN _ -> defSPic EFFGUN _ -> defSPic
AUTOEFFGUN _ -> 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 MAGSHIELD -> defSPic
FLAMESHIELD -> defSPic FLAMESHIELD -> defSPic
FRONTARMOUR -> (emptySH , setDepth 20 $ pictures FRONTARMOUR -> (emptySH , setDepth 20 $ pictures
@@ -44,12 +46,11 @@ itemSPic it = modulesSPic it <> case it ^. itType . iyBase of
JETPACK -> ((,) emptySH $ setDepth 20 JETPACK -> ((,) emptySH $ setDepth 20
$ pictures [color yellow $ polygon $ reverse $ rectNSWE 5 (-5) (-11) (-3) ] $ pictures [color yellow $ polygon $ reverse $ rectNSWE 5 (-5) (-11) (-3) ]
) )
-- AUTODETECTOR dt -> (noPic (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2))
KEYCARD _ -> noShape (setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) keyPic) leftItemSPic :: LeftItemType -> Item -> SPic
-- leftItemSPic lt _ = case lt of
MEDKIT _ -> defSPic BLINKER -> defSPic
CRAFT _ -> defSPic _ -> defSPic
heldItemSPic :: HeldItemType -> Item -> SPic heldItemSPic :: HeldItemType -> Item -> SPic
heldItemSPic ht it = case ht of heldItemSPic ht it = case ht of
FORCEFIELDGUN -> defSPic FORCEFIELDGUN -> defSPic
@@ -98,6 +99,7 @@ heldItemSPic ht it = case ht of
POISONSPRAYER -> flamerPic it POISONSPRAYER -> flamerPic it
DRONELAUNCHER -> defSPic DRONELAUNCHER -> defSPic
SHATTERGUN -> shatterGunSPic SHATTERGUN -> shatterGunSPic
HELDDETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPoly 3 $ rectWH 2 2)
modulesSPic :: Item -> SPic modulesSPic :: Item -> SPic
modulesSPic _ = mempty modulesSPic _ = mempty
+13 -13
View File
@@ -38,7 +38,7 @@ magShield = defaultEquipment
} }
& itUse . eqEq . eqUse .~ useMagShield & itUse . eqEq . eqUse .~ useMagShield
& itUse . eqEq . eqSite .~ GoesOnWrist & itUse . eqEq . eqSite .~ GoesOnWrist
& itType . iyBase .~ MAGSHIELD & itType . iyBase .~ EQUIP MAGSHIELD
useMagShield :: Item -> Creature -> World -> World useMagShield :: Item -> Creature -> World -> World
useMagShield it cr w = w & magnets . at mgid ?~ themagnet useMagShield it cr w = w & magnets . at mgid ?~ themagnet
where where
@@ -57,14 +57,14 @@ flameShield :: Item
flameShield = defaultEquipment flameShield = defaultEquipment
{ _itID = Nothing { _itID = Nothing
} & itUse . eqEq . eqSite .~ GoesOnChest } & itUse . eqEq . eqSite .~ GoesOnChest
& itType . iyBase .~ FLAMESHIELD & itType . iyBase .~ EQUIP FLAMESHIELD
{- | Slows you down, blocks forward projectiles. -} {- | Slows you down, blocks forward projectiles. -}
frontArmour :: Item frontArmour :: Item
frontArmour = defaultEquipment frontArmour = defaultEquipment
{ _itID = Nothing { _itID = Nothing
} }
& itUse . eqEq . eqSite .~ GoesOnChest & itUse . eqEq . eqSite .~ GoesOnChest
& itType . iyBase .~ FRONTARMOUR & itType . iyBase .~ EQUIP FRONTARMOUR
wristArmour :: Item wristArmour :: Item
wristArmour = defaultEquipment wristArmour = defaultEquipment
@@ -74,7 +74,7 @@ wristArmour = defaultEquipment
& itUse . eqEq . eqOnEquip .~ onEquipWristShield & itUse . eqEq . eqOnEquip .~ onEquipWristShield
& itUse . eqEq . eqUse .~ setWristShieldPos & itUse . eqEq . eqUse .~ setWristShieldPos
& itUse . eqEq . eqOnRemove .~ onRemoveWristShield & itUse . eqEq . eqOnRemove .~ onRemoveWristShield
& itType . iyBase .~ WRISTARMOUR & itType . iyBase .~ EQUIP WRISTARMOUR
onEquipWristShield :: Item -> Creature -> World -> World onEquipWristShield :: Item -> Creature -> World -> World
onEquipWristShield itm cr w = w onEquipWristShield itm cr w = w
@@ -128,7 +128,7 @@ flatShield = defaultEquipment
} }
, _itInvSize = 3 , _itInvSize = 3
} }
& itType . iyBase .~ FLATSHIELD & itType . iyBase .~ EQUIP FLATSHIELD
shieldWall :: Int -> Wall shieldWall :: Int -> Wall
shieldWall crid = defaultWall shieldWall crid = defaultWall
@@ -196,7 +196,7 @@ jetPack = defaultEquipment
{ _itEffect = NoItEffect { _itEffect = NoItEffect
, _itID = Nothing , _itID = Nothing
} & itUse . eqEq . eqSite .~ GoesOnBack } & itUse . eqEq . eqSite .~ GoesOnBack
& itType . iyBase .~ JETPACK & itType . iyBase .~ EQUIP JETPACK
brainHat :: Item brainHat :: Item
brainHat = defaultEquipment brainHat = defaultEquipment
@@ -204,7 +204,7 @@ brainHat = defaultEquipment
, _itID = Nothing , _itID = Nothing
} }
& itUse . eqEq . eqSite .~ GoesOnHead & itUse . eqEq . eqSite .~ GoesOnHead
& itType . iyBase .~ BRAINHAT & itType . iyBase .~ EQUIP BRAINHAT
headLamp1 :: Item headLamp1 :: Item
headLamp1 = defaultEquipment headLamp1 = defaultEquipment
@@ -213,7 +213,7 @@ headLamp1 = defaultEquipment
} }
& itUse . eqEq . eqUse .~ createHeadLamp & itUse . eqEq . eqUse .~ createHeadLamp
& itUse . eqEq . eqSite .~ GoesOnHead & itUse . eqEq . eqSite .~ GoesOnHead
& itType . iyBase .~ HEADLAMP1 & itType . iyBase .~ EQUIP HEADLAMP1
headLamp :: Item headLamp :: Item
headLamp = defaultEquipment headLamp = defaultEquipment
{ _itEffect = NoItEffect { _itEffect = NoItEffect
@@ -221,7 +221,7 @@ headLamp = defaultEquipment
} }
& itUse . eqEq . eqUse .~ createHeadLamp & itUse . eqEq . eqUse .~ createHeadLamp
& itUse . eqEq . eqSite .~ GoesOnHead & itUse . eqEq . eqSite .~ GoesOnHead
& itType . iyBase .~ HEADLAMP & itType . iyBase .~ EQUIP HEADLAMP
createHeadLamp :: Item -> Creature -> World -> World createHeadLamp :: Item -> Creature -> World -> World
@@ -234,13 +234,13 @@ powerLegs = defaultEquipment
, _itID = Nothing , _itID = Nothing
} }
& itUse . eqEq . eqSite .~ GoesOnLegs & itUse . eqEq . eqSite .~ GoesOnLegs
& itType . iyBase .~ POWERLEGS & itType . iyBase .~ EQUIP POWERLEGS
speedLegs :: Item speedLegs :: Item
speedLegs = powerLegs speedLegs = powerLegs
& itType . iyBase .~ SPEEDLEGS & itType . iyBase .~ EQUIP SPEEDLEGS
jumpLegs :: Item jumpLegs :: Item
jumpLegs = powerLegs jumpLegs = powerLegs
& itType . iyBase .~ JUMPLEGS & itType . iyBase .~ EQUIP JUMPLEGS
wristInvisibility :: Item wristInvisibility :: Item
wristInvisibility = defaultEquipment wristInvisibility = defaultEquipment
@@ -249,7 +249,7 @@ wristInvisibility = defaultEquipment
& itUse . eqEq . eqSite .~ GoesOnWrist & itUse . eqEq . eqSite .~ GoesOnWrist
& itUse . eqEq . eqOnEquip .~ overCID (crCamouflage .~ Invisible) & itUse . eqEq . eqOnEquip .~ overCID (crCamouflage .~ Invisible)
& itUse . eqEq . eqOnRemove .~ overCID (crCamouflage .~ FullyVisible) & itUse . eqEq . eqOnRemove .~ overCID (crCamouflage .~ FullyVisible)
& itType . iyBase .~ INVISIBILITYEQUIPMENT GoesOnWrist & itType . iyBase .~ EQUIP (INVISIBILITYEQUIPMENT GoesOnWrist)
overCID :: (Creature -> Creature) -> Item -> Creature -> World -> World overCID :: (Creature -> Creature) -> Item -> Creature -> World -> World
overCID f _ cr = creatures . ix (_crID cr) %~ f overCID f _ cr = creatures . ix (_crID cr) %~ f
+1 -1
View File
@@ -115,7 +115,7 @@ boosterGun = defaultLeftItem
, _itUse = luseInstantNoH $ boostSelfL 10 , _itUse = luseInstantNoH $ boostSelfL 10
, _itEffect = resetAttachmentID , _itEffect = resetAttachmentID
} }
& itType . iyBase .~ BOOSTER & itType . iyBase .~ LEFT BOOSTER
resetAttachmentID :: ItEffect resetAttachmentID :: ItEffect
resetAttachmentID = ItInvEffect f 0 resetAttachmentID = ItInvEffect f 0
where where
+2 -2
View File
@@ -22,7 +22,7 @@ clickDetector dt = defaultWeapon
] ]
& itUse . useAim . aimRange .~ 1 & itUse . useAim . aimRange .~ 1
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1} & itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1}
& itType . iyBase .~ CLICKDETECTOR dt & itType . iyBase .~ HELD (HELDDETECTOR dt)
autoDetector :: Detector -> Item autoDetector :: Detector -> Item
autoDetector dt = defaultEquipment autoDetector dt = defaultEquipment
@@ -30,7 +30,7 @@ autoDetector dt = defaultEquipment
& itUse . eqEq . eqUse .~ autoEffect (detectorEffect dt) 100 click1S & itUse . eqEq . eqUse .~ autoEffect (detectorEffect dt) 100 click1S
& itUse . eqEq . eqParams .~ EquipCounter 0 & itUse . eqEq . eqParams .~ EquipCounter 0
& itUse . eqEq . eqViewDist ?~ 350 & itUse . eqEq . eqViewDist ?~ 350
& itType . iyBase .~ AUTODETECTOR dt & itType . iyBase .~ EQUIP (AUTODETECTOR dt)
-- , _itEffect = autoRadarEffect -- , _itEffect = autoRadarEffect
detectorEffect :: Detector -> Item -> Creature -> World -> World detectorEffect :: Detector -> Item -> Creature -> World -> World
+1 -1
View File
@@ -22,7 +22,7 @@ spawnGun cr = defaultWeapon
[ ammoCheckI [ ammoCheckI
, hammerCheckI , hammerCheckI
] ]
& itType . iyBase .~ SPAWNER & itType . iyBase .~ LEFT SPAWNER
spawnCrNextTo spawnCrNextTo
:: Creature -- ^ Creature to spawn :: Creature -- ^ Creature to spawn
-> Creature -- ^ existing creature that will be spawned next to -> Creature -- ^ existing creature that will be spawned next to
+4 -4
View File
@@ -33,7 +33,7 @@ rewindGun = defaultLeftItem
& lUse .~ useRewindGun & lUse .~ useRewindGun
& eqEq . eqSite .~ GoesOnChest & eqEq . eqSite .~ GoesOnChest
} }
& itType . iyBase .~ REWINDER & itType . iyBase .~ LEFT REWINDER
rewindEffect :: Item -> Creature -> World -> World rewindEffect :: Item -> Creature -> World -> World
rewindEffect itm cr w rewindEffect itm cr w
| Just invid == _crLeftInvSel cr = w & rewindWorlds %~ (take maxcharge . (w' : )) | Just invid == _crLeftInvSel cr = w & rewindWorlds %~ (take maxcharge . (w' : ))
@@ -68,7 +68,7 @@ shrinkGun = defaultLeftItem
-- , _itFloorPict = shrinkGunPic -- , _itFloorPict = shrinkGunPic
, _itAttachment = AttachBool True , _itAttachment = AttachBool True
} }
& itType . iyBase .~ SHRINKER & itType . iyBase .~ LEFT SHRINKER
shrinkGunPic :: Item -> SPic shrinkGunPic :: Item -> SPic
shrinkGunPic _ = noPic $ colorSH violet $ upperPrismPoly 5 $ square 5 shrinkGunPic _ = noPic $ colorSH violet $ upperPrismPoly 5 $ square 5
@@ -94,11 +94,11 @@ blinkGun = defaultLeftItem
& eqEq . eqSite .~ GoesOnWrist & eqEq . eqSite .~ GoesOnWrist
-- , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2 -- , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2
} }
& itType . iyBase .~ BLINKER & itType . iyBase .~ LEFT BLINKER
unsafeBlinkGun :: Item unsafeBlinkGun :: Item
unsafeBlinkGun = blinkGun unsafeBlinkGun = blinkGun
& itType . iyBase .~ BLINKERUNSAFE & itType . iyBase .~ LEFT BLINKERUNSAFE
& itUse . lUse .~ hammerCheckL (shootL $ const unsafeBlinkAction) & itUse . lUse .~ hammerCheckL (shootL $ const unsafeBlinkAction)
& itUse . eqEq . eqViewDist ?~ 400 & itUse . eqEq . eqViewDist ?~ 400
+22
View File
@@ -10,11 +10,16 @@ module Dodge.LightSource
, lsPosRad , lsPosRad
, lsColPosID , lsColPosID
, makeTlsTimeRadColPos , makeTlsTimeRadColPos
, destroyLS
) where ) where
import Dodge.Data import Dodge.Data
import Geometry.Data import Geometry.Data
import Geometry.Vector
import Geometry.Vector3D
import Dodge.Default.LightSource import Dodge.Default.LightSource
import LensHelp import LensHelp
import Dodge.WorldEvent.Sound
import Dodge.Material
lsPosRad :: Point3 -> Float -> LightSource lsPosRad :: Point3 -> Float -> LightSource
lsPosRad = lsColPosRad 0.75 lsPosRad = lsColPosRad 0.75
@@ -85,3 +90,20 @@ tlsTimeRadColPos t rmax col (V3 x y z) = TLS
makeTlsTimeRadColPos :: Int -> Float -> Point3 -> Point3 -> World -> World makeTlsTimeRadColPos :: Int -> Float -> Point3 -> Point3 -> World -> World
makeTlsTimeRadColPos i rad (V3 r g b) p = tempLightSources .:~ tlsTimeRadColPos i rad (V3 r g b) p makeTlsTimeRadColPos i rad (V3 r g b) p = tempLightSources .:~ tlsTimeRadColPos i rad (V3 r g b) p
destroyLS :: Int -> World -> World
destroyLS lsid w = w
& lightSources . at lsid .~ Nothing
& destroyLSFlashAt p3
& originsIDsAt [MaterialSound Glass n | n <- [0,1,2]] (destroyMatS Glass) (xyV3 p3)
where
ls = w ^?! lightSources . ix lsid
p3 = _lsPos $ _lsParam ls
destroyLSFlashAt :: Point3 -> World -> World
destroyLSFlashAt (V3 x' y' z') = tempLightSources .:~ tlsTimeRadFunPos 20 150 intensityFunc (addZ z' p)
where
p = V2 x' y'
intensityFunc x
| x < 10 = 1 / (10 - fromIntegral x)
| otherwise = 1
+6 -6
View File
@@ -19,22 +19,22 @@ bossKeyItems = [(return . cleatOnward <$> bossRoom autoCrit, takeOne [HELD PISTO
lockRoomMultiItems :: RandomGen g => [ ( State g (MetaTree Room String) , State g [ItemBaseType] ) ] lockRoomMultiItems :: RandomGen g => [ ( State g (MetaTree Room String) , State g [ItemBaseType] ) ]
lockRoomMultiItems = lockRoomMultiItems =
[ (blinkAcrossChallenge, takeOne [[BLINKERUNSAFE,AUTODETECTOR WALLDETECTOR] [ (blinkAcrossChallenge, takeOne [[LEFT BLINKERUNSAFE,EQUIP $ AUTODETECTOR WALLDETECTOR]
,[BLINKERUNSAFE,CLICKDETECTOR WALLDETECTOR] ,[LEFT BLINKERUNSAFE,HELD $ HELDDETECTOR WALLDETECTOR]
] ]
) )
] ]
lockRoomKeyItems :: RandomGen g => [ (Int -> State g (MetaTree Room String) , State g ItemBaseType ) ] lockRoomKeyItems :: RandomGen g => [ (Int -> State g (MetaTree Room String) , State g ItemBaseType ) ]
lockRoomKeyItems = lockRoomKeyItems =
[(lasCenSensEdge, takeOne [HELD LAUNCHER,HELD LASGUN,HELD SPARKGUN,FLATSHIELD,HELD FORCEFIELDGUN] ) [(lasCenSensEdge, takeOne [HELD LAUNCHER,HELD LASGUN,HELD SPARKGUN,EQUIP FLATSHIELD,HELD FORCEFIELDGUN] )
,(sensorRoomRunPast ELECTRICAL, takeOne [CRAFT STATICMODULE,HELD SPARKGUN] ) ,(sensorRoomRunPast ELECTRICAL, takeOne [CRAFT STATICMODULE,HELD SPARKGUN] )
,(sensorRoomRunPast FLAMING, takeOne [HELD FLAMESPITTER, CRAFT INCENDIARYMODULE] ) ,(sensorRoomRunPast FLAMING, takeOne [HELD FLAMESPITTER, CRAFT INCENDIARYMODULE] )
,(sensorRoomRunPast LASERING, return $ HELD LASGUN ) ,(sensorRoomRunPast LASERING, return $ HELD LASGUN )
,(const slowDoorRoomRunPast, return $ HELD (MINIGUNX 3)) ,(const slowDoorRoomRunPast, return $ HELD (MINIGUNX 3))
,(const longRoomRunPast, takeOne [HELD SNIPERRIFLE,FLATSHIELD]) ,(const longRoomRunPast, takeOne [HELD SNIPERRIFLE,EQUIP FLATSHIELD])
,(const glassLessonRunPast, takeOne [HELD LASGUN]) ,(const glassLessonRunPast, takeOne [HELD LASGUN])
,(const $ lasTunnelRunPast 400, takeOne [FLATSHIELD,HELD FORCEFIELDGUN]) ,(const $ lasTunnelRunPast 400, takeOne [EQUIP FLATSHIELD,HELD FORCEFIELDGUN])
,(keyCardRoomRunPast 0, return (KEYCARD 0)) ,(keyCardRoomRunPast 0, return (KEYCARD 0))
] ]
keyCardRunPastRand :: RandomGen g => [ (Int -> State g (MetaTree Room String) , State g ItemBaseType ) ] keyCardRunPastRand :: RandomGen g => [ (Int -> State g (MetaTree Room String) , State g ItemBaseType ) ]
@@ -63,7 +63,7 @@ itemRooms =
[rc $ map makeTypeCraft [LIGHTER,PUMP,CAN] [rc $ map makeTypeCraft [LIGHTER,PUMP,CAN]
] ]
) )
, (FLATSHIELD , join $ takeOne , (EQUIP FLATSHIELD , join $ takeOne
[rc $ map makeTypeCraft [PLATE,PLATE] [rc $ map makeTypeCraft [PLATE,PLATE]
,rc $ map makeTypeCraft [DRUM,DRUM,PLATE] ,rc $ map makeTypeCraft [DRUM,DRUM,PLATE]
] ]
+1
View File
@@ -45,6 +45,7 @@ flareCircleAt col alphax tranv = flares .:~ CircFlare
, _flareTran3 = tranv , _flareTran3 = tranv
} }
explosionFlashAt :: Point2 -> World -> World explosionFlashAt :: Point2 -> World -> World
explosionFlashAt p = tempLightSources .:~ tlsTimeRadFunPos 20 150 intensityFunc (addZ 20 p) explosionFlashAt p = tempLightSources .:~ tlsTimeRadFunPos 20 150 intensityFunc (addZ 20 p)
where where