Work on mapper item, simpler generation of items from console

This commit is contained in:
2025-01-02 11:16:04 +00:00
parent 03b25565f1
commit 725a59b9d0
20 changed files with 439 additions and 379 deletions
+3 -3
View File
@@ -68,11 +68,11 @@ digraph {
86 [shape=box 86 [shape=box
,label="HELD {_ibtHeld = FLATSHIELD}"]; ,label="HELD {_ibtHeld = FLATSHIELD}"];
96 [shape=box 96 [shape=box
,label="HELD {_ibtHeld = DETECTOR ITEMDETECTOR}"]; ,label="DETECTOR {_ibtDetector = ITEMDETECTOR}"];
99 [shape=box 99 [shape=box
,label="HELD {_ibtHeld = DETECTOR WALLDETECTOR}"]; ,label="DETECTOR {_ibtDetector = WALLDETECTOR}"];
101 [shape=box 101 [shape=box
,label="HELD {_ibtHeld = DETECTOR CREATUREDETECTOR}"]; ,label="DETECTOR {_ibtDetector = CREATUREDETECTOR}"];
103 [shape=box 103 [shape=box
,label="HELD {_ibtHeld = TORCH}"]; ,label="HELD {_ibtHeld = TORCH}"];
104 [shape=box 104 [shape=box
+3
View File
@@ -33,6 +33,7 @@ data ComposeLinkType
| UnderBarrelSlotLink | UnderBarrelSlotLink
| UnderBarrelPlatformLink | UnderBarrelPlatformLink
| GrenadeHitEffectLink | GrenadeHitEffectLink
| SFLink {_sfLink :: ItemStructuralFunction}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read)
data ItemStructuralFunction data ItemStructuralFunction
@@ -62,6 +63,7 @@ data ItemStructuralFunction
| ProjectileStabiliserSF | ProjectileStabiliserSF
| GrenadeHitEffectSF | GrenadeHitEffectSF
| ToggleSF | ToggleSF
| MapperSF
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read)
type ComposedItem = (Item, ItemStructuralFunction, LinkTest) type ComposedItem = (Item, ItemStructuralFunction, LinkTest)
@@ -87,5 +89,6 @@ data LinkUpdate = LUpdate
makeLenses ''ItemLink makeLenses ''ItemLink
makeLenses ''LinkTest makeLenses ''LinkTest
makeLenses ''LinkUpdate makeLenses ''LinkUpdate
makeLenses ''ComposeLinkType
deriveJSON defaultOptions ''ItemStructuralFunction deriveJSON defaultOptions ''ItemStructuralFunction
deriveJSON defaultOptions ''ComposeLinkType deriveJSON defaultOptions ''ComposeLinkType
+5
View File
@@ -28,6 +28,11 @@ data HUDElement
data SubInventory data SubInventory
= NoSubInventory = NoSubInventory
| ExamineInventory | ExamineInventory
| MapperInventory
{_mapInvOffset :: Point2
, _mapInvZoom :: Float
, _mapInvItmID :: NewInt ItmInt
}
| CombineInventory | CombineInventory
{ _ciSections :: IntMap (SelectionSection CombinableItem) { _ciSections :: IntMap (SelectionSection CombinableItem)
, _ciSelection :: Maybe (Int, Int, IS.IntSet) , _ciSelection :: Maybe (Int, Int, IS.IntSet)
+1 -1
View File
@@ -24,6 +24,7 @@ data ItemType
| ITEMSCAN | ITEMSCAN
| MAPPER | MAPPER
| INTROSCAN {_ibtIntroScanType :: IntroScanType} | INTROSCAN {_ibtIntroScanType :: IntroScanType}
| DETECTOR {_ibtDetector :: Detector}
deriving (Eq, Ord, Show, Read) deriving (Eq, Ord, Show, Read)
data IntroScanType data IntroScanType
@@ -161,7 +162,6 @@ data HeldItemType
| TORCH | TORCH
| FLATSHIELD | FLATSHIELD
| KEYCARD Int | KEYCARD Int
| DETECTOR Detector
| BLINKER | BLINKER
| BLINKERUNSAFE | BLINKERUNSAFE
deriving (Eq, Ord, Show, Read) --Generic, Flat) deriving (Eq, Ord, Show, Read) --Generic, Flat)
+4
View File
@@ -15,6 +15,7 @@ module Dodge.Data.Item.Use (
module Dodge.Data.Item.BulletMod module Dodge.Data.Item.BulletMod
) where ) where
import qualified Data.Set as S
import Dodge.Data.Item.BulletMod import Dodge.Data.Item.BulletMod
import Dodge.Data.Item.Scope import Dodge.Data.Item.Scope
import Control.Lens import Control.Lens
@@ -44,6 +45,9 @@ data ItemUse
| UseScope { _uScope :: Scope } | UseScope { _uScope :: Scope }
| UseBulletMod { _ubMod :: BulletMod } | UseBulletMod { _ubMod :: BulletMod }
| UseToggle {_useToggle :: Bool} | UseToggle {_useToggle :: Bool}
| UseMapper { _useMapperLines :: S.Set (Point2,Point2)
, _useMapperPoints :: S.Set Point2
}
deriving (Eq, Show, Read) deriving (Eq, Show, Read)
data HeldUseEffect data HeldUseEffect
+3 -1
View File
@@ -35,7 +35,9 @@ applyTerminalCommand s = case s of
['I','S',x,y] -> uvWorld . cWorld . lWorld . creatures . ix 0 . crInvCapacity .~ read [x,y] ['I','S',x,y] -> uvWorld . cWorld . lWorld . creatures . ix 0 . crInvCapacity .~ read [x,y]
"GODON" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crMaterial .~ Crystal "GODON" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crMaterial .~ Crystal
"GODOFF" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crMaterial .~ Flesh "GODOFF" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crMaterial .~ Flesh
_ -> id x -> fromMaybe id $ do
(ibt, n) <- parseItem [x]
return $ uvWorld %~ flip (foldl' (&)) (replicate n (snd . createItemYou (itemFromBase ibt)))
applyTerminalCommandArguments :: String -> [String] -> Universe -> Universe applyTerminalCommandArguments :: String -> [String] -> Universe -> Universe
applyTerminalCommandArguments command args u = case command of applyTerminalCommandArguments command args u = case command of
+1 -1
View File
@@ -341,7 +341,7 @@ useLoadedAmmo itmtree cr (cme, w) (mzid, Just (mz, x, magtree)) = (,) (cme & cme
itemDetectorEffect :: Item -> Creature -> World -> World itemDetectorEffect :: Item -> Creature -> World -> World
itemDetectorEffect itm cr w = fromMaybe w $ do itemDetectorEffect itm cr w = fromMaybe w $ do
DETECTOR dt <- itm ^? itType . ibtHeld DETECTOR dt <- itm ^? itType
return $ case dt of return $ case dt of
ITEMDETECTOR -> aRadarPulse ObItem cr w ITEMDETECTOR -> aRadarPulse ObItem cr w
CREATUREDETECTOR -> aRadarPulse ObCreature cr w CREATUREDETECTOR -> aRadarPulse ObCreature cr w
+1
View File
@@ -28,6 +28,7 @@ itemFromBase = \case
ITEMSCAN -> itemScan ITEMSCAN -> itemScan
INTROSCAN t -> introScan t INTROSCAN t -> introScan t
MAPPER -> mapper MAPPER -> mapper
DETECTOR d -> detector d
itemFromAmmoMag :: AmmoMagType -> Item itemFromAmmoMag :: AmmoMagType -> Item
itemFromAmmoMag at = case at of itemFromAmmoMag at = case at of
+1
View File
@@ -69,6 +69,7 @@ itemBaseName = \case
ITEMSCAN -> "ITEMSCAN" ITEMSCAN -> "ITEMSCAN"
INTROSCAN t -> show t INTROSCAN t -> show t
MAPPER -> "MAPPER" MAPPER -> "MAPPER"
DETECTOR t -> show t
showAttachItem :: AttachType -> String showAttachItem :: AttachType -> String
showAttachItem t = case t of showAttachItem t = case t of
+1 -1
View File
@@ -44,6 +44,7 @@ itemSPic it = case it ^. itType of
ITEMSCAN -> defSPic ITEMSCAN -> defSPic
MAPPER -> defSPic MAPPER -> defSPic
INTROSCAN {} -> defSPic INTROSCAN {} -> defSPic
DETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPolySU 3 $ rectWH 2 2)
craftItemSPic :: CraftType -> Shape craftItemSPic :: CraftType -> Shape
craftItemSPic = \case craftItemSPic = \case
@@ -251,7 +252,6 @@ heldItemSPic ht it = case ht of
TIMESTOPPER -> defSPic TIMESTOPPER -> defSPic
TIMESCROLLER -> defSPic TIMESCROLLER -> defSPic
SHATTERGUN -> shatterGunSPic SHATTERGUN -> shatterGunSPic
DETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPolySU 3 $ rectWH 2 2)
KEYCARD _ -> noShape (setDepth 0 $ translate (-5) (-5) $ rotate (pi / 2.5) keyPic) KEYCARD _ -> noShape (setDepth 0 $ translate (-5) (-5) $ rotate (pi / 2.5) keyPic)
torchShape :: Shape torchShape :: Shape
+7 -2
View File
@@ -66,12 +66,15 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
(_, HeldPlatformSF) -> (_, HeldPlatformSF) ->
( getAmmoLinks itm ( getAmmoLinks itm
<> extraWeaponLinksBelow itm <> extraWeaponLinksBelow itm
--( extraWeaponLinksBelow itm
-- <>getAmmoLinks itm
, [(WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)] , [(WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
<> getAutoSpringLinks itm <> getAutoSpringLinks itm
<> extraWeaponLinks itm <> extraWeaponLinks itm
) )
(DETECTOR {}, _) ->
( getAmmoLinks itm
, [(MapperSF,SFLink MapperSF),(TriggerSF, TriggerLink)]
)
(_, GadgetPlatformSF) -> (_, GadgetPlatformSF) ->
( getAmmoLinks itm ( getAmmoLinks itm
, [(TriggerSF, TriggerLink), (WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)] , [(TriggerSF, TriggerLink), (WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
@@ -131,6 +134,8 @@ getAmmoLinks itm =
itemToFunction :: Item -> ItemStructuralFunction itemToFunction :: Item -> ItemStructuralFunction
itemToFunction itm = case itm ^. itType of itemToFunction itm = case itm ^. itType of
DETECTOR {} -> GadgetPlatformSF
MAPPER -> MapperSF
ITEMSCAN -> ToggleSF ITEMSCAN -> ToggleSF
INTROSCAN {} -> IntroScanSF INTROSCAN {} -> IntroScanSF
HELD LASER -> WeaponTargetingSF HELD LASER -> WeaponTargetingSF
-1
View File
@@ -69,5 +69,4 @@ itemFromHeldType ht = case ht of
GLAUNCHER -> gLauncher GLAUNCHER -> gLauncher
RLAUNCHERX i -> rLauncherX i RLAUNCHERX i -> rLauncherX i
POISONSPRAYER -> poisonSprayer POISONSPRAYER -> poisonSprayer
DETECTOR d -> detector d
FLATSHIELD -> flatShield FLATSHIELD -> flatShield
+1 -1
View File
@@ -47,7 +47,7 @@ detector dt =
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1} & itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1}
& itAmmoSlots .~ singleAmmo ElectricalAmmo & itAmmoSlots .~ singleAmmo ElectricalAmmo
& itUse . heldParams .~ DefaultHeldParams & itUse . heldParams .~ DefaultHeldParams
& itType .~ HELD (DETECTOR dt) & itType .~ DETECTOR dt
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleDetector & itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleDetector
& itUse . heldAim . aimMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 100 & itUse . heldAim . aimMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 100
+19 -1
View File
@@ -1,3 +1,4 @@
{-# LANGUAGE LambdaCase #-}
module Dodge.Item.Info module Dodge.Item.Info
( itemInfo ( itemInfo
) where ) where
@@ -25,8 +26,26 @@ itmBaseInfo itm = case itm ^. itType of
HELD hit -> heldInfo hit HELD hit -> heldInfo hit
EQUIP eit -> equipInfo eit EQUIP eit -> equipInfo eit
CRAFT fit -> craftInfo fit CRAFT fit -> craftInfo fit
DETECTOR d -> "A device that detects " ++ detectorInfo d ++ " in an expanding radius."
ATTACH t -> attachInfo t
_ -> "THIS SHOULD NOT BE DISPLAYED" _ -> "THIS SHOULD NOT BE DISPLAYED"
attachInfo :: AttachType -> String
attachInfo = \case
ZOOMSCOPE -> "An optical zoom. "
BULLETSYNTH -> "An item that prints bullets, when supplied with power. "
REMOTESCREEN -> "A display screen. Can be linked to projectiles. "
JOYSTICK -> "A control device. Can be used to control certain projectiles. "
GIMBAL -> "A device that can stabilize moving objects. "
GYROSCOPE -> "A device that can sustain angular velocity. "
-- UNDERBARRELSLOT
-- REMOTEDETONATOR
-- SMOKEREDUCER
-- HOMINGMODULE
-- AUGMENTEDHUD
-- SHELLPAYLOAD {}
_ -> "INCOMPLETE, TODO FINISH"
showInt :: Int -> String showInt :: Int -> String
showInt i = case i of showInt i = case i of
0 -> "zero" 0 -> "zero"
@@ -87,7 +106,6 @@ heldInfo hit = case hit of
POISONSPRAYER -> "A weapon that releases noxious gases." POISONSPRAYER -> "A weapon that releases noxious gases."
SHATTERGUN -> "A seismic device that shatters hard items in its line of fire." SHATTERGUN -> "A seismic device that shatters hard items in its line of fire."
-- FORCEFIELDGUN -> "A device that produces a durable forcefield." -- FORCEFIELDGUN -> "A device that produces a durable forcefield."
DETECTOR d -> "A device that detects " ++ detectorInfo d ++ " in an expanding radius."
TORCH -> "A stick with a light on the end." TORCH -> "A stick with a light on the end."
FLATSHIELD -> "A panel of metal that blocks unwanted objects from the front of the user." FLATSHIELD -> "A panel of metal that blocks unwanted objects from the front of the user."
KEYCARD i -> "A keycard. It is labelled " ++ show i ++ "." KEYCARD i -> "A keycard. It is labelled " ++ show i ++ "."
+1
View File
@@ -8,6 +8,7 @@ import Dodge.Data.ComposedItem
itemInvColor :: ComposedItem -> Color itemInvColor :: ComposedItem -> Color
itemInvColor ci = case ci ^. _2 of itemInvColor ci = case ci ^. _2 of
MapperSF -> white
GrenadeHitEffectSF -> yellow GrenadeHitEffectSF -> yellow
IntroScanSF -> white IntroScanSF -> white
ToggleSF -> white ToggleSF -> white
+1 -1
View File
@@ -67,7 +67,7 @@ mapper :: Item
mapper = mapper =
defaultHeldItem defaultHeldItem
& itType .~ MAPPER & itType .~ MAPPER
& itUse .~ UseNothing & itUse .~ UseMapper mempty mempty
bulletModule :: BulletMod -> Item bulletModule :: BulletMod -> Item
bulletModule bm = bulletModule bm =
+1 -1
View File
@@ -17,7 +17,7 @@ lockRoomMultiItems =
[ [
( blinkAcrossChallenge ( blinkAcrossChallenge
, takeOne , takeOne
[ [HELD BLINKERUNSAFE, HELD $ DETECTOR WALLDETECTOR] [ [HELD BLINKERUNSAFE, DETECTOR WALLDETECTOR]
] ]
) )
] ]
+10
View File
@@ -4,6 +4,7 @@ module Dodge.Render.HUD (
drawHUD, drawHUD,
) where ) where
import Dodge.Item.Location
import Control.Applicative import Control.Applicative
import Control.Lens import Control.Lens
import Control.Monad import Control.Monad
@@ -163,6 +164,15 @@ drawSubInventory subinv cfig w = case subinv of
ExamineInventory -> drawExamineInventory cfig w ExamineInventory -> drawExamineInventory cfig w
DisplayTerminal tid -> drawTerminalDisplay tid cfig (w ^. cWorld . lWorld) DisplayTerminal tid -> drawTerminalDisplay tid cfig (w ^. cWorld . lWorld)
CombineInventory{_ciSections = sss} -> drawCombineInventory cfig sss w CombineInventory{_ciSections = sss} -> drawCombineInventory cfig sss w
MapperInventory p z itid -> drawMapperInventory p z itid cfig w
drawMapperInventory :: Point2 -> Float -> NewInt ItmInt -> Configuration -> World -> Picture
drawMapperInventory p z itid _ w = fold $ do
itm <- w ^? pointerToItemID itid
ls <- itm ^? itUse . useMapperLines
let r = w ^. wCam . camRot
return . scale z z . rotate r . uncurryV translate p
$ foldMap (\(x,y) -> line [x,y]) ls
drawCombineInventory :: drawCombineInventory ::
Configuration -> Configuration ->
+1
View File
@@ -18,6 +18,7 @@ updateWheelEvent :: Int -> World -> World
updateWheelEvent yi w = case w ^. hud . hudElement . subInventory of updateWheelEvent yi w = case w ^. hud . hudElement . subInventory of
NoSubInventory -> updateBaseWheelEvent yi w NoSubInventory -> updateBaseWheelEvent yi w
ExamineInventory -> updateBaseWheelEvent yi w ExamineInventory -> updateBaseWheelEvent yi w
MapperInventory {} -> updateBaseWheelEvent yi w
CombineInventory{} -> moveCombineSel yi w CombineInventory{} -> moveCombineSel yi w
DisplayTerminal tmid -> terminalWheelEvent yi tmid w DisplayTerminal tmid -> terminalWheelEvent yi tmid w
+375 -365
View File
File diff suppressed because it is too large Load Diff