Implement introspection items
This commit is contained in:
@@ -96,8 +96,8 @@ startCr =
|
||||
& crDir .~ pi / 2
|
||||
& crMvDir .~ pi / 2
|
||||
& crID .~ 0
|
||||
& crHP .~ 1000
|
||||
& crMaxHP .~ 1500
|
||||
& crHP .~ 10000
|
||||
& crMaxHP .~ 15000
|
||||
& crInv .~ startInventory
|
||||
& crCorpse .~ MakeDefaultCorpse
|
||||
& crFaction .~ PlayerFaction
|
||||
@@ -116,6 +116,7 @@ startInventory = IM.fromList $ zip [0 ..] startInvList
|
||||
inventoryX :: Char -> [Item]
|
||||
inventoryX c = case c of
|
||||
'A' ->
|
||||
[introScan t | t <- [minBound..maxBound]] <>
|
||||
[ flameThrower
|
||||
, fuelPack
|
||||
, chemFuelPouch
|
||||
|
||||
@@ -115,6 +115,5 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation invid w of
|
||||
crpoint = cWorld . lWorld . creatures . ix (_crID cr)
|
||||
itmat i = _crInv cr IM.! i
|
||||
itm = itmat invid
|
||||
-- itRef = cr ^?! crManipulation . manObject . imSelectedItem -- unsafe!! TODO change?
|
||||
onequip itm' = doItmCrWdWd ((_eeOnEquip . _uequipEffect . _itUse) itm') itm'
|
||||
onremove itm' = doItmCrWdWd ((_eeOnRemove . _uequipEffect . _itUse) itm') itm'
|
||||
|
||||
@@ -22,8 +22,14 @@ data ItemType
|
||||
| BULLETMOD {_ibtBulletMod :: BulletMod}
|
||||
| STICKYMOD
|
||||
| ITEMSCANNER
|
||||
| INTROSCAN {_ibtIntroScanType :: IntroScanType}
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data IntroScanType
|
||||
= HEALTH
|
||||
| MAXHEALTH
|
||||
deriving (Eq, Ord, Show, Read, Enum, Bounded)
|
||||
|
||||
data CraftType
|
||||
= PIPE
|
||||
| TUBE
|
||||
@@ -168,6 +174,7 @@ data Detector
|
||||
makeLenses ''ItemType
|
||||
makeLenses ''HeldItemType
|
||||
makeLenses ''AttachType
|
||||
deriveJSON defaultOptions ''IntroScanType
|
||||
deriveJSON defaultOptions ''CraftType
|
||||
deriveJSON defaultOptions ''ConsumableItemType
|
||||
deriveJSON defaultOptions ''AmmoMagType
|
||||
|
||||
@@ -44,7 +44,6 @@ chooseFreeSite cr = fromMaybe 0 . findIndex hasnoequipment
|
||||
|
||||
getEquipmentAllocation :: Int -> World -> EquipmentAllocation
|
||||
getEquipmentAllocation invid w = fromMaybe DoNotMoveEquipment $ do
|
||||
-- curpos <- you w ^? crManipulation . manObject . imSelectedItem
|
||||
esite <- you w ^? crInv . ix invid . itUse . uequipEffect . eeType
|
||||
i <-
|
||||
w ^? rbOptions . opSel
|
||||
|
||||
@@ -26,6 +26,7 @@ itemFromBase = \case
|
||||
BULLETMOD bm -> bulletModule bm
|
||||
STICKYMOD -> stickyMod
|
||||
ITEMSCANNER -> itemScanner
|
||||
INTROSCAN t -> introScan t
|
||||
|
||||
itemFromAmmoMag :: AmmoMagType -> Item
|
||||
itemFromAmmoMag at = case at of
|
||||
|
||||
@@ -67,6 +67,7 @@ itemBaseName = \case
|
||||
BULLETMOD (BulletModEffect btt) -> show btt
|
||||
STICKYMOD -> "STICKYMOD"
|
||||
ITEMSCANNER -> "ITEMSCANNER"
|
||||
INTROSCAN t -> show t
|
||||
|
||||
showAttachItem :: AttachType -> String
|
||||
showAttachItem t = case t of
|
||||
@@ -106,8 +107,14 @@ itemNumberDisplay cr ci
|
||||
-- | UseAttach (APLinkProjectile i) <- ci ^. _1 . itUse = [show i]
|
||||
| UseAttach (APProjectiles x) <- ci ^. _1 . itUse = [show x]
|
||||
| UseScope OpticScope{_opticZoom = x} <- ci ^. _1 . itUse = [shortShow x]
|
||||
| Just t <- ci ^? _1 . itType . ibtIntroScanType = [introScanDisplay cr t]
|
||||
| otherwise = mempty
|
||||
|
||||
introScanDisplay :: Creature -> IntroScanType -> String
|
||||
introScanDisplay cr = \case
|
||||
HEALTH -> shortShow (cr ^. crHP)
|
||||
MAXHEALTH -> shortShow (cr ^. crMaxHP)
|
||||
|
||||
displayPulse :: Int -> String
|
||||
displayPulse 0 = "*****"
|
||||
displayPulse x = take 5 $ drop y "----^-----"
|
||||
|
||||
@@ -42,6 +42,7 @@ itemSPic it = case it ^. itType of
|
||||
BULLETMOD{} -> defSPic
|
||||
STICKYMOD -> defSPic
|
||||
ITEMSCANNER -> defSPic
|
||||
INTROSCAN {} -> defSPic
|
||||
|
||||
craftItemSPic :: CraftType -> Shape
|
||||
craftItemSPic = \case
|
||||
|
||||
@@ -16,6 +16,7 @@ module Dodge.Item.Scope (
|
||||
bulletPayloadModule,
|
||||
smokeReducer,
|
||||
itemScanner,
|
||||
introScan,
|
||||
) where
|
||||
|
||||
import Dodge.Item.Attach
|
||||
@@ -47,6 +48,12 @@ stickyMod =
|
||||
& itType .~ STICKYMOD
|
||||
& itUse .~ UseNothing
|
||||
|
||||
introScan :: IntroScanType -> Item
|
||||
introScan t =
|
||||
defaultHeldItem
|
||||
& itType .~ INTROSCAN t
|
||||
& itUse .~ UseNothing
|
||||
|
||||
itemScanner :: Item
|
||||
itemScanner =
|
||||
defaultHeldItem
|
||||
|
||||
@@ -235,7 +235,7 @@ yourAugmentedItem f x g w = case you w ^? crManipulation . manObject of
|
||||
_ -> x
|
||||
|
||||
drawRBOptions :: Configuration -> World -> Picture
|
||||
drawRBOptions cfig w = fromMaybe mempty $ do
|
||||
drawRBOptions cfig w = fold $ do
|
||||
guard $ ButtonRight `M.member` _mouseButtons (_input w)
|
||||
invid <- you w ^? crManipulation . manObject . imSelectedItem
|
||||
eslist <-
|
||||
|
||||
Reference in New Issue
Block a user