This commit is contained in:
2022-06-07 20:39:52 +01:00
parent 956ee87168
commit 5a42e0b801
6 changed files with 30 additions and 18 deletions
+13 -13
View File
@@ -152,21 +152,18 @@ wheelEvent y w = case _hudElement $ _hud w of
where
updatetermsel tm = case tm ^? tmInput . tiSel of
Nothing -> tm & tmInput . tiSel .~ (0,0)
& tmInput . tiText %~ replacewith tm 0
Just (i,_) -> let newi = ((`mod` length (scrollCommands tm)) . subtract yi) i
in tm & tmInput . tiSel .~ (newi,0)
& tmInput . tiText %~ replacewith tm newi
Just (i,_) -> let newi = (i - yi) `mod` length (scrollCommands tm)
in tm & setInput newi 0 w
updatetermsubsel tm = case tm ^? tmInput . tiSel of
Nothing -> tm
Just (i,j) -> let newj = (j - yi) `mod` (1 + length (getArguments (scrollCommands tm !! i) tm w))
in tm & tmInput . tiSel .~ (i,newj)
& tmInput . tiText %~ replacewith' tm i newj w
replacewith tp newi _ = T.pack (_tcString (scrollCommands tp !! newi))
replacewith' tp i j w' _ = T.pack $ _tcString tc ++ " " ++ arg-- ++ ((_tcArguments tp) w !! j)
Nothing -> tm & tmInput . tiSel .~ (0,0)
Just (i,j) -> let newj = (j - yi) `mod` length (getArguments' (scrollCommands tm !! i) tm w)
in tm & setInput i newj w
setInput i j w' tm = tm
& tmInput . tiSel .~ (i,j)
& tmInput . tiText .~ T.pack (_tcString tc ++ " " ++ arg)
where
arg :: String
arg = ("": getArguments tc tp w' )!! j
tc = scrollCommands tp !! i
tc = scrollCommands tm !! i
arg = getArguments' tc tm w' !! j
numcombs = length $ combineItemListYou w
yi = round $ signum y
numLocs = (fst . IM.findMax $ _seenLocations w) + 1
@@ -174,6 +171,9 @@ wheelEvent y w = case _hudElement $ _hud w of
lbDown = ButtonLeft `S.member` _mouseButtons w
invKeyDown = ScancodeCapsLock `S.member` _keys w
getArguments' :: TerminalCommand -> Terminal -> World -> [String]
getArguments' tc tm = ("" :) . getArguments tc tm
getArguments :: TerminalCommand -> Terminal -> World -> [String]
getArguments tc tm w = case _tcEffect tc tm w of
NoArguments {} -> []
+1 -1
View File
@@ -55,7 +55,7 @@ initialAnoTree = padSucWithDoors $ treeFromPost
[(sensorRoomRunPast ELECTRICAL, takeOne [STATICMODULE,SPARKGUN] )] itemRooms]
, [SpecificRoom ((return . UseAll <$> tanksRoom [] [])
<&> (, TreeSubLabelling "empty tanksRoom" Nothing))]
, [PassthroughLockKeyLists 2 lockRoomKeyItems itemRooms]
, [PassthroughLockKeyLists 222 lockRoomKeyItems itemRooms]
, [SpecificRoom randomChallenges]
, [AnoApplyInt 1 lasSensorTurretTest]
-- ,[SpecificRoom $ fmap singleUseAll roomCCrits]
-2
View File
@@ -95,8 +95,6 @@ onRemoveWristShield itm cr w = w
setWristShieldPos :: Item -> Creature -> World -> World
setWristShieldPos itm cr w = w
& moveWallIDUnsafe i wlline
-- & testString .~ (\w' -> [shortShow $ _wlLine (_walls w' IM.! i)])
-- & tempLightSources .:~ tlsTimeRadColPos 1 200 0.7 (fst wlline `v2z` 40)
where
i = _eparamID $ _eqParams $ _eqEq $ _itUse itm
wlline = (f (V3 (-10) 7 0), f (V3 10 7 0))
+6 -2
View File
@@ -98,8 +98,11 @@ targetDistanceDraw itm _ cfig w = fromMaybe mempty $ do
return $ winScale cfig
$ setLayer FixedCoordLayer
$ color thecol
$ line [p1, p2]
<> translate (20) (f p1 p2) (uncurryV translate (0.5 *.* (p1 +.+ p2)) . scale 0.1 0.1 $ text $ shortShow $ dist p mwp)
$ line [p1, p2]
<> transMidLine p1 p2 (scale 0.1 0.1 . text . shortShow $ dist p mwp)
transMidLine :: Point2 -> Point2 -> Picture -> Picture
transMidLine p1 p2 = translate 20 (f p1 p2) . uncurryV translate (0.5 *.* (p1 +.+ p2))
where
f (V2 x y) (V2 x' y')
| y > y' && x > x' = max (-10) (x'-x)
@@ -107,6 +110,7 @@ targetDistanceDraw itm _ cfig w = fromMaybe mempty $ do
| x > x' = min 10 (x-x')
| otherwise = max (-10) (x-x')
targetRBCreatureUp :: Item -> Creature -> World -> Targeting -> (World, Targeting)
targetRBCreatureUp it cr w t
| not $ _itIsHeld it = (w, t
+8
View File
@@ -20,6 +20,14 @@ bossKeyItems =
[(return . UseAll <$> bossRoom autoCrit, takeOne [PISTOL])
]
lockRoomMultiItems :: RandomGen g => [ ( State g (LabSubCompTree Room) , State g [CombineType] ) ]
lockRoomMultiItems =
[ (blinkAcrossChallenge, takeOne [[BLINKERUNSAFE,AUTODETECTOR WALLDETECTOR]
,[BLINKERUNSAFE,CLICKDETECTOR WALLDETECTOR]
]
)
]
lockRoomKeyItems :: RandomGen g => [ (Int -> State g (LabSubCompTree Room) , State g CombineType ) ]
lockRoomKeyItems =
[(lasCenSensEdge, takeOne [LAUNCHER,LASGUN,SPARKGUN,FLATSHIELD,FORCEFIELDGUN] )
+2
View File
@@ -14,6 +14,7 @@ module Dodge.Room
, module Dodge.Room.LongRoom
, module Dodge.Room.Branch
, module Dodge.Room.Teleport
, module Dodge.Room.BlinkAcross
, module Dodge.Room.Start
, module Dodge.Room.Boss
, module Dodge.Room.Treasure
@@ -33,6 +34,7 @@ import Dodge.Room.Start
import Dodge.Room.Teleport
import Dodge.Room.Branch
import Dodge.Room.Foreground
import Dodge.Room.BlinkAcross
import Dodge.LevelGen.Data
import Dodge.Room.Procedural
import Dodge.Room.Corridor