This commit is contained in:
2024-09-30 14:21:19 +01:00
parent 06cca549d9
commit 53e959e6cc
16 changed files with 129 additions and 263 deletions
+1 -50
View File
@@ -1,50 +1 @@
/home/justin/Haskell/loop/src/Dodge/Render/HUD.hs:317:1-10: warning: [-Wunused-top-binds]
Defined but not used: tweakItems
|
317 | tweakItems = textSelItems . ammoTweakStrings
| ^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Render/HUD.hs:320:1-16: warning: [-Wunused-top-binds]
Defined but not used: ammoTweakStrings
|
320 | ammoTweakStrings _ = []-- case it ^? _Just . itTweaks . tweakParams of
| ^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Render/HUD.hs:326:1-11: warning: [-Wunused-top-binds]
Defined but not used: tweakString
|
326 | tweakString tp = rightPad 12 ' ' (show $ _tweakType tp) ++ " " ++ showTweak tp
| ^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Render/HUD.hs:379:1-12: warning: [-Wunused-top-binds]
Defined but not used: textSelItems
|
379 | textSelItems = map (picsToSelectable . (: []))
| ^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Render/HUD.hs:382:1-16: warning: [-Wunused-top-binds]
Defined but not used: picsToSelectable
|
382 | picsToSelectable pics =
| ^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Update/Scroll.hs:15:1-18: warning: [-Wunused-imports]
The import of Dodge.Tweak is redundant
|
15 | import Dodge.Tweak
| ^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Update/Input/InGame.hs:9:1-21: warning: [-Wunused-imports]
The import of Dodge.Base.You is redundant
|
9 | import Dodge.Base.You
| ^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Item/Held/BatteryGuns.hs:19:1-33: warning: [-Wunused-imports]
The qualified import of IntMapHelp is redundant
|
19 | import qualified IntMapHelp as IM
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Item/Held/BatteryGuns.hs:79:1-11: warning: [-Wunused-top-binds]
Defined but not used: lasGunTweak
|
79 | lasGunTweak =
| ^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Item/Held/BatteryGuns.hs:102:1-15: warning: [-Wunused-top-binds]
Defined but not used: tractorGunTweak
|
102 | tractorGunTweak =
| ^^^^^^^^^^^^^^^
All good (608 modules, at 14:21:16)
+4 -6
View File
@@ -34,9 +34,9 @@ useRootItem crid w = fromMaybe w $ do
itemUseEffect :: Creature -> LabelDoubleTree ComposeLinkType Item -> World -> World
itemUseEffect cr it w = case it ^. ldtValue . itUse of
HeldUse{ } -> heldEffect it cr w
UseHeld{} -> heldEffect it cr w
& pointerToItem itm . itUse . heldHammer .~ HammerDown
LeftUse{} -> doequipmentchange
UseHotkey{} -> doequipmentchange
EquipUse{} -> doequipmentchange
(ConsumeUse eff) -> useC eff (_ldtValue it) cr w
CraftUse{} -> w
@@ -103,13 +103,11 @@ useItemLeftClick cr w = fromMaybe w $ do
invid <- cr ^? crManipulation . manObject . imSelectedItem
ituse <- cr ^? crInv . ix invid . itUse
case ituse of
--HeldUse{} -> return $ hammerTest (cWorld . lWorld . creatures . ix (_crID cr) %~ crReloadToggle)
HeldUse{} -> return w
UseHeld{} -> return w
ConsumeUse{} -> return $ useItemLeftClick' cr w
EquipUse{} -> return $ useItemLeftClick' cr w
LeftUse{} -> return $ useItemLeftClick' cr w
UseHotkey{} -> return $ useItemLeftClick' cr w
AmmoMagUse{} -> return w
--AmmoMagUse{} -> return $ hammerTest (cWorld . lWorld . creatures . ix (_crID cr) %~ crReloadToggle)
_ -> Nothing
useItemLeftClick' :: Creature -> World -> World
+1 -19
View File
@@ -5,7 +5,6 @@ module Dodge.Data.Item (
module Dodge.Data.Item,
module Dodge.Data.Item.Effect,
module Dodge.Data.Item.Misc,
module Dodge.Data.Item.Tweak,
module Dodge.Data.Item.Params,
module Dodge.Data.Item.Use,
module Dodge.Data.Item.CurseStatus,
@@ -17,7 +16,6 @@ module Dodge.Data.Item (
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Data.Set (Set)
import Dodge.Data.Item.Combine
import Dodge.Data.Item.CurseStatus
import Dodge.Data.Item.Effect
@@ -25,12 +23,10 @@ import Dodge.Data.Item.Location
import Dodge.Data.Item.Misc
import Dodge.Data.Item.Params
import Dodge.Data.Item.Scope
import Dodge.Data.Item.Tweak
import Dodge.Data.Item.Use
import NewInt
data ItID = ItID
deriving (Eq, Ord, Show, Read)
data ItID = ItID deriving (Eq, Ord, Show, Read)
data Item = Item
{ _itUse :: ItemUse
@@ -41,23 +37,9 @@ data Item = Item
, _itInvSize :: Int
, _itDimension :: ItemDimension
, _itCurseStatus :: CurseStatus
-- , _itTweaks :: ItemTweaks
, _itParams :: ItemParams
, _itAttachments :: Set ItemAttachment
}
data ItemAttachment
= ScopeAttachment
| BulletClipAttachment
| BulletBeltAttachment
| StandAttachment
| PowerSourceAttachment
deriving (Eq, Ord)
_itUseAimStance :: Item -> AimStance
_itUseAimStance = _aimStance . _heldAim . _itUse
makeLenses ''Item
deriveJSON defaultOptions ''ItID
deriveJSON defaultOptions ''ItemAttachment
deriveJSON defaultOptions ''Item
-39
View File
@@ -1,39 +0,0 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Item.Tweak where
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import qualified IntMapHelp as IM
data ItemTweaks
= NoTweaks
| Tweakable
{ _tweakParams :: IM.IntMap TweakParam
}
deriving (Eq, Show, Read) --Generic, Flat)
data TweakType
= TweakPhaseV
| TweakTractionPower
| TweakSpinDrag
| TweakSpinAmount
| TweakThrustDelay
deriving (Eq, Show, Read) --Generic, Flat)
data TweakParam = TweakParam
{ _tweakType :: TweakType -- Int -> Item -> Item
, _tweakVal :: Int
, _tweakMax :: Int
}
deriving (Eq, Show, Read) --Generic, Flat)
makeLenses ''TweakParam
makeLenses ''ItemTweaks
deriveJSON defaultOptions ''TweakType
deriveJSON defaultOptions ''TweakParam
deriveJSON defaultOptions ''ItemTweaks
+3 -7
View File
@@ -34,19 +34,15 @@ import Geometry.Data
import Sound.Data
data ItemUse
= HeldUse
{ -- _heldUse :: Huse
_heldDelay :: UseDelay
-- , _heldMods :: HeldMod
= UseHeld
{ _heldDelay :: UseDelay
, _heldHammer :: HammerPosition
, _heldAim :: AimParams
, _heldAmmoTypes :: IM.IntMap AmmoType
, _heldParams :: HeldParams
, _heldTriggerType :: TriggerType
, _heldUsageTime :: Int -- this is not yet implemented
-- , _useTargeting :: Maybe TargetType
}
| LeftUse
| UseHotkey
{ _leftUse :: Luse
, _leftDelay :: UseDelay
, _leftHammer :: HammerPosition
-3
View File
@@ -30,9 +30,6 @@ defaultHeldItem = Item
, _itDimension = defaultItemDimension
, _itUse = defaultHeldUse
, _itParams = NoParams
-- , _itTweaks = NoTweaks
-- , _itScope = NoScope
, _itAttachments = mempty
}
defaultLeftItem :: Item
+24 -28
View File
@@ -12,14 +12,13 @@ import Dodge.Default.Item.Use.Consumption
import Dodge.Default.Item.Use.Equipment
defaultLeftUse :: ItemUse
defaultLeftUse =
LeftUse
{ _leftUse = LDoNothing
, _leftDelay = FixedRate{_rateMax = 8, _rateTime = 0}
, _leftHammer = HammerUp
, _equipEffect = defaultEquip
, _leftConsumption = defaultLeftLoadable
}
defaultLeftUse = UseHotkey
{ _leftUse = LDoNothing
, _leftDelay = FixedRate{_rateMax = 8, _rateTime = 0}
, _leftHammer = HammerUp
, _equipEffect = defaultEquip
, _leftConsumption = defaultLeftLoadable
}
defaultEquipUse :: ItemUse
defaultEquipUse = EquipUse
@@ -28,24 +27,21 @@ defaultEquipUse = EquipUse
}
defaultHeldUse :: ItemUse
defaultHeldUse =
HeldUse
{ _heldDelay = FixedRate{_rateMax = 8, _rateTime = 0}
-- , _heldMods = DoNothingMod
, _heldHammer = HammerUp
, _heldAim = defaultAimParams
, _heldAmmoTypes = mempty
, _heldParams = BulletShooterParams
{ _muzVel = ConstFloat 0.8
, _rifling = ConstFloat 0.8
, _recoil = 10
, _torqueAfter = 0.2
, _randomOffset = 0
, _sidePush = 0
, _bulGunSound = Just (tap3S, 0)
, _weaponInvLock = 0
, _weaponRepeat = []
}
, _heldTriggerType = HammerTrigger
, _heldUsageTime = 0
defaultHeldUse = UseHeld
{ _heldDelay = FixedRate{_rateMax = 8, _rateTime = 0}
, _heldHammer = HammerUp
, _heldAim = defaultAimParams
, _heldAmmoTypes = mempty
, _heldParams = BulletShooterParams
{ _muzVel = ConstFloat 0.8
, _rifling = ConstFloat 0.8
, _recoil = 10
, _torqueAfter = 0.2
, _randomOffset = 0
, _sidePush = 0
, _bulGunSound = Just (tap3S, 0)
, _weaponInvLock = 0
, _weaponRepeat = []
}
, _heldTriggerType = HammerTrigger
}
+3 -6
View File
@@ -109,15 +109,12 @@ showAutoRechargeProgress lc = case lc of
itemNumberDisplay :: Creature -> Item -> [String]
itemNumberDisplay cr itm = case iu of
--HeldUse{} -> [showReloadProgress cr itm]
HeldUse{} -> []
LeftUse{} -> [showAutoRechargeProgress (_leftConsumption iu)]
UseHeld{} -> []
UseHotkey{} -> [showAutoRechargeProgress (_leftConsumption iu)]
EquipUse{} -> showEquipmentNumber cr itm
--CraftUse x -> [show $ x ^. getItAmount]
CraftUse -> []
--ConsumeUse {_useAmount = x} -> [show $ x ^. getItAmount]
ConsumeUse {} -> []
AttachUse {} -> [] --[showReloadProgress cr itm]
AttachUse {} -> []
AmmoMagUse {} -> [maybe "" shortShow $ itm ^? itUse . amagLoadStatus . iaLoaded]
ScopeUse OpticScope {_opticZoom = x} -> [shortShow x]
ScopeUse {} -> []
+1 -1
View File
@@ -18,7 +18,7 @@ import ShapePicture
itemEquipPict :: Creature -> LabelDoubleTree ComposeLinkType PartiallyComposedItem -> SPic
itemEquipPict cr itmtree = case itm ^. itUse of
HeldUse{} | itm ^? itLocation . ilIsRoot == Just True
UseHeld{} | itm ^? itLocation . ilIsRoot == Just True
-> overPosSP (heldItemOffset itm cr) (itemSPic itmtree)
ituse -> fromMaybe mempty $ do
attachpos <- ituse ^? equipEffect . eeAttachPos
+15 -15
View File
@@ -16,7 +16,7 @@ import Dodge.Data.Item
--import Dodge.Reloading.Action
import Dodge.Tesla.ItemParams
import Geometry.Data
import qualified IntMapHelp as IM
--import qualified IntMapHelp as IM
sparkGun :: Item
sparkGun =
@@ -75,13 +75,13 @@ lasGun =
-- & itUse . heldAim . aimMuzPos .~ 30
& itType .~ HELD LASGUN
lasGunTweak :: TweakParam
lasGunTweak =
TweakParam
{ _tweakType = TweakPhaseV
, _tweakVal = 1
, _tweakMax = 3
}
--lasGunTweak :: TweakParam
--lasGunTweak =
-- TweakParam
-- { _tweakType = TweakPhaseV
-- , _tweakVal = 1
-- , _tweakMax = 3
-- }
tractorGun :: Item
tractorGun =
@@ -98,13 +98,13 @@ tractorGun =
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleTractor
& itType .~ HELD TRACTORGUN
tractorGunTweak :: TweakParam
tractorGunTweak =
TweakParam
{ _tweakType = TweakTractionPower
, _tweakVal = 1
, _tweakMax = 4
}
--tractorGunTweak :: TweakParam
--tractorGunTweak =
-- TweakParam
-- { _tweakType = TweakTractionPower
-- , _tweakVal = 1
-- , _tweakMax = 4
-- }
--lasWide :: Int -> Item
--lasWide n =
+30 -30
View File
@@ -63,34 +63,34 @@ launcherX i =
-- & itScope .~ RemoteScope (V2 0 0) 1
---- & itUse . heldConsumption . laAmmoType . amPjDraw .~ DrawRemoteShell
basicAmPjMoves :: IM.IntMap TweakParam
basicAmPjMoves =
IM.fromList . zip [0 ..] $
[ spinDrag
, spinStart
, thrustParam
]
--basicAmPjMoves :: IM.IntMap TweakParam
--basicAmPjMoves =
-- IM.fromList . zip [0 ..] $
-- [ spinDrag
-- , spinStart
-- , thrustParam
-- ]
spinDrag :: TweakParam
spinDrag =
TweakParam
{ _tweakType = TweakSpinDrag
, _tweakVal = 1
, _tweakMax = 5
}
spinStart :: TweakParam
spinStart =
TweakParam
{ _tweakType = TweakSpinAmount
, _tweakVal = 2
, _tweakMax = 5
}
thrustParam :: TweakParam
thrustParam =
TweakParam
{ _tweakType = TweakThrustDelay
, _tweakVal = 1
, _tweakMax = 5
}
--spinDrag :: TweakParam
--spinDrag =
-- TweakParam
-- { _tweakType = TweakSpinDrag
-- , _tweakVal = 1
-- , _tweakMax = 5
-- }
--
--spinStart :: TweakParam
--spinStart =
-- TweakParam
-- { _tweakType = TweakSpinAmount
-- , _tweakVal = 2
-- , _tweakMax = 5
-- }
--
--thrustParam :: TweakParam
--thrustParam =
-- TweakParam
-- { _tweakType = TweakThrustDelay
-- , _tweakVal = 1
-- , _tweakMax = 5
-- }
+14 -26
View File
@@ -30,12 +30,12 @@ import Dodge.Render.List
import Dodge.ScreenPos
import Dodge.SelectionSections
import Dodge.SelectionSections.Draw
import Dodge.Tweak.Show
--import Dodge.Tweak.Show
import Geometry
import qualified IntMapHelp as IM
import Justify
--import ListHelp
import Padding
--import Padding
import Picture
import SDL (MouseButton (..))
@@ -313,18 +313,6 @@ lnkMidPosInvSelsCol cfig w i col = foldMap f
invcol <- selSecSelCol 0 j sss
return $ zConnectCol (rp - V2 5 0) (lp + V2 175 0) col col col invcol
tweakItems :: Maybe Item -> [SelectionItem ()]
tweakItems = textSelItems . ammoTweakStrings
ammoTweakStrings :: Maybe Item -> [String]
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
invHead :: Configuration -> String -> Picture
invHead cfig =
translateScreenPos cfig (fromTopLeft (V2 (subInvX - 5) 80))
@@ -375,19 +363,19 @@ invHead cfig =
-- ( halfHeight cfig - 20* (fromIntegral invPos +1) + 2.5)
-- return . winScale cfig . color col $ lConnect p itScreenPos
textSelItems :: [String] -> [SelectionItem ()]
textSelItems = map (picsToSelectable . (: []))
--textSelItems :: [String] -> [SelectionItem ()]
--textSelItems = map (picsToSelectable . (: []))
picsToSelectable :: [String] -> SelectionItem ()
picsToSelectable pics =
SelectionItem
{ _siPictures = pics
, _siHeight = length pics
, _siIsSelectable = True
, _siColor = white
, _siOffX = 0
, _siPayload = ()
}
--picsToSelectable :: [String] -> SelectionItem ()
--picsToSelectable pics =
-- SelectionItem
-- { _siPictures = pics
-- , _siHeight = length pics
-- , _siIsSelectable = True
-- , _siColor = white
-- , _siOffX = 0
-- , _siPayload = ()
-- }
-- would be nice to add parameter to orient this with NSEW, cf cursor
selNumPos ::
+7 -7
View File
@@ -3,13 +3,13 @@ module Dodge.Tweak where
import Control.Lens
import Dodge.Data.Item
doTweak :: TweakType -> Int -> Item -> Item
doTweak tt = case tt of
TweakPhaseV -> tweakPhaseV
TweakTractionPower -> tweakTractionPower
TweakSpinDrag -> \i -> itParams . shellSpinDrag .~ i
TweakSpinAmount -> \i -> itParams . shellSpinAmount .~ i
TweakThrustDelay -> \i -> itParams . shellThrustDelay .~ i
--doTweak :: TweakType -> Int -> Item -> Item
--doTweak tt = case tt of
-- TweakPhaseV -> tweakPhaseV
-- TweakTractionPower -> tweakTractionPower
-- TweakSpinDrag -> \i -> itParams . shellSpinDrag .~ i
-- TweakSpinAmount -> \i -> itParams . shellSpinAmount .~ i
-- TweakThrustDelay -> \i -> itParams . shellThrustDelay .~ i
tweakTractionPower :: Int -> Item -> Item
tweakTractionPower 0 = itParams . attractionPower .~ 1
+24 -24
View File
@@ -1,27 +1,27 @@
module Dodge.Tweak.Show where
import Dodge.Data.Item.Tweak
--import Dodge.Data.Item.Tweak
showTweak :: TweakParam -> String
showTweak tp = case tt of
TweakPhaseV -> showPhaseV ct
TweakTractionPower -> showTractionPower ct
TweakSpinDrag -> show ct
TweakSpinAmount -> show ct
TweakThrustDelay -> show ct
where
tt = _tweakType tp
ct = _tweakVal tp
showPhaseV :: Int -> String
showPhaseV 0 = "V"
showPhaseV 1 = "/"
showPhaseV 2 = "Z"
showPhaseV i = show i ++ " should not be possible"
showTractionPower :: Int -> String
showTractionPower 0 = "+"
showTractionPower 1 = "-"
showTractionPower 2 = "#"
showTractionPower 3 = "0" -- object should stay in the center of the beam
showTractionPower i = "THIS SHOULD NOT BE POSSIBLE" ++ show i
--showTweak :: TweakParam -> String
--showTweak tp = case tt of
-- TweakPhaseV -> showPhaseV ct
-- TweakTractionPower -> showTractionPower ct
-- TweakSpinDrag -> show ct
-- TweakSpinAmount -> show ct
-- TweakThrustDelay -> show ct
-- where
-- tt = _tweakType tp
-- ct = _tweakVal tp
--
--showPhaseV :: Int -> String
--showPhaseV 0 = "V"
--showPhaseV 1 = "/"
--showPhaseV 2 = "Z"
--showPhaseV i = show i ++ " should not be possible"
--
--showTractionPower :: Int -> String
--showTractionPower 0 = "+"
--showTractionPower 1 = "-"
--showTractionPower 2 = "#"
--showTractionPower 3 = "0" -- object should stay in the center of the beam
--showTractionPower i = "THIS SHOULD NOT BE POSSIBLE" ++ show i
+1 -1
View File
@@ -6,7 +6,7 @@ import qualified Data.IntMap.Strict as IM
import Data.List (sort)
import qualified Data.Map.Strict as M
import Data.Maybe
import Dodge.Base.You
--import Dodge.Base.You
import Dodge.Button.Event
import Dodge.Camera
import Dodge.Creature.Action
+1 -1
View File
@@ -12,7 +12,7 @@ import Dodge.Inventory
import Dodge.SelectionSections
--import Dodge.SoundLogic
import Dodge.Terminal
import Dodge.Tweak
--import Dodge.Tweak
import qualified IntMapHelp as IM
import LensHelp
import SDL