Start removing tweakables
This commit is contained in:
@@ -22,7 +22,7 @@ data HUDElement
|
||||
|
||||
data SubInventory
|
||||
= NoSubInventory
|
||||
| ExamineInventory {_subInvMSel :: Maybe Int}
|
||||
| ExamineInventory -- {_subInvMSel :: Maybe Int}
|
||||
| CombineInventory
|
||||
{ _ciCombinations :: IntMap (SelectionItem CombinableItem)
|
||||
, _ciSections :: SelectionSections CombinableItem
|
||||
|
||||
@@ -41,7 +41,7 @@ data Item = Item
|
||||
, _itInvSize :: Int
|
||||
, _itDimension :: ItemDimension
|
||||
, _itCurseStatus :: CurseStatus
|
||||
, _itTweaks :: ItemTweaks
|
||||
-- , _itTweaks :: ItemTweaks
|
||||
, _itParams :: ItemParams
|
||||
, _itAttachments :: Set ItemAttachment
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ defaultHeldItem = Item
|
||||
, _itDimension = defaultItemDimension
|
||||
, _itUse = defaultHeldUse
|
||||
, _itParams = NoParams
|
||||
, _itTweaks = NoTweaks
|
||||
-- , _itTweaks = NoTweaks
|
||||
-- , _itScope = NoScope
|
||||
, _itAttachments = mempty
|
||||
}
|
||||
|
||||
@@ -61,10 +61,10 @@ lasGun =
|
||||
, _lasCycle = 0
|
||||
, _lasDamage = 11
|
||||
}
|
||||
& itTweaks
|
||||
.~ Tweakable
|
||||
{ _tweakParams = IM.fromList [(0, lasGunTweak)]
|
||||
}
|
||||
-- & itTweaks
|
||||
-- .~ Tweakable
|
||||
-- { _tweakParams = IM.fromList [(0, lasGunTweak)]
|
||||
-- }
|
||||
& itDimension . dimRad .~ 10
|
||||
& itDimension . dimCenter .~ V3 15 0 0
|
||||
-- & itUse . heldUse .~ HeldLaser --shootLaser
|
||||
@@ -87,10 +87,10 @@ tractorGun :: Item
|
||||
tractorGun =
|
||||
lasGun
|
||||
& itParams .~ Attracting{_attractionPower = 1}
|
||||
& itTweaks
|
||||
.~ Tweakable
|
||||
{ _tweakParams = IM.fromList [(0, tractorGunTweak)]
|
||||
}
|
||||
-- & itTweaks
|
||||
-- .~ Tweakable
|
||||
-- { _tweakParams = IM.fromList [(0, tractorGunTweak)]
|
||||
-- }
|
||||
& itUse . heldDelay .~ NoDelay
|
||||
& itUse . heldAim . aimWeight .~ 6
|
||||
& itUse . heldAim . aimRange .~ 1
|
||||
|
||||
@@ -18,10 +18,10 @@ launcher =
|
||||
, _shellSpinAmount = 2
|
||||
, _shellThrustDelay = 20
|
||||
}
|
||||
& itTweaks
|
||||
.~ Tweakable
|
||||
{ _tweakParams = basicAmPjMoves
|
||||
}
|
||||
-- & itTweaks
|
||||
-- .~ Tweakable
|
||||
-- { _tweakParams = basicAmPjMoves
|
||||
-- }
|
||||
& itInvSize .~ 3
|
||||
& itDimension . dimRad .~ 9
|
||||
& itDimension . dimCenter .~ V3 10 0 0
|
||||
|
||||
+49
-17
@@ -71,7 +71,8 @@ drawSubInventory :: SubInventory -> Configuration -> World -> Picture
|
||||
drawSubInventory subinv cfig w = case subinv of
|
||||
LockedInventory -> mempty -- topInvCursor col cursPos cfig w
|
||||
NoSubInventory -> drawRBOptions cfig w
|
||||
ExamineInventory mtweaki -> drawExamineInventory cfig mtweaki w
|
||||
--ExamineInventory mtweaki -> drawExamineInventory cfig mtweaki w
|
||||
ExamineInventory -> drawExamineInventory cfig w
|
||||
DisplayTerminal tid -> displayTerminal tid cfig (w ^. cWorld . lWorld)
|
||||
CombineInventory{_ciSections = sss} -> drawCombineInventory cfig sss w
|
||||
|
||||
@@ -80,16 +81,46 @@ drawCombineInventory cfig sss w =
|
||||
invHead cfig "COMBINE"
|
||||
<> drawSelectionSections sss secondColumnParams cfig
|
||||
<> combineInventoryExtra sss cfig w
|
||||
--drawExamineInventory :: Configuration -> Maybe Int -> World -> Picture
|
||||
--drawExamineInventory cfig mtweaki w =
|
||||
-- invHead cfig "EXAMINE"
|
||||
-- <> examineInventoryExtra mtweaki cfig
|
||||
-- <> drawSelectionList
|
||||
-- secondColumnParams
|
||||
-- cfig
|
||||
-- ( defaultSelectionList & slItems .~ tweakItems itm
|
||||
-- ++ map
|
||||
-- f
|
||||
-- ( makeParagraph 55 $
|
||||
-- yourAugmentedItem
|
||||
-- itemInfo
|
||||
-- (yourInfo (you w))
|
||||
-- (closeObjectInfo (crNumFreeSlots (you w)))
|
||||
-- w
|
||||
-- )
|
||||
-- )
|
||||
-- where
|
||||
-- itm = yourSelectedItem w
|
||||
-- f str =
|
||||
-- SelectionItem
|
||||
-- { _siPictures = [str]
|
||||
-- , _siHeight = 1
|
||||
-- , _siIsSelectable = True
|
||||
-- , _siColor = white
|
||||
-- , _siOffX = 0
|
||||
-- , _siPayload = ()
|
||||
-- }
|
||||
|
||||
drawExamineInventory :: Configuration -> Maybe Int -> World -> Picture
|
||||
drawExamineInventory cfig mtweaki w =
|
||||
drawExamineInventory :: Configuration -> World -> Picture
|
||||
drawExamineInventory cfig w =
|
||||
invHead cfig "EXAMINE"
|
||||
<> examineInventoryExtra mtweaki cfig
|
||||
-- <> examineInventoryExtra mtweaki cfig
|
||||
<> drawSelectionList
|
||||
secondColumnParams
|
||||
cfig
|
||||
( defaultSelectionList & slItems .~ tweakItems itm
|
||||
++ map
|
||||
( defaultSelectionList & slItems .~ -- tweakItems itm
|
||||
-- ++
|
||||
map
|
||||
f
|
||||
( makeParagraph 55 $
|
||||
yourAugmentedItem
|
||||
@@ -100,7 +131,7 @@ drawExamineInventory cfig mtweaki w =
|
||||
)
|
||||
)
|
||||
where
|
||||
itm = yourSelectedItem w
|
||||
-- itm = yourSelectedItem w
|
||||
f str =
|
||||
SelectionItem
|
||||
{ _siPictures = [str]
|
||||
@@ -178,13 +209,13 @@ drawRBOptions cfig w = fromMaybe mempty $ do
|
||||
itm <- you w ^? crInv . ix j
|
||||
return $ itemBaseName itm
|
||||
|
||||
examineInventoryExtra :: Maybe Int -> Configuration -> Picture
|
||||
examineInventoryExtra mtweaki cfig = fromMaybe mempty $ do
|
||||
tweaki <- mtweaki
|
||||
return $
|
||||
toTopLeft cfig $
|
||||
translate subInvX (-71) $
|
||||
listCursorChooseBorderScale 0 1 [North, South, West] tweaki 0 white 10 1
|
||||
--examineInventoryExtra :: Maybe Int -> Configuration -> Picture
|
||||
--examineInventoryExtra mtweaki cfig = fromMaybe mempty $ do
|
||||
-- tweaki <- mtweaki
|
||||
-- return $
|
||||
-- toTopLeft cfig $
|
||||
-- translate subInvX (-71) $
|
||||
-- listCursorChooseBorderScale 0 1 [North, South, West] tweaki 0 white 10 1
|
||||
|
||||
inventoryExtra :: SelectionSections () -> Configuration -> World
|
||||
-> IM.IntMap (Maybe (Int,Int),[Int],[Int]) -> Picture
|
||||
@@ -286,9 +317,10 @@ tweakItems :: Maybe Item -> [SelectionItem ()]
|
||||
tweakItems = textSelItems . ammoTweakStrings
|
||||
|
||||
ammoTweakStrings :: Maybe Item -> [String]
|
||||
ammoTweakStrings it = case it ^? _Just . itTweaks . tweakParams of
|
||||
Just l -> map tweakString $ IM.elems l
|
||||
_ -> ["NOT TWEAKABLE"]
|
||||
ammoTweakStrings _ = []-- case it ^? _Just . itTweaks . tweakParams of
|
||||
--ammoTweakStrings it = case it ^? _Just . itTweaks . tweakParams of
|
||||
-- Just l -> map tweakString $ IM.elems l
|
||||
-- _ -> ["NOT TWEAKABLE"]
|
||||
|
||||
tweakString :: TweakParam -> String
|
||||
tweakString tp = rightPad 12 ' ' (show $ _tweakType tp) ++ " " ++ showTweak tp
|
||||
|
||||
@@ -244,10 +244,10 @@ toggleMap u = case u ^. uvWorld . hud . hudElement of
|
||||
toggleTweakInv :: World -> World
|
||||
toggleTweakInv w = case w ^? hud . hudElement . subInventory of
|
||||
Just ExamineInventory{} -> w & thepointer .~ NoSubInventory
|
||||
_ -> w & thepointer .~ ExamineInventory mi
|
||||
_ -> w & thepointer .~ ExamineInventory -- mi
|
||||
where
|
||||
thepointer = hud . hudElement . subInventory
|
||||
mi = 0 <$ (yourSelectedItem w >>= (^? itTweaks . tweakParams . ix 0))
|
||||
-- mi = 0 <$ (yourSelectedItem w >>= (^? itTweaks . tweakParams . ix 0))
|
||||
|
||||
tryCombine :: SelectionSections CombinableItem -> World -> World
|
||||
tryCombine sss w = fromMaybe w $ do
|
||||
|
||||
+25
-24
@@ -36,11 +36,12 @@ updateWheelEvent yi w = case w ^. hud . hudElement of
|
||||
| lbDown -> w & wCam . camZoom +~ y
|
||||
| invKeyDown -> changeSwapSel yi w
|
||||
| otherwise -> scrollAugInvSel yi w
|
||||
DisplayInventory{_subInventory = ExamineInventory mi}
|
||||
| invKeyDown && rbDown -> w & moveTweakSel yi
|
||||
| invKeyDown -> scrollAugInvSel yi w
|
||||
| rbDown -> w & changeTweakParam mi yi
|
||||
| otherwise -> w & moveTweakSel yi
|
||||
--DisplayInventory{_subInventory = ExamineInventory mi} -> w
|
||||
DisplayInventory{_subInventory = ExamineInventory} -> w
|
||||
-- | invKeyDown && rbDown -> w & moveTweakSel yi
|
||||
-- | invKeyDown -> scrollAugInvSel yi w
|
||||
-- | rbDown -> w & changeTweakParam mi yi
|
||||
-- | otherwise -> w & moveTweakSel yi
|
||||
DisplayInventory{_subInventory = CombineInventory{}} -> w & moveCombineSel yi
|
||||
DisplayInventory{_subInventory = DisplayTerminal tmid} -> terminalWheelEvent yi tmid w
|
||||
_ -> w
|
||||
@@ -62,10 +63,10 @@ moveCombineSel yi =
|
||||
)
|
||||
. (worldEventFlags . at CombineInventoryChange ?~ ())
|
||||
|
||||
moveSubSel :: Int -> Int -> World -> World
|
||||
moveSubSel yi maxyi =
|
||||
hud . hudElement . subInventory . subInvMSel . _Just
|
||||
%~ ((`mod` maxyi) . subtract yi)
|
||||
--moveSubSel :: Int -> Int -> World -> World
|
||||
--moveSubSel yi maxyi =
|
||||
-- hud . hudElement . subInventory . subInvMSel . _Just
|
||||
-- %~ ((`mod` maxyi) . subtract yi)
|
||||
|
||||
guardDisconnectedID :: Int -> World -> World -> World
|
||||
guardDisconnectedID tmid w w' = case w ^? cWorld . lWorld . terminals . ix tmid . tmStatus of
|
||||
@@ -110,22 +111,22 @@ scrollRBOption dy ymax
|
||||
| dy > 0 = max 0 . subtract dy
|
||||
| otherwise = id
|
||||
|
||||
moveTweakSel :: Int -> World -> World
|
||||
moveTweakSel i w = case yourSelectedItem w ^? _Just . itTweaks . tweakParams of
|
||||
Just l -> moveSubSel i (length l) w
|
||||
_ -> w
|
||||
--moveTweakSel :: Int -> World -> World
|
||||
--moveTweakSel i w = case yourSelectedItem w ^? _Just . itTweaks . tweakParams of
|
||||
-- Just l -> moveSubSel i (length l) w
|
||||
-- _ -> w
|
||||
|
||||
changeTweakParam :: Maybe Int -> Int -> World -> World
|
||||
changeTweakParam mi i w = fromMaybe w $ do
|
||||
curpos <- you w ^? crManipulation . manObject . imSelectedItem
|
||||
paramid <- mi
|
||||
params <- yourSelectedItem w ^? _Just . itTweaks . tweakParams . ix paramid
|
||||
let x = (_tweakVal params + i) `mod` _tweakMax params
|
||||
return $
|
||||
w & cWorld . lWorld . creatures . ix 0 . crInv . ix curpos
|
||||
%~ ( (itTweaks . tweakParams . ix paramid . tweakVal .~ x)
|
||||
. doTweak (_tweakType params) x
|
||||
)
|
||||
--changeTweakParam :: Maybe Int -> Int -> World -> World
|
||||
--changeTweakParam mi i w = fromMaybe w $ do
|
||||
-- curpos <- you w ^? crManipulation . manObject . imSelectedItem
|
||||
-- paramid <- mi
|
||||
-- params <- yourSelectedItem w ^? _Just . itTweaks . tweakParams . ix paramid
|
||||
-- let x = (_tweakVal params + i) `mod` _tweakMax params
|
||||
-- return $
|
||||
-- w & cWorld . lWorld . creatures . ix 0 . crInv . ix curpos
|
||||
-- %~ ( (itTweaks . tweakParams . ix paramid . tweakVal .~ x)
|
||||
-- . doTweak (_tweakType params) x
|
||||
-- )
|
||||
|
||||
scrollCommands :: Terminal -> [TerminalCommand]
|
||||
scrollCommands = (nullCommand :) . _tmScrollCommands
|
||||
|
||||
Reference in New Issue
Block a user