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
,label="HELD {_ibtHeld = FLATSHIELD}"];
96 [shape=box
,label="HELD {_ibtHeld = DETECTOR ITEMDETECTOR}"];
,label="DETECTOR {_ibtDetector = ITEMDETECTOR}"];
99 [shape=box
,label="HELD {_ibtHeld = DETECTOR WALLDETECTOR}"];
,label="DETECTOR {_ibtDetector = WALLDETECTOR}"];
101 [shape=box
,label="HELD {_ibtHeld = DETECTOR CREATUREDETECTOR}"];
,label="DETECTOR {_ibtDetector = CREATUREDETECTOR}"];
103 [shape=box
,label="HELD {_ibtHeld = TORCH}"];
104 [shape=box
+3
View File
@@ -33,6 +33,7 @@ data ComposeLinkType
| UnderBarrelSlotLink
| UnderBarrelPlatformLink
| GrenadeHitEffectLink
| SFLink {_sfLink :: ItemStructuralFunction}
deriving (Eq, Ord, Show, Read)
data ItemStructuralFunction
@@ -62,6 +63,7 @@ data ItemStructuralFunction
| ProjectileStabiliserSF
| GrenadeHitEffectSF
| ToggleSF
| MapperSF
deriving (Eq, Ord, Show, Read)
type ComposedItem = (Item, ItemStructuralFunction, LinkTest)
@@ -87,5 +89,6 @@ data LinkUpdate = LUpdate
makeLenses ''ItemLink
makeLenses ''LinkTest
makeLenses ''LinkUpdate
makeLenses ''ComposeLinkType
deriveJSON defaultOptions ''ItemStructuralFunction
deriveJSON defaultOptions ''ComposeLinkType
+5
View File
@@ -28,6 +28,11 @@ data HUDElement
data SubInventory
= NoSubInventory
| ExamineInventory
| MapperInventory
{_mapInvOffset :: Point2
, _mapInvZoom :: Float
, _mapInvItmID :: NewInt ItmInt
}
| CombineInventory
{ _ciSections :: IntMap (SelectionSection CombinableItem)
, _ciSelection :: Maybe (Int, Int, IS.IntSet)
+1 -1
View File
@@ -24,6 +24,7 @@ data ItemType
| ITEMSCAN
| MAPPER
| INTROSCAN {_ibtIntroScanType :: IntroScanType}
| DETECTOR {_ibtDetector :: Detector}
deriving (Eq, Ord, Show, Read)
data IntroScanType
@@ -161,7 +162,6 @@ data HeldItemType
| TORCH
| FLATSHIELD
| KEYCARD Int
| DETECTOR Detector
| BLINKER
| BLINKERUNSAFE
deriving (Eq, Ord, Show, Read) --Generic, Flat)
+4
View File
@@ -15,6 +15,7 @@ module Dodge.Data.Item.Use (
module Dodge.Data.Item.BulletMod
) where
import qualified Data.Set as S
import Dodge.Data.Item.BulletMod
import Dodge.Data.Item.Scope
import Control.Lens
@@ -44,6 +45,9 @@ data ItemUse
| UseScope { _uScope :: Scope }
| UseBulletMod { _ubMod :: BulletMod }
| UseToggle {_useToggle :: Bool}
| UseMapper { _useMapperLines :: S.Set (Point2,Point2)
, _useMapperPoints :: S.Set Point2
}
deriving (Eq, Show, Read)
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]
"GODON" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crMaterial .~ Crystal
"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 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 itm cr w = fromMaybe w $ do
DETECTOR dt <- itm ^? itType . ibtHeld
DETECTOR dt <- itm ^? itType
return $ case dt of
ITEMDETECTOR -> aRadarPulse ObItem cr w
CREATUREDETECTOR -> aRadarPulse ObCreature cr w
+1
View File
@@ -28,6 +28,7 @@ itemFromBase = \case
ITEMSCAN -> itemScan
INTROSCAN t -> introScan t
MAPPER -> mapper
DETECTOR d -> detector d
itemFromAmmoMag :: AmmoMagType -> Item
itemFromAmmoMag at = case at of
+1
View File
@@ -69,6 +69,7 @@ itemBaseName = \case
ITEMSCAN -> "ITEMSCAN"
INTROSCAN t -> show t
MAPPER -> "MAPPER"
DETECTOR t -> show t
showAttachItem :: AttachType -> String
showAttachItem t = case t of
+1 -1
View File
@@ -44,6 +44,7 @@ itemSPic it = case it ^. itType of
ITEMSCAN -> defSPic
MAPPER -> defSPic
INTROSCAN {} -> defSPic
DETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPolySU 3 $ rectWH 2 2)
craftItemSPic :: CraftType -> Shape
craftItemSPic = \case
@@ -251,7 +252,6 @@ heldItemSPic ht it = case ht of
TIMESTOPPER -> defSPic
TIMESCROLLER -> defSPic
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)
torchShape :: Shape
+7 -2
View File
@@ -66,12 +66,15 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
(_, HeldPlatformSF) ->
( getAmmoLinks itm
<> extraWeaponLinksBelow itm
--( extraWeaponLinksBelow itm
-- <>getAmmoLinks itm
, [(WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
<> getAutoSpringLinks itm
<> extraWeaponLinks itm
)
(DETECTOR {}, _) ->
( getAmmoLinks itm
, [(MapperSF,SFLink MapperSF),(TriggerSF, TriggerLink)]
)
(_, GadgetPlatformSF) ->
( getAmmoLinks itm
, [(TriggerSF, TriggerLink), (WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
@@ -131,6 +134,8 @@ getAmmoLinks itm =
itemToFunction :: Item -> ItemStructuralFunction
itemToFunction itm = case itm ^. itType of
DETECTOR {} -> GadgetPlatformSF
MAPPER -> MapperSF
ITEMSCAN -> ToggleSF
INTROSCAN {} -> IntroScanSF
HELD LASER -> WeaponTargetingSF
-1
View File
@@ -69,5 +69,4 @@ itemFromHeldType ht = case ht of
GLAUNCHER -> gLauncher
RLAUNCHERX i -> rLauncherX i
POISONSPRAYER -> poisonSprayer
DETECTOR d -> detector d
FLATSHIELD -> flatShield
+1 -1
View File
@@ -47,7 +47,7 @@ detector dt =
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1}
& itAmmoSlots .~ singleAmmo ElectricalAmmo
& itUse . heldParams .~ DefaultHeldParams
& itType .~ HELD (DETECTOR dt)
& itType .~ DETECTOR dt
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleDetector
& itUse . heldAim . aimMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 100
+19 -1
View File
@@ -1,3 +1,4 @@
{-# LANGUAGE LambdaCase #-}
module Dodge.Item.Info
( itemInfo
) where
@@ -25,8 +26,26 @@ itmBaseInfo itm = case itm ^. itType of
HELD hit -> heldInfo hit
EQUIP eit -> equipInfo eit
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"
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 i = case i of
0 -> "zero"
@@ -87,7 +106,6 @@ heldInfo hit = case hit of
POISONSPRAYER -> "A weapon that releases noxious gases."
SHATTERGUN -> "A seismic device that shatters hard items in its line of fire."
-- 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."
FLATSHIELD -> "A panel of metal that blocks unwanted objects from the front of the user."
KEYCARD i -> "A keycard. It is labelled " ++ show i ++ "."
+1
View File
@@ -8,6 +8,7 @@ import Dodge.Data.ComposedItem
itemInvColor :: ComposedItem -> Color
itemInvColor ci = case ci ^. _2 of
MapperSF -> white
GrenadeHitEffectSF -> yellow
IntroScanSF -> white
ToggleSF -> white
+1 -1
View File
@@ -67,7 +67,7 @@ mapper :: Item
mapper =
defaultHeldItem
& itType .~ MAPPER
& itUse .~ UseNothing
& itUse .~ UseMapper mempty mempty
bulletModule :: BulletMod -> Item
bulletModule bm =
+1 -1
View File
@@ -17,7 +17,7 @@ lockRoomMultiItems =
[
( blinkAcrossChallenge
, takeOne
[ [HELD BLINKERUNSAFE, HELD $ DETECTOR WALLDETECTOR]
[ [HELD BLINKERUNSAFE, DETECTOR WALLDETECTOR]
]
)
]
+10
View File
@@ -4,6 +4,7 @@ module Dodge.Render.HUD (
drawHUD,
) where
import Dodge.Item.Location
import Control.Applicative
import Control.Lens
import Control.Monad
@@ -163,6 +164,15 @@ drawSubInventory subinv cfig w = case subinv of
ExamineInventory -> drawExamineInventory cfig w
DisplayTerminal tid -> drawTerminalDisplay tid cfig (w ^. cWorld . lWorld)
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 ::
Configuration ->
+1
View File
@@ -18,6 +18,7 @@ updateWheelEvent :: Int -> World -> World
updateWheelEvent yi w = case w ^. hud . hudElement . subInventory of
NoSubInventory -> updateBaseWheelEvent yi w
ExamineInventory -> updateBaseWheelEvent yi w
MapperInventory {} -> updateBaseWheelEvent yi w
CombineInventory{} -> moveCombineSel yi w
DisplayTerminal tmid -> terminalWheelEvent yi tmid w
+375 -365
View File
File diff suppressed because it is too large Load Diff