Start implementing mapper item

This commit is contained in:
2025-01-02 16:26:26 +00:00
parent 8bfaa12ea7
commit e9f5a39ed7
10 changed files with 68 additions and 47 deletions
+11 -6
View File
@@ -329,7 +329,7 @@ useLoadedAmmo itmtree cr (cme, w) (mzid, Just (mz, x, magtree)) = (,) (cme & cme
w
MuzzleNozzle{} -> useGasParams mid mz itm cr $ walkNozzle mzid mz itm cr w
MuzzleShatter -> shootShatter itm cr w
MuzzleDetector -> itemDetectorEffect itm cr w
MuzzleDetector -> itemDetectorEffect itm (getAttachedMapper itmtree) cr w
MuzzleBlink -> unsafeBlinkAction cr w
MuzzleUnsafeBlink -> blinkActionMousePos cr w
MuzzleRewind -> useRewindGun (itm ^. itID) w
@@ -339,13 +339,18 @@ useLoadedAmmo itmtree cr (cme, w) (mzid, Just (mz, x, magtree)) = (,) (cme & cme
mid = magtree ^? ldtValue . itLocation . ilInvID
itm = itmtree ^. ldtValue
itemDetectorEffect :: Item -> Creature -> World -> World
itemDetectorEffect itm cr w = fromMaybe w $ do
getAttachedMapper :: LabelDoubleTree ComposeLinkType Item -> Maybe (NewInt ItmInt)
getAttachedMapper =
(^? ldtRight . folding (lookup (SFLink MapperSF)) . ldtValue . itID)
itemDetectorEffect :: Item -> Maybe (NewInt ItmInt) -> Creature -> World -> World
itemDetectorEffect itm itid cr w = fromMaybe w $ do
DETECTOR dt <- itm ^? itType
return $ case dt of
ITEMDETECTOR -> aRadarPulse ObItem cr w
CREATUREDETECTOR -> aRadarPulse ObCreature cr w
WALLDETECTOR -> aRadarPulse ObWall cr w
ITEMDETECTOR -> aRadarPulse itid ObItem cr w
CREATUREDETECTOR -> aRadarPulse itid ObCreature cr w
WALLDETECTOR -> aRadarPulse itid ObWall cr w
walkNozzle :: Int -> Muzzle -> Item -> Creature -> World -> World
walkNozzle mzid mz itm cr w = fromMaybe w $ do