Compare commits
10
Commits
05bc7c6655
...
7cb17034f8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7cb17034f8 | ||
|
|
297b4e0b3c | ||
|
|
17c79e7cee | ||
|
|
03b793802f | ||
|
|
448669cd83 | ||
|
|
5604d7f1e3 | ||
|
|
ac87621640 | ||
|
|
2f0bb5115b | ||
|
|
7df81559d9 | ||
|
|
63c71c852d |
@@ -4,6 +4,7 @@ module Dodge.Combine (
|
|||||||
combineList',
|
combineList',
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Dodge.Item.SlotsTaken
|
||||||
import Dodge.Data.Universe
|
import Dodge.Data.Universe
|
||||||
import Dodge.Data.Combine
|
import Dodge.Data.Combine
|
||||||
import Dodge.Item.Display
|
import Dodge.Item.Display
|
||||||
@@ -46,19 +47,19 @@ combineItemListYouX = map (first $ concatMap g) . lookupItems . yourInv
|
|||||||
|
|
||||||
combineList :: World -> [SelectionItem CombinableItem]
|
combineList :: World -> [SelectionItem CombinableItem]
|
||||||
combineList w = case combineList' w of
|
combineList w = case combineList' w of
|
||||||
[] -> [SelectionInfo ["No possible combinations"] 1 False white 0]
|
[] -> [SelectionInfo ["No possible combinations"] 1 False white 0 0]
|
||||||
xs -> xs
|
xs -> xs
|
||||||
|
|
||||||
combineList' :: World -> [SelectionItem CombinableItem]
|
combineList' :: World -> [SelectionItem CombinableItem]
|
||||||
combineList' = map f . combineListInfo
|
combineList' = map f . combineListInfo
|
||||||
where
|
where
|
||||||
f (is,(strs,itm)) = SelectionItem
|
f (is,(strs,itm)) = SelectionItem
|
||||||
{ _siPictures = itemDisplay itm
|
{ _siPictures = basicItemDisplay itm
|
||||||
, _siHeight = length (itemDisplay itm)
|
, _siHeight = itSlotsTaken itm
|
||||||
, _siIsSelectable = True
|
, _siIsSelectable = True
|
||||||
--, _siWidth = maximum (map length (itemDisplay itm))
|
|
||||||
, _siColor = _itInvColor itm
|
, _siColor = _itInvColor itm
|
||||||
, _siOffX = 0
|
, _siOffX = 0
|
||||||
|
, _siOffY = 0
|
||||||
, _siPayload = CombinableItem is itm strs
|
, _siPayload = CombinableItem is itm strs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import LensHelp
|
|||||||
moduleModification :: ItemModuleType -> Item -> Item
|
moduleModification :: ItemModuleType -> Item -> Item
|
||||||
moduleModification imt = case imt of
|
moduleModification imt = case imt of
|
||||||
EMPTYMODULE -> id
|
EMPTYMODULE -> id
|
||||||
DRUMMAG -> itUse . heldConsumption . laMax .~ 45
|
DRUMMAG -> itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 45
|
||||||
BELTMAG -> itUse . heldConsumption . laMax .~ 150
|
BELTMAG -> itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 150
|
||||||
MAGNETMAG -> itUse . heldDelay . rateMax .~ 4
|
MAGNETMAG -> itUse . heldDelay . rateMax .~ 4
|
||||||
BULPAY BulFlak -> (itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ BulFlak)
|
BULPAY BulFlak -> (itUse . heldConsumption . laAmmoType . amBullet . buSpawn .~ BulFlak)
|
||||||
. (itUse . heldConsumption . laAmmoType . amBullet . buTimer .~ 3)
|
. (itUse . heldConsumption . laAmmoType . amBullet . buTimer .~ 3)
|
||||||
@@ -33,7 +33,7 @@ moduleModification imt = case imt of
|
|||||||
. (itParams . subParams ?~ teslaParams)
|
. (itParams . subParams ?~ teslaParams)
|
||||||
WEPTELE -> makeDirectedTele
|
WEPTELE -> makeDirectedTele
|
||||||
LAUNCHHOME -> itUse . heldConsumption . laAmmoType . amPjCreation .~ CreateTrackingShell
|
LAUNCHHOME -> itUse . heldConsumption . laAmmoType . amPjCreation .~ CreateTrackingShell
|
||||||
EXTRABATTERY -> itUse . heldConsumption . laMax +~ 1000
|
EXTRABATTERY -> itUse . heldConsumption . laSource . _InternalSource . iaMax +~ 1000
|
||||||
ATTACHTORCH -> id
|
ATTACHTORCH -> id
|
||||||
where
|
where
|
||||||
makeDirectedTele it =
|
makeDirectedTele it =
|
||||||
|
|||||||
@@ -262,4 +262,6 @@ stackedInventory =
|
|||||||
, flameThrower
|
, flameThrower
|
||||||
, poisonSprayer
|
, poisonSprayer
|
||||||
, launcher
|
, launcher
|
||||||
|
, bulletBeltPack
|
||||||
|
, bulletBeltBracer
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -10,18 +10,15 @@ import Dodge.Hotkey
|
|||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
import qualified Data.Map.Strict as M
|
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Cuse
|
import Dodge.Cuse
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
import Dodge.Euse
|
import Dodge.Euse
|
||||||
import Dodge.HeldUse
|
import Dodge.HeldUse
|
||||||
import Dodge.Inventory
|
import Dodge.Inventory
|
||||||
import Dodge.Item.Location
|
|
||||||
import Dodge.Luse
|
import Dodge.Luse
|
||||||
import Dodge.Reloading
|
import Dodge.Reloading
|
||||||
import qualified IntMapHelp as IM
|
import qualified IntMapHelp as IM
|
||||||
import qualified SDL
|
|
||||||
|
|
||||||
useItemRightClick :: Creature -> World -> World
|
useItemRightClick :: Creature -> World -> World
|
||||||
useItemRightClick cr' w = fromMaybe (f w) $ do
|
useItemRightClick cr' w = fromMaybe (f w) $ do
|
||||||
@@ -37,38 +34,19 @@ useItemRightClick cr' w = fromMaybe (f w) $ do
|
|||||||
itemEffect :: Creature -> Item -> World -> World
|
itemEffect :: Creature -> Item -> World -> World
|
||||||
itemEffect cr it w = case it ^. itUse of
|
itemEffect cr it w = case it ^. itUse of
|
||||||
HeldUse{_heldUse = eff, _heldMods = usemods} ->
|
HeldUse{_heldUse = eff, _heldMods = usemods} ->
|
||||||
hammerTest $ tryReload cr it (_input w) $ foldl' (&) (useHeld eff) (useMod usemods) it cr
|
foldl' (&) (useHeld eff) (useMod usemods) it cr w
|
||||||
LeftUse{} -> doequipmentchange
|
LeftUse{} -> doequipmentchange
|
||||||
EquipUse{} -> doequipmentchange
|
EquipUse{} -> doequipmentchange
|
||||||
-- ConsumeUse will cause problems if the item is not selected
|
-- ConsumeUse will cause problems if the item is not selected
|
||||||
(ConsumeUse eff _) -> setuhamdown $ hammerTest $ useC eff it cr . rmInvItem (_crID cr) itRef
|
(ConsumeUse eff _) -> useC eff it cr $ rmInvItem (_crID cr) itRef w
|
||||||
CraftUse{} -> setuhamdown w
|
CraftUse{} -> w
|
||||||
where
|
where
|
||||||
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||||
hammerTest f = case _crHammerPosition cr of
|
hammerTest f = case _crHammerPosition cr of
|
||||||
HammerUp -> f w
|
HammerUp -> f w & setuhamdown
|
||||||
_ -> w & setuhamdown
|
_ -> w & setuhamdown
|
||||||
setuhamdown = cWorld . lWorld . creatures . ix (_crID cr) . crHammerPosition .~ HammerDown
|
setuhamdown = cWorld . lWorld . creatures . ix (_crID cr) . crHammerPosition .~ HammerDown
|
||||||
doequipmentchange =
|
doequipmentchange = hammerTest $ toggleEquipmentAt itRef cr
|
||||||
setuhamdown $
|
|
||||||
hammerTest
|
|
||||||
( toggleEquipmentAt itRef cr
|
|
||||||
)
|
|
||||||
|
|
||||||
tryReload :: Creature -> Item -> Input -> (World -> World) -> World -> World
|
|
||||||
tryReload cr it theinput f
|
|
||||||
| cid == 0 && itNeedsLoading it && _mouseButtons theinput M.!? SDL.ButtonLeft == Just 0 =
|
|
||||||
cWorld . lWorld . creatures . ix cid %~ crToggleReloading
|
|
||||||
| otherwise =
|
|
||||||
(runIdentity . pointerToItemLocation (_itLocation it) (return . (itUse . heldHammer .~ HammerDown)))
|
|
||||||
. f
|
|
||||||
where
|
|
||||||
cid = _crID cr
|
|
||||||
|
|
||||||
itNeedsLoading :: Item -> Bool
|
|
||||||
itNeedsLoading it = _laLoaded ic == 0 || not (_laPrimed ic)
|
|
||||||
where
|
|
||||||
ic = _heldConsumption (_itUse it)
|
|
||||||
|
|
||||||
toggleEquipmentAt :: Int -> Creature -> World -> World
|
toggleEquipmentAt :: Int -> Creature -> World -> World
|
||||||
toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
||||||
@@ -119,10 +97,16 @@ useItemLeftClick cr w = fromMaybe w $ do
|
|||||||
invid <- cr ^? crManipulation . manObject . inInventory . ispItem
|
invid <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||||
ituse <- cr ^? crInv . ix invid . itUse
|
ituse <- cr ^? crInv . ix invid . itUse
|
||||||
case ituse of
|
case ituse of
|
||||||
|
HeldUse{} -> return $ hammerTest (cWorld . lWorld . creatures . ix (_crID cr) %~ crUpdateLoadSource)
|
||||||
ConsumeUse{} -> return $ useItemRightClick cr w
|
ConsumeUse{} -> return $ useItemRightClick cr w
|
||||||
EquipUse{} -> return $ useItemRightClick cr w
|
EquipUse{} -> return $ useItemRightClick cr w
|
||||||
LeftUse{} -> return $ useItemRightClick cr w
|
LeftUse{} -> return $ useItemRightClick cr w
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
|
where
|
||||||
|
hammerTest f = case _crHammerPosition cr of
|
||||||
|
HammerUp -> f w & setuhamdown
|
||||||
|
_ -> w & setuhamdown
|
||||||
|
setuhamdown = cWorld . lWorld . creatures . ix (_crID cr) . crHammerPosition .~ HammerDown
|
||||||
|
|
||||||
useItemHotkey :: Int -> Int -> World -> World
|
useItemHotkey :: Int -> Int -> World -> World
|
||||||
useItemHotkey crid invid w = fromMaybe w $ do
|
useItemHotkey crid invid w = fromMaybe w $ do
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ reloadOverride :: Creature -> Creature
|
|||||||
reloadOverride cr = fromMaybe cr $ do
|
reloadOverride cr = fromMaybe cr $ do
|
||||||
guard $ cr ^. crStance . posture == Aiming
|
guard $ cr ^. crStance . posture == Aiming
|
||||||
itRef <- cr ^? crManipulation . manObject . inInventory . ispItem
|
itRef <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||||
guard $ cr ^? crInv . ix itRef . itUse . heldConsumption . laLoaded == Just 0
|
guard $ cr ^? crInv . ix itRef . itUse . heldConsumption . laSource . _InternalSource . iaLoaded == Just 0
|
||||||
return $ cr & crActionPlan . apStrategy .~ StrategyActions Reload reloadActions
|
return $ cr & crActionPlan . apStrategy .~ StrategyActions Reload reloadActions
|
||||||
where
|
where
|
||||||
reloadActions =
|
reloadActions =
|
||||||
|
|||||||
@@ -40,8 +40,12 @@ crIsReloading cr = case cr ^? crManipulation . manObject . inInventory . iselAct
|
|||||||
crWeaponReady :: Creature -> Bool
|
crWeaponReady :: Creature -> Bool
|
||||||
crWeaponReady cr = fromMaybe False $ do
|
crWeaponReady cr = fromMaybe False $ do
|
||||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||||
ic <- cr ^? crInv . ix i . itUse . heldConsumption
|
asource <- cr ^? crInv . ix i . itUse . heldConsumption . laSource
|
||||||
return (_laLoaded ic > 0 && _laPrimed ic)
|
case asource of
|
||||||
|
InternalSource ia -> return (_iaLoaded ia > 0 && _iaPrimed ia)
|
||||||
|
AboveSource -> do
|
||||||
|
x <- cr ^? crInv . ix (i - 1) . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||||
|
return (x > 0)
|
||||||
|
|
||||||
crCanSeeCr :: Creature -> (World, Creature) -> Bool
|
crCanSeeCr :: Creature -> (World, Creature) -> Bool
|
||||||
crCanSeeCr tcr (w, cr) = hasLOS (_crPos cr) (_crPos tcr) w
|
crCanSeeCr tcr (w, cr) = hasLOS (_crPos cr) (_crPos tcr) w
|
||||||
|
|||||||
@@ -115,6 +115,8 @@ data EquipItemType
|
|||||||
|
|
||||||
| JETPACK
|
| JETPACK
|
||||||
| FUELPACK
|
| FUELPACK
|
||||||
|
| BULLETBELTPACK
|
||||||
|
| BULLETBELTBRACER
|
||||||
| BATTERYPACK
|
| BATTERYPACK
|
||||||
|
|
||||||
| AUTODETECTOR Detector
|
| AUTODETECTOR Detector
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
module Dodge.Data.Item.HeldUse where
|
module Dodge.Data.Item.HeldUse where
|
||||||
|
|
||||||
|
import Dodge.Data.Item.Use.Consumption.Ammo
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
import Data.Aeson.TH
|
import Data.Aeson.TH
|
||||||
import Dodge.Data.CamouflageStatus
|
import Dodge.Data.CamouflageStatus
|
||||||
@@ -44,6 +45,13 @@ data Euse
|
|||||||
| EonWristShield
|
| EonWristShield
|
||||||
| EoffWristShield
|
| EoffWristShield
|
||||||
| EFuelSource {_euseFuelAmount :: Int, _euseFuelMax :: Int}
|
| EFuelSource {_euseFuelAmount :: Int, _euseFuelMax :: Int}
|
||||||
|
| EBatterySource {_euseBatteryAmount :: Int, _euseBatteryMax :: Int}
|
||||||
|
| EAmmoSource
|
||||||
|
{ _euseAmmoAmount :: Int
|
||||||
|
, _euseAmmoMax :: Int
|
||||||
|
, _euseAmmoSourceType :: AmmoSourceType
|
||||||
|
, _euseAmmoLink :: Maybe Int
|
||||||
|
}
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data Luse
|
data Luse
|
||||||
|
|||||||
@@ -20,17 +20,26 @@ import Dodge.Data.Item.Use.Consumption.LoadAction
|
|||||||
data HeldConsumption
|
data HeldConsumption
|
||||||
= LoadableAmmo
|
= LoadableAmmo
|
||||||
{ _laAmmoType :: AmmoType
|
{ _laAmmoType :: AmmoType
|
||||||
, _laMax :: Int
|
, _laSource :: AmmoSource
|
||||||
, _laLoaded :: Int
|
, _laSourceType :: AmmoSourceType
|
||||||
, _laPrimed :: Bool
|
|
||||||
, _laCycle :: [LoadAction]
|
|
||||||
, _laProgress :: Maybe [LoadAction]
|
|
||||||
}
|
}
|
||||||
| ChargingAmmo { _caCharge :: Int
|
|
||||||
, _caMax :: Int }
|
|
||||||
| NoConsumption
|
| NoConsumption
|
||||||
deriving (Eq, Show, Read) --Generic, Flat)
|
deriving (Eq, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
data AmmoSource
|
||||||
|
= InternalSource InternalAmmo
|
||||||
|
| AboveSource
|
||||||
|
deriving (Eq, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
data InternalAmmo = InternalAmmo
|
||||||
|
{ _iaMax :: Int
|
||||||
|
, _iaLoaded :: Int
|
||||||
|
, _iaPrimed :: Bool
|
||||||
|
, _iaCycle :: [LoadAction]
|
||||||
|
, _iaProgress :: Maybe [LoadAction]
|
||||||
|
}
|
||||||
|
deriving (Eq, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data LeftConsumption
|
data LeftConsumption
|
||||||
= AutoRecharging
|
= AutoRecharging
|
||||||
{ _arLoaded :: Int
|
{ _arLoaded :: Int
|
||||||
@@ -53,6 +62,10 @@ newtype ItAmount = ItAmount {_getItAmount :: Int}
|
|||||||
makeLenses ''HeldConsumption
|
makeLenses ''HeldConsumption
|
||||||
makeLenses ''LeftConsumption
|
makeLenses ''LeftConsumption
|
||||||
makeLenses ''ItAmount
|
makeLenses ''ItAmount
|
||||||
|
makePrisms ''AmmoSource
|
||||||
|
makeLenses ''InternalAmmo
|
||||||
|
deriveJSON defaultOptions ''InternalAmmo
|
||||||
|
deriveJSON defaultOptions ''AmmoSource
|
||||||
deriveJSON defaultOptions ''HeldConsumption
|
deriveJSON defaultOptions ''HeldConsumption
|
||||||
deriveJSON defaultOptions ''LeftConsumption
|
deriveJSON defaultOptions ''LeftConsumption
|
||||||
deriveJSON defaultOptions ''ItAmount
|
deriveJSON defaultOptions ''ItAmount
|
||||||
|
|||||||
@@ -34,6 +34,13 @@ data ProjectileUpdate
|
|||||||
| PJRemoteShellCollisionCheck
|
| PJRemoteShellCollisionCheck
|
||||||
deriving (Show, Eq, Ord, Read) --Generic, Flat)
|
deriving (Show, Eq, Ord, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
data AmmoSourceType
|
||||||
|
= BulletSource
|
||||||
|
| ChargeSource
|
||||||
|
| ChemfuelSource
|
||||||
|
| BombSource
|
||||||
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data AmmoType
|
data AmmoType
|
||||||
= ProjectileAmmo
|
= ProjectileAmmo
|
||||||
{ _amPayload :: Payload
|
{ _amPayload :: Payload
|
||||||
@@ -71,3 +78,4 @@ deriveJSON defaultOptions ''ProjectileUpdate
|
|||||||
deriveJSON defaultOptions ''GasCreate
|
deriveJSON defaultOptions ''GasCreate
|
||||||
deriveJSON defaultOptions ''ForceFieldType
|
deriveJSON defaultOptions ''ForceFieldType
|
||||||
deriveJSON defaultOptions ''AmmoType
|
deriveJSON defaultOptions ''AmmoType
|
||||||
|
deriveJSON defaultOptions ''AmmoSourceType
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ data InventoryManipulation
|
|||||||
|
|
||||||
data InvSelAction
|
data InvSelAction
|
||||||
= NoInvSelAction
|
= NoInvSelAction
|
||||||
|
| AttachLoadSourceAction {_actionProgress :: Int}
|
||||||
| ReloadAction {_actionProgress :: Int, _reloadAction :: LoadAction}
|
| ReloadAction {_actionProgress :: Int, _reloadAction :: LoadAction}
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ data SelectionItem a
|
|||||||
, _siIsSelectable :: Bool
|
, _siIsSelectable :: Bool
|
||||||
, _siColor :: Color
|
, _siColor :: Color
|
||||||
, _siOffX :: Int
|
, _siOffX :: Int
|
||||||
|
, _siOffY :: Int
|
||||||
, _siPayload :: a
|
, _siPayload :: a
|
||||||
}
|
}
|
||||||
| SelectionInfo
|
| SelectionInfo
|
||||||
@@ -86,6 +87,7 @@ data SelectionItem a
|
|||||||
, _siIsSelectable :: Bool
|
, _siIsSelectable :: Bool
|
||||||
, _siColor :: Color
|
, _siColor :: Color
|
||||||
, _siOffX :: Int
|
, _siOffX :: Int
|
||||||
|
, _siOffY :: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
makeLenses ''ListDisplayParams
|
makeLenses ''ListDisplayParams
|
||||||
|
|||||||
@@ -1,18 +1,23 @@
|
|||||||
module Dodge.Default.Item.Use.Consumption where
|
module Dodge.Default.Item.Use.Consumption where
|
||||||
|
|
||||||
|
import Control.Lens
|
||||||
|
import Dodge.Data.Item.Use.Consumption
|
||||||
import Dodge.Item.Weapon.Bullet
|
import Dodge.Item.Weapon.Bullet
|
||||||
import Dodge.Reloading.Action
|
import Dodge.Reloading.Action
|
||||||
import Dodge.Data.Item.Use.Consumption
|
|
||||||
import Control.Lens
|
|
||||||
|
|
||||||
defaultLoadable :: HeldConsumption
|
defaultLoadable :: HeldConsumption
|
||||||
defaultLoadable =
|
defaultLoadable =
|
||||||
LoadableAmmo
|
LoadableAmmo
|
||||||
{ _laAmmoType = GenericAmmo
|
{ _laAmmoType = GenericAmmo
|
||||||
, _laMax = 15
|
, _laSource =
|
||||||
, _laLoaded = 0
|
InternalSource InternalAmmo
|
||||||
, _laPrimed = True
|
{ _iaMax = 15
|
||||||
, _laCycle = [loadEject 10, loadInsert 10, loadPrime 10]
|
, _iaLoaded = 0
|
||||||
, _laProgress = Nothing
|
, _iaPrimed = True
|
||||||
|
, _iaCycle = [loadEject 10, loadInsert 10, loadPrime 10]
|
||||||
|
, _iaProgress = Nothing
|
||||||
|
}
|
||||||
|
, _laSourceType = BulletSource
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultBulletLoadable :: HeldConsumption
|
defaultBulletLoadable :: HeldConsumption
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{-# LANGUAGE TupleSections #-}
|
--{-# LANGUAGE TupleSections #-}
|
||||||
|
|
||||||
--{-# OPTIONS_GHC -fno-full-laziness #-}
|
--{-# OPTIONS_GHC -fno-full-laziness #-}
|
||||||
|
|
||||||
@@ -53,14 +53,14 @@ updateCombineSections w cfig sss =
|
|||||||
invitms <- w ^? hud . hudElement . diSections . sssSections . ix 0 . ssItems
|
invitms <- w ^? hud . hudElement . diSections . sssSections . ix 0 . ssItems
|
||||||
return $ IM.filter (flip (andOrRegex $ regexCombs invitms) str) allcombs
|
return $ IM.filter (flip (andOrRegex $ regexCombs invitms) str) allcombs
|
||||||
showncombs
|
showncombs
|
||||||
| null filtcombs = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0
|
| null filtcombs = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0 0
|
||||||
| otherwise = filtcombs
|
| otherwise = filtcombs
|
||||||
filtinv = fromMaybe mempty $ do
|
filtinv = fromMaybe mempty $ do
|
||||||
str <- mstr
|
str <- mstr
|
||||||
return $
|
return $
|
||||||
IM.singleton
|
IM.singleton
|
||||||
0
|
0
|
||||||
(SelectionInfo ["COMBINATIONS FILTER: " ++ str, numfiltitems] 2 True white 0)
|
(SelectionInfo ["COMBINATIONS FILTER: " ++ str, numfiltitems] 2 True white 0 0)
|
||||||
mstr = w ^? hud . hudElement . subInventory . ciSections . sssExtra . sssFilters . ix (-1) . _Just
|
mstr = w ^? hud . hudElement . subInventory . ciSections . sssExtra . sssFilters . ix (-1) . _Just
|
||||||
numfiltitems = " " ++ show (length allcombs - length filtcombs) ++ " FILTERED"
|
numfiltitems = " " ++ show (length allcombs - length filtcombs) ++ " FILTERED"
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ updateDisplaySections w cfig sss =
|
|||||||
(filtinv, invx) = filtpair (-1) invitems' "INV. "
|
(filtinv, invx) = filtpair (-1) invitems' "INV. "
|
||||||
(filtclose, closex) = filtpair 2 coitems' "NEARBY "
|
(filtclose, closex) = filtpair 2 coitems' "NEARBY "
|
||||||
youx = (1, youitems)
|
youx = (1, youitems)
|
||||||
youitems = IM.singleton 0 $ SelectionItem [thetext] 1 True invDimColor 2 ()
|
youitems = IM.singleton 0 $ SelectionItem [thetext] 1 True invDimColor 2 0 ()
|
||||||
thetext = displayFreeSlots nfreeslots
|
thetext = displayFreeSlots nfreeslots
|
||||||
availablelines = getAvailableListLines (invDisplayParams w) cfig
|
availablelines = getAvailableListLines (invDisplayParams w) cfig
|
||||||
coitems' =
|
coitems' =
|
||||||
@@ -126,7 +126,7 @@ updateDisplaySections w cfig sss =
|
|||||||
return $
|
return $
|
||||||
IM.singleton
|
IM.singleton
|
||||||
0
|
0
|
||||||
(SelectionInfo [filtdescription ++ "FILTER: " ++ str, numfiltitems] 2 True white 0)
|
(SelectionInfo [filtdescription ++ "FILTER: " ++ str, numfiltitems] 2 True white 0 0)
|
||||||
itms' = fromMaybe itms $ do
|
itms' = fromMaybe itms $ do
|
||||||
str <- mstr
|
str <- mstr
|
||||||
return $ IM.filter (plainRegex str) itms
|
return $ IM.filter (plainRegex str) itms
|
||||||
@@ -195,7 +195,7 @@ updateSection sis mcsel availablelines ss =
|
|||||||
scurs = do
|
scurs = do
|
||||||
csel <- mcsel
|
csel <- mcsel
|
||||||
(_, si) <- IM.lookupGE csel sis -- this is not right?
|
(_, si) <- IM.lookupGE csel sis -- this is not right?
|
||||||
let cpos = sum (fmap (length . _siPictures) . fst . IM.split csel $ sis)
|
let cpos = sum (fmap _siHeight . fst . IM.split csel $ sis)
|
||||||
csize = length $ _siPictures si
|
csize = length $ _siPictures si
|
||||||
ccolor = _siColor si
|
ccolor = _siColor si
|
||||||
return $ SectionCursor (cpos - offset) csize ccolor
|
return $ SectionCursor (cpos - offset) csize ccolor
|
||||||
@@ -240,13 +240,26 @@ updateSection sis mcsel availablelines ss =
|
|||||||
++ [translate 0 100 . color moredowncolor . textVMirror $ theindent ++ replicate 15 '^']
|
++ [translate 0 100 . color moredowncolor . textVMirror $ theindent ++ replicate 15 '^']
|
||||||
| otherwise = tweakfirst shownstrings
|
| otherwise = tweakfirst shownstrings
|
||||||
moredowncolor = fromMaybe white $ allstrings ^? ix (offset + availablelines - 1) . _1
|
moredowncolor = fromMaybe white $ allstrings ^? ix (offset + availablelines - 1) . _1
|
||||||
allstrings :: [(Color, String)]
|
allstrings :: [(Color, Picture)]
|
||||||
allstrings = foldMap g sis
|
allstrings = IM.elems $ overlapSelectionItems $ IM.elems sis
|
||||||
shownstrings = drop offset allstrings
|
shownstrings = drop offset allstrings
|
||||||
h (col, str) = color col . text $ theindent ++ str
|
h (_, str) = translate (fromIntegral (_ssIndent ss) * 100) 0 str
|
||||||
theindent = replicate (_ssIndent ss) ' '
|
theindent = replicate (_ssIndent ss) ' '
|
||||||
--xtra str = color white . text $ theindent ++ str ++ " MORE " ++ _ssDescriptor ss
|
--xtra str = color white . text $ theindent ++ str ++ " MORE " ++ _ssDescriptor ss
|
||||||
g si = map (_siColor si,) $ _siPictures si
|
|
||||||
|
overlapSelectionItems :: [SelectionItem a] -> IM.IntMap (Color, Picture)
|
||||||
|
overlapSelectionItems = go 0
|
||||||
|
where
|
||||||
|
go _ [] = mempty
|
||||||
|
go i (si : xs) = doinsert $ go (i + _siHeight si) xs
|
||||||
|
where
|
||||||
|
thecol = _siColor si
|
||||||
|
doinsert m =
|
||||||
|
ifoldr
|
||||||
|
(\j str -> IM.insertWith ihelp (i + j + _siOffY si) (thecol,color thecol (text str)))
|
||||||
|
m
|
||||||
|
(_siPictures si)
|
||||||
|
ihelp (_,x) (col,y) = ( col, x<>y)
|
||||||
|
|
||||||
enterCombineInv :: Configuration -> World -> World
|
enterCombineInv :: Configuration -> World -> World
|
||||||
enterCombineInv cfig w =
|
enterCombineInv cfig w =
|
||||||
@@ -257,7 +270,7 @@ enterCombineInv cfig w =
|
|||||||
where
|
where
|
||||||
cm' = IM.fromAscList $ zip [0 ..] $ combineList' w
|
cm' = IM.fromAscList $ zip [0 ..] $ combineList' w
|
||||||
cm
|
cm
|
||||||
| null cm' = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0
|
| null cm' = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0 0
|
||||||
| otherwise = cm'
|
| otherwise = cm'
|
||||||
sss =
|
sss =
|
||||||
SelectionSections
|
SelectionSections
|
||||||
@@ -274,7 +287,7 @@ enterCombineInv cfig w =
|
|||||||
availablelines = getAvailableListLines secondColumnParams cfig
|
availablelines = getAvailableListLines secondColumnParams cfig
|
||||||
filtsection =
|
filtsection =
|
||||||
SelectionSection
|
SelectionSection
|
||||||
{ _ssItems = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0
|
{ _ssItems = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0 0
|
||||||
, _ssCursor = Nothing
|
, _ssCursor = Nothing
|
||||||
, _ssMinSize = 0
|
, _ssMinSize = 0
|
||||||
, _ssOffset = 0
|
, _ssOffset = 0
|
||||||
@@ -288,7 +301,7 @@ enterCombineInv cfig w =
|
|||||||
{ _ssItems = cm
|
{ _ssItems = cm
|
||||||
, _ssCursor = do
|
, _ssCursor = do
|
||||||
(_, si) <- IM.lookupMin cm
|
(_, si) <- IM.lookupMin cm
|
||||||
return $ SectionCursor 0 (length (_siPictures si)) (_siColor si)
|
return $ SectionCursor 0 (_siHeight si) (_siColor si)
|
||||||
, _ssMinSize = 5
|
, _ssMinSize = 5
|
||||||
, _ssOffset = 0
|
, _ssOffset = 0
|
||||||
, _ssShownItems = mempty
|
, _ssShownItems = mempty
|
||||||
|
|||||||
+11
-3
@@ -33,6 +33,14 @@ useE eo = case eo of
|
|||||||
EoffWristShield -> onRemoveWristShield
|
EoffWristShield -> onRemoveWristShield
|
||||||
EFuelSource 0 _ -> const . const id
|
EFuelSource 0 _ -> const . const id
|
||||||
EFuelSource{} -> trySiphonFuel
|
EFuelSource{} -> trySiphonFuel
|
||||||
|
EBatterySource{} -> tryChargeBattery
|
||||||
|
EAmmoSource{} -> tryAttachBulletBelt
|
||||||
|
|
||||||
|
tryAttachBulletBelt :: Item -> Creature -> World -> World
|
||||||
|
tryAttachBulletBelt _ _ w = w
|
||||||
|
|
||||||
|
tryChargeBattery :: Item -> Creature -> World -> World
|
||||||
|
tryChargeBattery _ _ w = w
|
||||||
|
|
||||||
trySiphonFuel :: Item -> Creature -> World -> World
|
trySiphonFuel :: Item -> Creature -> World -> World
|
||||||
trySiphonFuel itm cr w = fromMaybe w $ do
|
trySiphonFuel itm cr w = fromMaybe w $ do
|
||||||
@@ -42,12 +50,12 @@ trySiphonFuel itm cr w = fromMaybe w $ do
|
|||||||
la <- cr ^? crInv . ix hix . itUse . heldConsumption
|
la <- cr ^? crInv . ix hix . itUse . heldConsumption
|
||||||
atype <- la ^? laAmmoType
|
atype <- la ^? laAmmoType
|
||||||
guard (isGas atype)
|
guard (isGas atype)
|
||||||
amax <- la ^? laMax
|
amax <- la ^? laSource . _InternalSource . iaMax
|
||||||
acur <- la ^? laLoaded
|
acur <- la ^? laSource . _InternalSource . iaLoaded
|
||||||
guard (amax > acur)
|
guard (amax > acur)
|
||||||
return $
|
return $
|
||||||
w & cWorld . lWorld . creatures . ix (_crID cr) . crInv
|
w & cWorld . lWorld . creatures . ix (_crID cr) . crInv
|
||||||
%~ ( (ix hix . itUse . heldConsumption . laLoaded +~ 1)
|
%~ ( (ix hix . itUse . heldConsumption . laSource . _InternalSource . iaLoaded +~ 1)
|
||||||
. (ix eix . itUse . equipEffect . eeUse . euseFuelAmount -~ 1)
|
. (ix eix . itUse . equipEffect . eeUse . euseFuelAmount -~ 1)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+26
-18
@@ -62,7 +62,7 @@ useMod hm = case hm of
|
|||||||
, withSoundStart tap4S
|
, withSoundStart tap4S
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoCheckI
|
, ammoCheckI
|
||||||
, hammerCheckI
|
, blCheck
|
||||||
]
|
]
|
||||||
TeslaMod ->
|
TeslaMod ->
|
||||||
[ useAmmoAmount 1
|
[ useAmmoAmount 1
|
||||||
@@ -109,20 +109,22 @@ useMod hm = case hm of
|
|||||||
, withSoundStart tap4S
|
, withSoundStart tap4S
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoCheckI
|
, ammoCheckI
|
||||||
, hammerCheckI
|
, blCheck
|
||||||
]
|
]
|
||||||
ShatterMod ->
|
ShatterMod ->
|
||||||
[ useAmmoAmount 1
|
[ useAmmoAmount 1
|
||||||
-- , withSoundStart tap3S
|
-- , withSoundStart tap3S
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
AmmoCheckMod -> [ammoCheckI]
|
AmmoCheckMod -> [ammoCheckI]
|
||||||
AmmoUseCheckMod -> [ammoUseCheck]
|
AmmoUseCheckMod -> [useAmmoAmount 1,useTimeCheck, ammoCheckI]
|
||||||
AmmoHammerTimeUseOneMod ->
|
AmmoHammerTimeUseOneMod ->
|
||||||
[ useAmmoAmount 1
|
[ useAmmoAmount 1
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
BangCaneMod ->
|
BangCaneMod ->
|
||||||
[ withMuzFlareI
|
[ withMuzFlareI
|
||||||
@@ -133,7 +135,8 @@ useMod hm = case hm of
|
|||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
VolleyGunMod ->
|
VolleyGunMod ->
|
||||||
[ withRecoil
|
[ withRecoil
|
||||||
@@ -144,7 +147,8 @@ useMod hm = case hm of
|
|||||||
, useAllAmmo
|
, useAllAmmo
|
||||||
, withSoundItemChoiceStart caneStickSoundChoice
|
, withSoundItemChoiceStart caneStickSoundChoice
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
AutoRifleMod ->
|
AutoRifleMod ->
|
||||||
-- note this is the same as BangCanemMod with the first changed
|
-- note this is the same as BangCanemMod with the first changed
|
||||||
@@ -167,7 +171,8 @@ useMod hm = case hm of
|
|||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, withSoundStart bangEchoS
|
, withSoundStart bangEchoS
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
ElephantGunMod ->
|
ElephantGunMod ->
|
||||||
[ withRecoil
|
[ withRecoil
|
||||||
@@ -178,7 +183,8 @@ useMod hm = case hm of
|
|||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, withSoundStart bangEchoS
|
, withSoundStart bangEchoS
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
AutoAmrMod ->
|
AutoAmrMod ->
|
||||||
[ withRecoil
|
[ withRecoil
|
||||||
@@ -209,7 +215,8 @@ useMod hm = case hm of
|
|||||||
, useAllAmmo
|
, useAllAmmo
|
||||||
, withSoundItemChoiceStart bangStickSoundChoice
|
, withSoundItemChoiceStart bangStickSoundChoice
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
PistolMod ->
|
PistolMod ->
|
||||||
[ withMuzFlareI
|
[ withMuzFlareI
|
||||||
@@ -220,7 +227,8 @@ useMod hm = case hm of
|
|||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
AutoPistolMod ->
|
AutoPistolMod ->
|
||||||
[ withMuzFlareI
|
[ withMuzFlareI
|
||||||
@@ -254,7 +262,8 @@ useMod hm = case hm of
|
|||||||
, lockInvFor 7
|
, lockInvFor 7
|
||||||
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
|
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
BurstRifleRepeatMod ->
|
BurstRifleRepeatMod ->
|
||||||
[ withRecoil
|
[ withRecoil
|
||||||
@@ -305,7 +314,8 @@ useMod hm = case hm of
|
|||||||
-- rather than locking the inventory, a better solution may be to check
|
-- rather than locking the inventory, a better solution may be to check
|
||||||
-- that the weapon is still in your hands in the repeated frames
|
-- that the weapon is still in your hands in the repeated frames
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
RevolverXRepeatMod ->
|
RevolverXRepeatMod ->
|
||||||
[ withRecoil
|
[ withRecoil
|
||||||
@@ -328,8 +338,8 @@ useMod hm = case hm of
|
|||||||
, useAllAmmo
|
, useAllAmmo
|
||||||
, withSoundStart bangEchoS
|
, withSoundStart bangEchoS
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, hammerCheckI
|
|
||||||
, ammoCheckI
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
f = do
|
f = do
|
||||||
@@ -465,13 +475,11 @@ fireRemoteShell it cr w =
|
|||||||
|
|
||||||
caneStickSoundChoice :: Item -> SoundID
|
caneStickSoundChoice :: Item -> SoundID
|
||||||
caneStickSoundChoice it
|
caneStickSoundChoice it
|
||||||
| _laLoaded (_heldConsumption (_itUse it)) < 2 = tap3S
|
| (it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded) < 2 = tap3S
|
||||||
| otherwise = shotgunS
|
| otherwise = shotgunS
|
||||||
|
|
||||||
bangStickSoundChoice :: Item -> SoundID
|
bangStickSoundChoice :: Item -> SoundID
|
||||||
bangStickSoundChoice it
|
bangStickSoundChoice = caneStickSoundChoice
|
||||||
| _laLoaded (_heldConsumption (_itUse it)) < 2 = tap3S
|
|
||||||
| otherwise = shotgunS
|
|
||||||
|
|
||||||
coneRandItemUpdate :: State StdGen (Item -> Item)
|
coneRandItemUpdate :: State StdGen (Item -> Item)
|
||||||
coneRandItemUpdate = do
|
coneRandItemUpdate = do
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ module Dodge.Inventory.SelectionList (
|
|||||||
closeObjectToSelectionItem,
|
closeObjectToSelectionItem,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Padding
|
||||||
import Dodge.Equipment.Text
|
import Dodge.Equipment.Text
|
||||||
import Dodge.Data.SelectionList
|
import Dodge.Data.SelectionList
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
@@ -15,20 +16,21 @@ invSelectionItem :: Creature -> Int -> Item -> SelectionItem ()
|
|||||||
invSelectionItem cr i it =
|
invSelectionItem cr i it =
|
||||||
SelectionItem
|
SelectionItem
|
||||||
{ _siPictures = pics & ix 0 %~ (++ anyequippos ++ anyhotkey)
|
{ _siPictures = pics & ix 0 %~ (++ anyequippos ++ anyhotkey)
|
||||||
, _siHeight = length pics
|
, _siHeight = itSlotsTaken it
|
||||||
, _siIsSelectable = True
|
, _siIsSelectable = True
|
||||||
, _siColor = col
|
, _siColor = col
|
||||||
, _siOffX = 0
|
, _siOffX = 0
|
||||||
|
, _siOffY = 0
|
||||||
, _siPayload = ()
|
, _siPayload = ()
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
anyhotkey = maybe [] ((' ':) .hotkeyToString) (cr ^? crInvHotkeys . ix i)
|
anyhotkey = maybe [] ((' ':) .hotkeyToString) (cr ^? crInvHotkeys . ix i)
|
||||||
anyequippos = maybe [] ((' ':) . eqPosText) (cr ^? crInvEquipped . ix i)
|
anyequippos = maybe [] (rightPad 8 ' ' . (' ':) . eqPosText) (cr ^? crInvEquipped . ix i)
|
||||||
col = _itInvColor it
|
col = _itInvColor it
|
||||||
pics = take (itSlotsTaken it) . (++ replicate 10 "*") $ case _itCurseStatus it of
|
pics = case _itCurseStatus it of
|
||||||
UndroppableIdentified -> itemDisplay it
|
UndroppableIdentified -> itemDisplay cr it
|
||||||
_ | cr ^? crManipulation . manObject . inInventory . ispItem == Just i -> selectedItemDisplay cr it
|
-- _ | cr ^? crManipulation . manObject . inInventory . ispItem == Just i -> selectedItemDisplay cr it
|
||||||
_ -> itemDisplay it
|
_ -> itemDisplay cr it
|
||||||
|
|
||||||
hotkeyToString :: Hotkey -> String
|
hotkeyToString :: Hotkey -> String
|
||||||
hotkeyToString x = case x of
|
hotkeyToString x = case x of
|
||||||
@@ -54,6 +56,7 @@ closeObjectToSelectionItem e =
|
|||||||
, --, _siWidth = 15
|
, --, _siWidth = 15
|
||||||
_siColor = col
|
_siColor = col
|
||||||
, _siOffX = 2
|
, _siOffX = 2
|
||||||
|
, _siOffY = 0
|
||||||
, _siPayload = ()
|
, _siPayload = ()
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
@@ -62,5 +65,5 @@ closeObjectToSelectionItem e =
|
|||||||
--
|
--
|
||||||
closeObjectToTextPictures :: Either FloorItem Button -> ([String], Color)
|
closeObjectToTextPictures :: Either FloorItem Button -> ([String], Color)
|
||||||
closeObjectToTextPictures e = case e of
|
closeObjectToTextPictures e = case e of
|
||||||
Left flit -> let it = _flIt flit in (itemDisplay it, _itInvColor it)
|
Left flit -> let it = _flIt flit in (basicItemDisplay it, _itInvColor it)
|
||||||
Right bt -> ([_btText bt], yellow)
|
Right bt -> ([_btText bt], yellow)
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ itemFromEquipType et = case et of
|
|||||||
JETPACK -> jetPack
|
JETPACK -> jetPack
|
||||||
BATTERYPACK -> batteryPack
|
BATTERYPACK -> batteryPack
|
||||||
FUELPACK -> fuelPack
|
FUELPACK -> fuelPack
|
||||||
|
BULLETBELTPACK -> bulletBeltPack
|
||||||
|
BULLETBELTBRACER -> bulletBeltBracer
|
||||||
AUTODETECTOR d -> autoDetector d
|
AUTODETECTOR d -> autoDetector d
|
||||||
|
|
||||||
itemFromLeftType :: LeftItemType -> Item
|
itemFromLeftType :: LeftItemType -> Item
|
||||||
|
|||||||
+86
-59
@@ -1,40 +1,48 @@
|
|||||||
module Dodge.Item.Display (
|
module Dodge.Item.Display (
|
||||||
itemDisplay,
|
itemDisplay,
|
||||||
selectedItemDisplay,
|
-- selectedItemDisplay,
|
||||||
itemString,
|
itemString,
|
||||||
itemBaseName,
|
itemBaseName,
|
||||||
|
basicItemDisplay,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Control.Applicative
|
||||||
|
import Control.Monad
|
||||||
|
import Dodge.Item.Info
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.Sequence
|
|
||||||
import Dodge.Data.Creature
|
import Dodge.Data.Creature
|
||||||
import Dodge.Item.SlotsTaken
|
import Dodge.Item.SlotsTaken
|
||||||
import Dodge.Module
|
import Dodge.Module
|
||||||
import LensHelp
|
import LensHelp
|
||||||
import Padding
|
import Padding
|
||||||
|
|
||||||
itemDisplay :: Item -> [String]
|
itemDisplay :: Creature -> Item -> [String]
|
||||||
itemDisplay it = itemDisplayWithNumber (showConsumption (_itUse it)) it
|
itemDisplay cr itm = --itemDisplayWithNumber (showConsumption cr it) it
|
||||||
|
zipWithDefaults id (leftPad 15 ' ') itemDisplayPad (basicItemDisplay itm) (itemNumberDisplay cr itm)
|
||||||
|
|
||||||
itemDisplayWithNumber :: String -> Item -> [String]
|
zipWithDefaults :: (a -> c) -> (b -> c) -> (a -> b -> c) -> [a] -> [b] -> [c]
|
||||||
itemDisplayWithNumber numberstr it =
|
zipWithDefaults f g h = go
|
||||||
Prelude.take (itSlotsTaken it) $
|
|
||||||
(midPadL 15 ' ' thename (' ' : numberstr) ++ theparam) :
|
|
||||||
catMaybes [maybeWarmupStatus it, maybeRateStatus it]
|
|
||||||
++ moduleStrings it
|
|
||||||
++ repeat "\\"
|
|
||||||
where
|
where
|
||||||
thename = itemBaseName it
|
go [] bs = map g bs
|
||||||
theparam =
|
go as [] = map f as
|
||||||
fromMaybe []
|
go (a:as) (b:bs) = h a b : go as bs
|
||||||
. listToMaybe
|
|
||||||
$ mapMaybe
|
|
||||||
($ it)
|
itemDisplayPad :: [Char] -> String -> [Char]
|
||||||
[ maybeModeStatus
|
itemDisplayPad ls rs
|
||||||
]
|
| rs == "" = ls
|
||||||
|
| otherwise = midPadL 15 ' ' ls (' ':rs)
|
||||||
|
|
||||||
|
basicItemDisplay :: Item -> [String]
|
||||||
|
basicItemDisplay itm =
|
||||||
|
Prelude.take (itSlotsTaken itm) $
|
||||||
|
itemBaseName itm :
|
||||||
|
catMaybes [maybeWarmupStatus itm, maybeRateStatus itm]
|
||||||
|
++ moduleStrings itm
|
||||||
|
++ repeat "*"
|
||||||
|
|
||||||
itemString :: Item -> String
|
itemString :: Item -> String
|
||||||
itemString = head . itemDisplay
|
itemString = head . basicItemDisplay
|
||||||
|
|
||||||
itemBaseName :: Item -> String
|
itemBaseName :: Item -> String
|
||||||
itemBaseName it = case _iyBase $ _itType it of
|
itemBaseName it = case _iyBase $ _itType it of
|
||||||
@@ -47,17 +55,6 @@ itemBaseName it = case _iyBase $ _itType it of
|
|||||||
EQUIP eit -> show eit
|
EQUIP eit -> show eit
|
||||||
Consumable cit -> show cit
|
Consumable cit -> show cit
|
||||||
|
|
||||||
selectedItemDisplay :: Creature -> Item -> [String]
|
|
||||||
selectedItemDisplay cr it = itemDisplayWithNumber (showSelectedConsumption cr (_itUse it)) it
|
|
||||||
|
|
||||||
-- | Displays the item name, ammo if loaded, and any selected '_itCharMode'.
|
|
||||||
showSelectedConsumption :: Creature -> ItemUse -> String
|
|
||||||
showSelectedConsumption cr iu = case iu of
|
|
||||||
HeldUse{} -> showReloadProgress cr (_heldConsumption iu)
|
|
||||||
LeftUse{} -> showAutoRechargeProgress (_leftConsumption iu)
|
|
||||||
EquipUse{} -> ""
|
|
||||||
_ -> show $ iu ^?! useAmount . getItAmount -- partial, be careful if adding new data constructors
|
|
||||||
|
|
||||||
showAutoRechargeProgress :: LeftConsumption -> String
|
showAutoRechargeProgress :: LeftConsumption -> String
|
||||||
showAutoRechargeProgress lc = case lc of
|
showAutoRechargeProgress lc = case lc of
|
||||||
AutoRecharging{}
|
AutoRecharging{}
|
||||||
@@ -65,36 +62,71 @@ showAutoRechargeProgress lc = case lc of
|
|||||||
| otherwise -> show (_arLoaded lc)
|
| otherwise -> show (_arLoaded lc)
|
||||||
ChargeableAmmo{} -> show (_wpCharge lc)
|
ChargeableAmmo{} -> show (_wpCharge lc)
|
||||||
|
|
||||||
showReloadProgress :: Creature -> HeldConsumption -> String
|
--showReloadProgress :: Creature -> Item -> String
|
||||||
showReloadProgress cr ic = case cr ^? crManipulation . manObject . inInventory . iselAction of
|
--showReloadProgress cr itm = case cr ^? crManipulation . manObject . inInventory . iselAction of
|
||||||
Just (ReloadAction i la) -> show i ++ showLoadActionType la (_laLoaded ic)
|
-- Just (ReloadAction i la) -> show i ++ showLoadActionType la ic
|
||||||
_ -> case ic ^? laProgress . _Just . ix 0 of
|
-- _ -> case ic of
|
||||||
Nothing -> show $ _laLoaded ic
|
-- InternalSource ia -> case ia ^? iaProgress . _Just . ix 0 of
|
||||||
Just la -> show (_actionTime la) ++ showLoadActionType la (_laLoaded ic)
|
-- Nothing -> show $ ia ^. iaLoaded
|
||||||
|
-- Just la -> show (_actionTime la) ++ showLoadActionType la ic
|
||||||
|
-- AboveSource -> fromMaybe "XXXX" $ do
|
||||||
|
-- i <- fmap (subtract 1) $ itm ^? itLocation . ipInvID
|
||||||
|
-- x <- cr ^? crInv . ix i . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||||
|
-- return $ showIntKMG' x
|
||||||
|
-- where
|
||||||
|
-- ic = (itm ^?! itUse . heldConsumption . laSource)
|
||||||
|
|
||||||
showConsumption :: ItemUse -> String
|
itemNumberDisplay :: Creature -> Item -> [String]
|
||||||
showConsumption iu = case iu of
|
itemNumberDisplay cr itm = case iu of
|
||||||
HeldUse{} -> showReloadProgress' (_heldConsumption iu)
|
HeldUse{} -> [showReloadProgress cr itm]
|
||||||
LeftUse{} -> showAutoRechargeProgress (_leftConsumption iu)
|
LeftUse{} -> [showAutoRechargeProgress (_leftConsumption iu)]
|
||||||
EquipUse {_equipEffect = ee} -> showEUseNumber ee
|
EquipUse{} -> showEquipmentNumber cr itm
|
||||||
_ -> show $ iu ^?! useAmount . getItAmount
|
_ -> [show $ iu ^?! useAmount . getItAmount]
|
||||||
|
where
|
||||||
|
iu = itm ^?! itUse
|
||||||
|
|
||||||
showEUseNumber :: EquipEffect -> String
|
showEquipmentNumber :: Creature -> Item -> [String]
|
||||||
showEUseNumber ee = case _eeUse ee of
|
showEquipmentNumber cr itm = case _eeUse ee of
|
||||||
EFuelSource x _ -> show x
|
EFuelSource x _ -> [show x]
|
||||||
|
EAmmoSource {} -> showAmmoSource cr itm
|
||||||
|
EBatterySource {_euseBatteryAmount = x} -> [show x]
|
||||||
|
_ -> [""]
|
||||||
|
where
|
||||||
|
ee = itm ^?! itUse . equipEffect
|
||||||
|
|
||||||
|
showAmmoSource :: Creature -> Item -> [String]
|
||||||
|
showAmmoSource cr itm = fromMaybe ["FAIL"] $ do
|
||||||
|
eu <- itm ^? itUse . equipEffect . eeUse
|
||||||
|
atype <- eu ^? euseAmmoSourceType
|
||||||
|
x <- fmap showIntKMG' $ eu ^? euseAmmoAmount
|
||||||
|
i <- itm ^? itLocation . ipInvID
|
||||||
|
(do
|
||||||
|
at' <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSourceType
|
||||||
|
as <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSource
|
||||||
|
guard (at' == atype && as == AboveSource)
|
||||||
|
return ["vvvv",x] ) <|> Just [x]
|
||||||
|
|
||||||
|
showReloadProgress :: Creature -> Item -> String
|
||||||
|
showReloadProgress cr itm = case ic ^? laSource of
|
||||||
|
Just (InternalSource ia) -> case ia ^? iaProgress . _Just . ix 0 of
|
||||||
|
Nothing -> maybe "" show $ ic ^? laSource . _InternalSource . iaLoaded
|
||||||
|
Just la -> showLoadActionType la (_laSource ic)
|
||||||
|
Just AboveSource -> fromMaybe "||||" $ do
|
||||||
|
i <- fmap (subtract 1) $ itm ^? itLocation . ipInvID
|
||||||
|
_ <- cr ^? crInv . ix i . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||||
|
return ""
|
||||||
_ -> ""
|
_ -> ""
|
||||||
|
where
|
||||||
|
ic = itm ^?! itUse . heldConsumption
|
||||||
|
|
||||||
showReloadProgress' :: HeldConsumption -> String
|
showLoadActionType :: LoadAction -> AmmoSource -> String
|
||||||
showReloadProgress' ic = case ic ^? laProgress . _Just . ix 0 of
|
showLoadActionType la as = case la of
|
||||||
Nothing -> show $ _laLoaded ic
|
|
||||||
Just la -> show (_actionTime la) ++ showLoadActionType la (_laLoaded ic)
|
|
||||||
|
|
||||||
showLoadActionType :: LoadAction -> Int -> String
|
|
||||||
showLoadActionType la x = case la of
|
|
||||||
LoadEject{} -> "E"
|
LoadEject{} -> "E"
|
||||||
LoadInsert{} -> "L"
|
LoadInsert{} -> "L"
|
||||||
LoadAdd{} -> "A" ++ show x
|
LoadAdd{} -> "A" ++ x
|
||||||
LoadPrime{} -> "P"
|
LoadPrime{} -> "P"
|
||||||
|
where
|
||||||
|
x = maybe "" show $ as ^? _InternalSource . iaLoaded
|
||||||
|
|
||||||
maybeWarmupStatus :: Item -> Maybe String
|
maybeWarmupStatus :: Item -> Maybe String
|
||||||
maybeWarmupStatus it = case it ^? itUse . heldDelay . warmMax of
|
maybeWarmupStatus it = case it ^? itUse . heldDelay . warmMax of
|
||||||
@@ -106,11 +138,6 @@ maybeWarmupStatus it = case it ^? itUse . heldDelay . warmMax of
|
|||||||
let n = show x
|
let n = show x
|
||||||
in Just $ Prelude.take (5 - Prelude.length n) "*WARM" ++ n
|
in Just $ Prelude.take (5 - Prelude.length n) "*WARM" ++ n
|
||||||
|
|
||||||
maybeModeStatus :: Item -> Maybe String
|
|
||||||
maybeModeStatus it = case it ^? itUse . heldScroll of
|
|
||||||
Just HeldScrollCharMode{_hsCharMode = (c :<| _)} -> Just [' ', c]
|
|
||||||
_ -> Nothing
|
|
||||||
|
|
||||||
maybeRateStatus :: Item -> Maybe String
|
maybeRateStatus :: Item -> Maybe String
|
||||||
maybeRateStatus it = case it ^? itUse . heldDelay . rateMaxMax of
|
maybeRateStatus it = case it ^? itUse . heldDelay . rateMaxMax of
|
||||||
Nothing -> Nothing
|
Nothing -> Nothing
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ equipItemSPic et _ = case et of
|
|||||||
BATTERYPACK -> noPic $ colorSH blue backpackShape
|
BATTERYPACK -> noPic $ colorSH blue backpackShape
|
||||||
FUELPACK ->
|
FUELPACK ->
|
||||||
noPic $ colorSH yellow $ upperPrismPolyMT 10 $ polyCirc 3 5
|
noPic $ colorSH yellow $ upperPrismPolyMT 10 $ polyCirc 3 5
|
||||||
|
BULLETBELTPACK ->
|
||||||
|
noPic $ colorSH green backpackShape
|
||||||
|
BULLETBELTBRACER
|
||||||
|
-> noPic (colorSH green $ upperPrismPolySU 3 $ rectWH 2 2)
|
||||||
AUTODETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPolySU 3 $ rectWH 2 2)
|
AUTODETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPolySU 3 $ rectWH 2 2)
|
||||||
|
|
||||||
backpackShape :: Shape
|
backpackShape :: Shape
|
||||||
@@ -249,7 +253,7 @@ baseRifleShape = colorSH red $ xCylinderST 3 25
|
|||||||
|
|
||||||
addBullets :: Item -> Shape
|
addBullets :: Item -> Shape
|
||||||
addBullets itm = fromMaybe mempty $ do
|
addBullets itm = fromMaybe mempty $ do
|
||||||
x <- itm ^? itUse . heldConsumption . laLoaded
|
x <- itm ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||||
hit <- itm ^? itType . iyBase . ibtHeld
|
hit <- itm ^? itType . iyBase . ibtHeld
|
||||||
ps <- fmap (take x) $ ammoPosition itm hit ^? amPosDirs
|
ps <- fmap (take x) $ ammoPosition itm hit ^? amPosDirs
|
||||||
return $ foldMap (uncurry (drawBullet itm)) ps
|
return $ foldMap (uncurry (drawBullet itm)) ps
|
||||||
@@ -315,7 +319,7 @@ makeTinClip it =
|
|||||||
bulletEffectColor
|
bulletEffectColor
|
||||||
(it ^? itUse . heldConsumption . laAmmoType . amBullet . buEffect)
|
(it ^? itUse . heldConsumption . laAmmoType . amBullet . buEffect)
|
||||||
y = fromIntegral y' * 0.3
|
y = fromIntegral y' * 0.3
|
||||||
y' = fromMaybe 0 $ it ^? itUse . heldConsumption . laLoaded
|
y' = fromMaybe 0 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||||
tips = fromMaybe mempty $ do
|
tips = fromMaybe mempty $ do
|
||||||
ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buSpawn
|
ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buSpawn
|
||||||
return $
|
return $
|
||||||
@@ -370,13 +374,15 @@ volleyGunShape i =
|
|||||||
[0 .. i -1]
|
[0 .. i -1]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
-- to get this rotating should probably add extra state to the minigun
|
||||||
miniGunXPictItem :: Int -> Item -> SPic
|
miniGunXPictItem :: Int -> Item -> SPic
|
||||||
miniGunXPictItem i it = miniGunXPict i spin (_laLoaded $ _heldConsumption (_itUse it))
|
miniGunXPictItem i it = miniGunXPict i spin
|
||||||
where
|
where
|
||||||
spin = (-10) * _laLoaded (_heldConsumption (_itUse it)) + _warmTime (_heldDelay $ _itUse it)
|
spin = (-10) -- * _iaLoaded (_laSource (_heldConsumption (_itUse it)))
|
||||||
|
+ _warmTime (_heldDelay $ _itUse it)
|
||||||
|
|
||||||
miniGunXPict :: Int -> Int -> Int -> SPic
|
miniGunXPict :: Int -> Int -> SPic
|
||||||
miniGunXPict i spin _ =
|
miniGunXPict i spin =
|
||||||
( colorSH red (rotateSHx a barrels)
|
( colorSH red (rotateSHx a barrels)
|
||||||
<> baseRifleShape
|
<> baseRifleShape
|
||||||
, -- <> clip (-1) 0
|
, -- <> clip (-1) 0
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ module Dodge.Item.Equipment (
|
|||||||
jetPack,
|
jetPack,
|
||||||
fuelPack,
|
fuelPack,
|
||||||
batteryPack,
|
batteryPack,
|
||||||
|
bulletBeltPack,
|
||||||
|
bulletBeltBracer,
|
||||||
speedLegs,
|
speedLegs,
|
||||||
jumpLegs,
|
jumpLegs,
|
||||||
flameShield,
|
flameShield,
|
||||||
@@ -59,6 +61,7 @@ batteryPack =
|
|||||||
& itUse . equipEffect . eeSite .~ GoesOnBack
|
& itUse . equipEffect . eeSite .~ GoesOnBack
|
||||||
& itType . iyBase .~ EQUIP BATTERYPACK
|
& itType . iyBase .~ EQUIP BATTERYPACK
|
||||||
& itUse . equipEffect . eeAttachPos .~ V3 (-8) 0 10
|
& itUse . equipEffect . eeAttachPos .~ V3 (-8) 0 10
|
||||||
|
& itUse . equipEffect . eeUse .~ EBatterySource 10000 10000
|
||||||
|
|
||||||
fuelPack :: Item
|
fuelPack :: Item
|
||||||
fuelPack =
|
fuelPack =
|
||||||
@@ -68,6 +71,22 @@ fuelPack =
|
|||||||
& itUse . equipEffect . eeAttachPos .~ V3 (-9) 0 10
|
& itUse . equipEffect . eeAttachPos .~ V3 (-9) 0 10
|
||||||
& itUse . equipEffect . eeUse .~ EFuelSource 10000 10000
|
& itUse . equipEffect . eeUse .~ EFuelSource 10000 10000
|
||||||
|
|
||||||
|
bulletBeltPack :: Item
|
||||||
|
bulletBeltPack =
|
||||||
|
defaultEquipment
|
||||||
|
& itUse . equipEffect . eeSite .~ GoesOnBack
|
||||||
|
& itType . iyBase .~ EQUIP BULLETBELTPACK
|
||||||
|
& itUse . equipEffect . eeAttachPos .~ V3 (-9) 0 10
|
||||||
|
& itUse . equipEffect . eeUse .~ EAmmoSource 2000 2000 BulletSource Nothing
|
||||||
|
|
||||||
|
bulletBeltBracer :: Item
|
||||||
|
bulletBeltBracer =
|
||||||
|
defaultEquipment
|
||||||
|
& itUse . equipEffect . eeSite .~ GoesOnWrist
|
||||||
|
& itType . iyBase .~ EQUIP BULLETBELTBRACER
|
||||||
|
& itUse . equipEffect . eeAttachPos .~ V3 (-9) 0 10
|
||||||
|
& itUse . equipEffect . eeUse .~ EAmmoSource 100 100 BulletSource Nothing
|
||||||
|
|
||||||
jetPack :: Item
|
jetPack :: Item
|
||||||
jetPack =
|
jetPack =
|
||||||
defaultEquipment
|
defaultEquipment
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ sparkGun =
|
|||||||
teslaGun :: Item
|
teslaGun :: Item
|
||||||
teslaGun =
|
teslaGun =
|
||||||
defaultBatteryGun
|
defaultBatteryGun
|
||||||
& itUse . heldConsumption . laMax .~ 200
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 200
|
||||||
& itUse . heldConsumption . laCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
|
||||||
& itDimension . dimRad .~ 9
|
& itDimension . dimRad .~ 9
|
||||||
& itDimension . dimCenter .~ V3 4 0 0
|
& itDimension . dimCenter .~ V3 4 0 0
|
||||||
& itParams .~ teslaParams
|
& itParams .~ teslaParams
|
||||||
@@ -39,8 +39,8 @@ lasGun =
|
|||||||
defaultAutoBatteryGun
|
defaultAutoBatteryGun
|
||||||
& itUse . heldConsumption
|
& itUse . heldConsumption
|
||||||
.~ ( defaultLoadable
|
.~ ( defaultLoadable
|
||||||
& laMax .~ 200
|
& laSource . _InternalSource . iaMax .~ 200
|
||||||
& laCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
|
& laSource . _InternalSource . iaCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
|
||||||
)
|
)
|
||||||
& itParams
|
& itParams
|
||||||
.~ Refracting
|
.~ Refracting
|
||||||
@@ -79,8 +79,8 @@ tractorGun =
|
|||||||
lasGun
|
lasGun
|
||||||
& itUse . heldConsumption
|
& itUse . heldConsumption
|
||||||
.~ ( defaultLoadable
|
.~ ( defaultLoadable
|
||||||
& laMax .~ 10000
|
& laSource . _InternalSource . iaMax .~ 10000
|
||||||
& laCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
|
& laSource . _InternalSource . iaCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
|
||||||
)
|
)
|
||||||
& itParams .~ Attracting{_attractionPower = 1}
|
& itParams .~ Attracting{_attractionPower = 1}
|
||||||
& itTweaks
|
& itTweaks
|
||||||
@@ -136,7 +136,7 @@ lasCircle =
|
|||||||
& itType . iyBase .~ HELD LASCIRCLE
|
& itType . iyBase .~ HELD LASCIRCLE
|
||||||
& itParams . lasColor .~ orange
|
& itParams . lasColor .~ orange
|
||||||
& itParams . lasDamage .~ 2
|
& itParams . lasDamage .~ 2
|
||||||
& itUse . heldConsumption . laMax .~ 10000
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 10000
|
||||||
& itUse . heldUse .~ HeldLaser --shootLaser
|
& itUse . heldUse .~ HeldLaser --shootLaser
|
||||||
& itUse . heldDelay .~ NoDelay
|
& itUse . heldDelay .~ NoDelay
|
||||||
& itUse . heldUse .~ HeldCircleLaser --circleLaser
|
& itUse . heldUse .~ HeldCircleLaser --circleLaser
|
||||||
|
|||||||
+13
-12
@@ -36,8 +36,8 @@ defaultBangCane =
|
|||||||
& itUse . heldAim . aimStance .~ OneHand
|
& itUse . heldAim . aimStance .~ OneHand
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 15
|
& itUse . heldAim . aimMuzPos .~ 15
|
||||||
& itUse . heldConsumption . laMax .~ 1
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
|
||||||
& itUse . heldConsumption . laCycle .~ [loadPartialInsert 10 1]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
|
||||||
|
|
||||||
volleyGun :: Int -> Item
|
volleyGun :: Int -> Item
|
||||||
volleyGun i =
|
volleyGun i =
|
||||||
@@ -50,7 +50,7 @@ volleyGun i =
|
|||||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 15
|
& itUse . heldAim . aimMuzPos .~ 15
|
||||||
& itUse . heldConsumption . laMax .~ i
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
||||||
& itParams
|
& itParams
|
||||||
.~ BulletShooter
|
.~ BulletShooter
|
||||||
{ _muzVel = 0.8
|
{ _muzVel = 0.8
|
||||||
@@ -78,8 +78,8 @@ rifle =
|
|||||||
defaultBangCane
|
defaultBangCane
|
||||||
& itUse . heldAim . aimStance .~ TwoHandTwist
|
& itUse . heldAim . aimStance .~ TwoHandTwist
|
||||||
& itType . iyBase .~ HELD RIFLE
|
& itType . iyBase .~ HELD RIFLE
|
||||||
& itUse . heldConsumption . laMax .~ 1
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
|
||||||
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert 5, loadPrime 5]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 5, loadPrime 5]
|
||||||
& itUse . heldAim . aimWeight .~ 6
|
& itUse . heldAim . aimWeight .~ 6
|
||||||
& itUse . heldAim . aimRange .~ 1
|
& itUse . heldAim . aimRange .~ 1
|
||||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||||
@@ -90,8 +90,8 @@ repeater =
|
|||||||
rifle
|
rifle
|
||||||
& itType . iyModules . at ModRifleMag ?~ EMPTYMODULE
|
& itType . iyModules . at ModRifleMag ?~ EMPTYMODULE
|
||||||
& itType . iyBase .~ HELD REPEATER
|
& itType . iyBase .~ HELD REPEATER
|
||||||
& itUse . heldConsumption . laCycle .~ [loadEject 20, loadInsert 20, loadPrime 20]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 20, loadInsert 20, loadPrime 20]
|
||||||
& itUse . heldConsumption . laMax .~ 15
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 15
|
||||||
|
|
||||||
autoRifle :: Item
|
autoRifle :: Item
|
||||||
autoRifle =
|
autoRifle =
|
||||||
@@ -121,11 +121,12 @@ miniGunUse i =
|
|||||||
& heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
& heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||||
& heldAim . aimHandlePos .~ 5
|
& heldAim . aimHandlePos .~ 5
|
||||||
& heldConsumption
|
& heldConsumption
|
||||||
.~ defaultBulletLoadable
|
.~ (defaultBulletLoadable & laSource .~ AboveSource)
|
||||||
{ _laMax = 1500
|
--(defaultBulletLoadable
|
||||||
, _laLoaded = 1500
|
-- & laSource . iaMax .~ 1500
|
||||||
}
|
-- & laSource . iaLoaded .~ 1500
|
||||||
& heldConsumption . laCycle .~ [loadEject 40, loadInsert 40, loadPrime 40]
|
--)
|
||||||
|
& heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 40, loadInsert 40, loadPrime 40]
|
||||||
|
|
||||||
miniGunX :: Int -> Item
|
miniGunX :: Int -> Item
|
||||||
miniGunX i =
|
miniGunX i =
|
||||||
|
|||||||
@@ -27,14 +27,14 @@ bangCone =
|
|||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 15
|
& itUse . heldAim . aimMuzPos .~ 15
|
||||||
& itType . iyBase .~ HELD BANGCONE
|
& itType . iyBase .~ HELD BANGCONE
|
||||||
& itUse . heldConsumption . laMax .~ 5
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 5
|
||||||
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert 20, loadPrime 5]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 20, loadPrime 5]
|
||||||
|
|
||||||
blunderbuss :: Item
|
blunderbuss :: Item
|
||||||
blunderbuss =
|
blunderbuss =
|
||||||
bangCone
|
bangCone
|
||||||
& itUse . heldConsumption . laMax .~ 25
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 25
|
||||||
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert 30, loadPrime 5]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 30, loadPrime 5]
|
||||||
& itUse . heldAim . aimStance .~ TwoHandTwist
|
& itUse . heldAim . aimStance .~ TwoHandTwist
|
||||||
& itUse . heldAim . aimWeight .~ 6
|
& itUse . heldAim . aimWeight .~ 6
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
@@ -45,8 +45,8 @@ grapeCannon :: Int -> Item
|
|||||||
grapeCannon i =
|
grapeCannon i =
|
||||||
blunderbuss
|
blunderbuss
|
||||||
& itType . iyBase .~ HELD (GRAPECANNON i)
|
& itType . iyBase .~ HELD (GRAPECANNON i)
|
||||||
& itUse . heldConsumption . laMax .~ 25 + 25 * i
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 25 + 25 * i
|
||||||
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert (30 + i * 10), loadPrime 5]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert (30 + i * 10), loadPrime 5]
|
||||||
& itParams . recoil .~ (150 + fromIntegral i * 50)
|
& itParams . recoil .~ (150 + fromIntegral i * 50)
|
||||||
& itParams . torqueAfter .~ (0.1 + 0.2 * fromIntegral i)
|
& itParams . torqueAfter .~ (0.1 + 0.2 * fromIntegral i)
|
||||||
& itParams . randomOffset .~ (12 + 4 * fromIntegral i)
|
& itParams . randomOffset .~ (12 + 4 * fromIntegral i)
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ launcher =
|
|||||||
, _amPjDraw = DrawShell
|
, _amPjDraw = DrawShell
|
||||||
, _amPjCreation = CreateShell
|
, _amPjCreation = CreateShell
|
||||||
}
|
}
|
||||||
& itUse . heldConsumption . laMax .~ 1
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
|
||||||
& itUse . heldConsumption . laLoaded .~ 1
|
& itUse . heldConsumption . laSource . _InternalSource . iaLoaded .~ 1
|
||||||
& itUse . heldConsumption . laCycle .~ [loadEject 30, loadInsert 30, loadPrime 10]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 30, loadInsert 30, loadPrime 10]
|
||||||
& itType . iyBase .~ HELD LAUNCHER
|
& itType . iyBase .~ HELD LAUNCHER
|
||||||
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
|
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
|
||||||
|
|
||||||
@@ -48,8 +48,8 @@ launcherX :: Int -> Item
|
|||||||
launcherX i =
|
launcherX i =
|
||||||
launcher
|
launcher
|
||||||
& itType . iyBase .~ HELD (LAUNCHERX i)
|
& itType . iyBase .~ HELD (LAUNCHERX i)
|
||||||
& itUse . heldConsumption . laMax .~ i
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
||||||
& itUse . heldConsumption . laLoaded .~ i
|
& itUse . heldConsumption . laSource . _InternalSource . iaLoaded .~ i
|
||||||
& itUse . heldUse .~ HeldPJCreationX i
|
& itUse . heldUse .~ HeldPJCreationX i
|
||||||
& itUse . heldMods .~ LauncherXMod i
|
& itUse . heldMods .~ LauncherXMod i
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ bangRod =
|
|||||||
& itUse . heldMods .~ BangRodMod
|
& itUse . heldMods .~ BangRodMod
|
||||||
& itDimension . dimRad .~ 12
|
& itDimension . dimRad .~ 12
|
||||||
& itDimension . dimCenter .~ V3 5 0 0
|
& itDimension . dimCenter .~ V3 5 0 0
|
||||||
& itUse . heldConsumption . laMax .~ 1
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
|
||||||
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert 10, loadPrime 5]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 10, loadPrime 5]
|
||||||
& itType . iyBase .~ HELD BANGROD
|
& itType . iyBase .~ HELD BANGROD
|
||||||
& itUse . heldAim . aimWeight .~ 8
|
& itUse . heldAim . aimWeight .~ 8
|
||||||
& itUse . heldAim . aimRange .~ 1
|
& itUse . heldAim . aimRange .~ 1
|
||||||
@@ -56,7 +56,7 @@ amr :: Item
|
|||||||
amr =
|
amr =
|
||||||
elephantGun
|
elephantGun
|
||||||
& itType . iyBase .~ HELD AMR
|
& itType . iyBase .~ HELD AMR
|
||||||
& itUse . heldConsumption . laMax .~ 15
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 15
|
||||||
|
|
||||||
autoAmr :: Item
|
autoAmr :: Item
|
||||||
autoAmr =
|
autoAmr =
|
||||||
@@ -85,7 +85,7 @@ machineGun =
|
|||||||
& itUse . heldAim . aimStance .~ TwoHandTwist
|
& itUse . heldAim . aimStance .~ TwoHandTwist
|
||||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||||
& itUse . heldDelay .~ VariableRate{_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
|
& itUse . heldDelay .~ VariableRate{_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
|
||||||
& itUse . heldConsumption . laMax .~ 100
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 100
|
||||||
& itUse . heldConsumption . laCycle .~ [loadEject 10, loadInsert 40, loadPrime 10]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 10, loadInsert 40, loadPrime 10]
|
||||||
& itInvSize .~ 3
|
& itInvSize .~ 3
|
||||||
& itParams . torqueAfter .~ 0.2 -- not sure if this is necessary?
|
& itParams . torqueAfter .~ 0.2 -- not sure if this is necessary?
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ flameSpitter :: Item
|
|||||||
flameSpitter =
|
flameSpitter =
|
||||||
flameThrower
|
flameThrower
|
||||||
& itType . iyBase .~ HELD FLAMESPITTER
|
& itType . iyBase .~ HELD FLAMESPITTER
|
||||||
& itUse . heldConsumption . laMax .~ 10
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 10
|
||||||
& itUse . heldConsumption . laCycle .~ [loadEject 5, loadInsert 10, loadPrime 20]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 10, loadPrime 20]
|
||||||
& itParams . sprayNozzles . ix 0 . nzPressure .~ 4
|
& itParams . sprayNozzles . ix 0 . nzPressure .~ 4
|
||||||
& itUse . heldAim . aimStance .~ OneHand
|
& itUse . heldAim . aimStance .~ OneHand
|
||||||
& itUse . heldDelay .~ FixedRate{_rateMax = 12, _rateTime = 0}
|
& itUse . heldDelay .~ FixedRate{_rateMax = 12, _rateTime = 0}
|
||||||
@@ -96,12 +96,12 @@ flameThrower =
|
|||||||
& itUse . heldAim . aimMuzPos .~ 18
|
& itUse . heldAim . aimMuzPos .~ 18
|
||||||
& itUse . heldConsumption
|
& itUse . heldConsumption
|
||||||
.~ ( defaultLoadable
|
.~ ( defaultLoadable
|
||||||
& laMax .~ 250
|
& laSource . _InternalSource . iaMax .~ 250
|
||||||
& laAmmoType
|
& laAmmoType
|
||||||
.~ GasAmmo
|
.~ GasAmmo
|
||||||
{ _amString = "FLAME"
|
{ _amString = "FLAME"
|
||||||
, _amCreateGas = CreateFlame --aFlame
|
, _amCreateGas = CreateFlame --aFlame
|
||||||
}
|
}
|
||||||
& laCycle .~ [loadEject 5, loadInsert 10, loadPrime 20]
|
& laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 10, loadPrime 20]
|
||||||
)
|
)
|
||||||
& itType . iyBase .~ HELD FLAMETHROWER
|
& itType . iyBase .~ HELD FLAMETHROWER
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ bangStick i =
|
|||||||
& itUse . heldMods .~ BangStickMod
|
& itUse . heldMods .~ BangStickMod
|
||||||
& itUse . heldAim . aimHandlePos .~ 5
|
& itUse . heldAim . aimHandlePos .~ 5
|
||||||
& itUse . heldAim . aimMuzPos .~ 10
|
& itUse . heldAim . aimMuzPos .~ 10
|
||||||
& itUse . heldConsumption . laMax .~ i
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
||||||
& itUse . heldConsumption . laCycle .~ [loadPartialInsert 10 1]
|
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
|
||||||
|
|
||||||
baseStickSpread :: Float
|
baseStickSpread :: Float
|
||||||
baseStickSpread = 0.2
|
baseStickSpread = 0.2
|
||||||
@@ -51,8 +51,8 @@ revolver =
|
|||||||
pistol
|
pistol
|
||||||
& itUse . heldConsumption
|
& itUse . heldConsumption
|
||||||
.~ ( defaultBulletLoadable
|
.~ ( defaultBulletLoadable
|
||||||
& laMax .~ 6
|
& laSource . _InternalSource . iaMax .~ 6
|
||||||
& laCycle .~ [loadPartialInsert 10 1]
|
& laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
|
||||||
)
|
)
|
||||||
& itType . iyBase .~ HELD REVOLVER
|
& itType . iyBase .~ HELD REVOLVER
|
||||||
|
|
||||||
@@ -61,8 +61,8 @@ pistol =
|
|||||||
bangStick 1
|
bangStick 1
|
||||||
& itUse . heldConsumption
|
& itUse . heldConsumption
|
||||||
.~ ( defaultBulletLoadable
|
.~ ( defaultBulletLoadable
|
||||||
& laMax .~ 15
|
& laSource . _InternalSource . iaMax .~ 15
|
||||||
& laCycle .~ [loadEject 5, loadInsert 5, loadPrime 5]
|
& laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 5, loadPrime 5]
|
||||||
)
|
)
|
||||||
& itUse . heldDelay . rateMax .~ 6
|
& itUse . heldDelay . rateMax .~ 6
|
||||||
& itUse . heldMods .~ PistolMod
|
& itUse . heldMods .~ PistolMod
|
||||||
@@ -106,5 +106,5 @@ revolverX i =
|
|||||||
revolver
|
revolver
|
||||||
& itUse . heldDelay . rateMax .~ 8
|
& itUse . heldDelay . rateMax .~ 8
|
||||||
& itUse . heldMods .~ RevolverXMod
|
& itUse . heldMods .~ RevolverXMod
|
||||||
& itUse . heldConsumption . laMax .~ i * 6
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i * 6
|
||||||
& itType . iyBase .~ HELD (REVOLVERX i)
|
& itType . iyBase .~ HELD (REVOLVERX i)
|
||||||
|
|||||||
+49
-33
@@ -1,16 +1,17 @@
|
|||||||
module Dodge.Item.Info where
|
module Dodge.Item.Info where
|
||||||
|
|
||||||
import StringHelp
|
|
||||||
import Dodge.Module.Info
|
|
||||||
import Data.Char
|
import Data.Char
|
||||||
import Dodge.Data.Item
|
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
|
import Dodge.Data.Item
|
||||||
|
import Dodge.Module.Info
|
||||||
import LensHelp
|
import LensHelp
|
||||||
|
import StringHelp
|
||||||
|
|
||||||
itemInfo :: Item -> String
|
itemInfo :: Item -> String
|
||||||
itemInfo itm = itmBaseInfo itm ++ " " ++ itmUsageInfo itm
|
itemInfo itm =
|
||||||
++ itmSpaceInfo itm
|
itmBaseInfo itm ++ " " ++ itmUsageInfo itm
|
||||||
++ itmModuleInfo (itm ^. itType . iyModules)
|
++ itmSpaceInfo itm
|
||||||
|
++ itmModuleInfo (itm ^. itType . iyModules)
|
||||||
|
|
||||||
itmSpaceInfo :: Item -> String
|
itmSpaceInfo :: Item -> String
|
||||||
itmSpaceInfo itm = case ceiling $ _itInvSize itm of
|
itmSpaceInfo itm = case ceiling $ _itInvSize itm of
|
||||||
@@ -43,20 +44,34 @@ showInt i = case i of
|
|||||||
12 -> "a dozen"
|
12 -> "a dozen"
|
||||||
_ -> "more than a dozen"
|
_ -> "more than a dozen"
|
||||||
|
|
||||||
|
showIntKMG :: Int -> String
|
||||||
|
showIntKMG x
|
||||||
|
| x < 1000 = show x
|
||||||
|
| x < 1000000 = show (x `div` 1000) ++ "K"
|
||||||
|
| x < 1000000000 = show (x `div` 1000000) ++ "M"
|
||||||
|
| otherwise = show (x `div` 1000000000) ++ "G"
|
||||||
|
|
||||||
|
showIntKMG' :: Int -> String
|
||||||
|
showIntKMG' x
|
||||||
|
| x < 1000 = show x
|
||||||
|
| x < 1000000 = take 3 (show ((fromIntegral x :: Float) / 1000)) ++ "K"
|
||||||
|
| x < 1000000000 = take 3 (show ((fromIntegral x :: Float) / 1000000)) ++ "M"
|
||||||
|
| otherwise = take 3 (show ((fromIntegral x :: Float) / 1000000000)) ++ "G"
|
||||||
|
|
||||||
heldInfo :: HeldItemType -> String
|
heldInfo :: HeldItemType -> String
|
||||||
heldInfo hit = case hit of
|
heldInfo hit = case hit of
|
||||||
BANGSTICK 1 -> "A firearm with a short barrel that requires reloading after each shot."
|
BANGSTICK 1 -> "A firearm with a short barrel that requires reloading after each shot."
|
||||||
BANGSTICK i -> over _head toUpper (showInt i)++" small gun barrels strapped together. Each barrel must be individually loaded, but not all need be loaded for the weapon to fire. All loaded barrels discharge simultaneously, with significant spread."
|
BANGSTICK i -> over _head toUpper (showInt i) ++ " small gun barrels strapped together. Each barrel must be individually loaded, but not all need be loaded for the weapon to fire. All loaded barrels discharge simultaneously, with significant spread."
|
||||||
PISTOL -> "A small firearm fed by a magazine. The entire magazine must be replaced when reloading the weapon."
|
PISTOL -> "A small firearm fed by a magazine. The entire magazine must be replaced when reloading the weapon."
|
||||||
REVOLVER -> "A small firearm fed by a revolving cylinder. Single shot and load."
|
REVOLVER -> "A small firearm fed by a revolving cylinder. Single shot and load."
|
||||||
REVOLVERX i -> "A small firearm fed by "++ showInt i++ "revolving cylinders."
|
REVOLVERX i -> "A small firearm fed by " ++ showInt i ++ "revolving cylinders."
|
||||||
MACHINEPISTOL -> "A small firearm automatically, and extremely rapidly, fed by a magazine. The entire magazine must be replaced when reloading the weapon."
|
MACHINEPISTOL -> "A small firearm automatically, and extremely rapidly, fed by a magazine. The entire magazine must be replaced when reloading the weapon."
|
||||||
AUTOPISTOL -> "A small firearm automatically fed by a magazine. The entire magazine must be replaced when reloading the weapon."
|
AUTOPISTOL -> "A small firearm automatically fed by a magazine. The entire magazine must be replaced when reloading the weapon."
|
||||||
SMG -> "A small firearm with an attached stock for stability."
|
SMG -> "A small firearm with an attached stock for stability."
|
||||||
BANGCONE -> "A container for debris. Exposive action propels the debris away from the user. Quite unweildy."
|
BANGCONE -> "A container for debris. Exposive action propels the debris away from the user. Quite unweildy."
|
||||||
BLUNDERBUSS -> "A container for debris on the end of a stick. Explosive action propels the debris away from the user."
|
BLUNDERBUSS -> "A container for debris on the end of a stick. Explosive action propels the debris away from the user."
|
||||||
GRAPECANNON 1 -> "A large container for debris on the end of a stick. Explosive action propels the debris away from the user."
|
GRAPECANNON 1 -> "A large container for debris on the end of a stick. Explosive action propels the debris away from the user."
|
||||||
GRAPECANNON i -> "An "++ replicate (i-1) 'X' ++"L container for debris on the end of a stick. Explosive action propels the debris away from the user."
|
GRAPECANNON i -> "An " ++ replicate (i -1) 'X' ++ "L container for debris on the end of a stick. Explosive action propels the debris away from the user."
|
||||||
MINIGUNX i -> over _head toUpper (showInt i) ++ " gun barrels that revolve rapidly around a central stick. Requires considerable time to warm up, but has an extremely rapid rate of fire. It is also extremely difficult to stabilise."
|
MINIGUNX i -> over _head toUpper (showInt i) ++ " gun barrels that revolve rapidly around a central stick. Requires considerable time to warm up, but has an extremely rapid rate of fire. It is also extremely difficult to stabilise."
|
||||||
VOLLEYGUN i -> over _head toUpper (showInt i) ++ " gun barrels lined up to be roughly parallel. Each barrel must be individually loaded, but not all need be loaded for the weapon to fire. All loaded barrels discharge simultaneously."
|
VOLLEYGUN i -> over _head toUpper (showInt i) ++ " gun barrels lined up to be roughly parallel. Each barrel must be individually loaded, but not all need be loaded for the weapon to fire. All loaded barrels discharge simultaneously."
|
||||||
RIFLE -> "A firearm with a mid length barrel that requires reloading after each shot."
|
RIFLE -> "A firearm with a mid length barrel that requires reloading after each shot."
|
||||||
@@ -82,17 +97,17 @@ heldInfo hit = case hit of
|
|||||||
LASWIDE _ -> "A weapon that continuously emits photons in a narrow beam. The beam expands as the weapon heats up."
|
LASWIDE _ -> "A weapon that continuously emits photons in a narrow beam. The beam expands as the weapon heats up."
|
||||||
TRACTORGUN -> "An item that produces a beam of gravitons."
|
TRACTORGUN -> "An item that produces a beam of gravitons."
|
||||||
LAUNCHER -> "A large tube that can launch self propelled projectiles. Moving the tube after launch will cause the projectile to spin."
|
LAUNCHER -> "A large tube that can launch self propelled projectiles. Moving the tube after launch will cause the projectile to spin."
|
||||||
LAUNCHERX i -> over _head toUpper (showInt i)++" tubes that can launch self propelled projectiles. Tubes that do not face forward launch their projecitles at an angle."
|
LAUNCHERX i -> over _head toUpper (showInt i) ++ " tubes that can launch self propelled projectiles. Tubes that do not face forward launch their projecitles at an angle."
|
||||||
REMOTELAUNCHER -> "A large tube that can launch self propelled projectiles. Contains a transmitter allowing for remote control of launched projectiles."
|
REMOTELAUNCHER -> "A large tube that can launch self propelled projectiles. Contains a transmitter allowing for remote control of launched projectiles."
|
||||||
POISONSPRAYER -> "A weapon that releases noxious gases."
|
POISONSPRAYER -> "A weapon that releases noxious gases."
|
||||||
DRONELAUNCHER -> "A device for launching drones."
|
DRONELAUNCHER -> "A device for launching drones."
|
||||||
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."
|
||||||
HELDDETECTOR d -> "A device that detects "++detectorInfo d ++" in an expanding radius."
|
HELDDETECTOR 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."
|
||||||
BINOCULARS -> "Two cylinders with lenses. Scroll to zoom."
|
BINOCULARS -> "Two cylinders with lenses. Scroll to zoom."
|
||||||
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 ++ "."
|
||||||
|
|
||||||
leftInfo :: LeftItemType -> String
|
leftInfo :: LeftItemType -> String
|
||||||
leftInfo lit = case lit of
|
leftInfo lit = case lit of
|
||||||
@@ -114,17 +129,17 @@ equipInfo eit = case eit of
|
|||||||
INVISIBILITYEQUIPMENT _ -> "A device that bends light around its user."
|
INVISIBILITYEQUIPMENT _ -> "A device that bends light around its user."
|
||||||
BRAINHAT -> "An iq enhancer. Useless."
|
BRAINHAT -> "An iq enhancer. Useless."
|
||||||
HAT -> "A hat."
|
HAT -> "A hat."
|
||||||
TARGETINGHAT tt -> "Headwear that "++ targetingInfo tt
|
TARGETINGHAT tt -> "Headwear that " ++ targetingInfo tt
|
||||||
HEADLAMP -> "A torch strapped to a hat."
|
HEADLAMP -> "A torch strapped to a hat."
|
||||||
POWERLEGS -> "Strength enhancing legs."
|
POWERLEGS -> "Strength enhancing legs."
|
||||||
SPEEDLEGS -> "Speed enhancing legs."
|
SPEEDLEGS -> "Speed enhancing legs."
|
||||||
JUMPLEGS -> "Jump enhancing legs."
|
JUMPLEGS -> "Jump enhancing legs."
|
||||||
|
|
||||||
JETPACK -> "A device enabling flight."
|
JETPACK -> "A device enabling flight."
|
||||||
FUELPACK -> "A liquid container with attached hose."
|
FUELPACK -> "A liquid container with attached hose."
|
||||||
|
BULLETBELTPACK -> "A container holding a long belt of bullets."
|
||||||
|
BULLETBELTBRACER -> "A container holding a long belt of bullets."
|
||||||
BATTERYPACK -> "A collection of batteries with a universal adapter."
|
BATTERYPACK -> "A collection of batteries with a universal adapter."
|
||||||
|
AUTODETECTOR d -> "A device that detects " ++ detectorInfo d ++ " in an expanding radius. Pulses automatically. "
|
||||||
AUTODETECTOR d -> "A device that detects "++detectorInfo d ++" in an expanding radius. Pulses automatically. "
|
|
||||||
|
|
||||||
targetingInfo :: TargetType -> String
|
targetingInfo :: TargetType -> String
|
||||||
targetingInfo tt = case tt of
|
targetingInfo tt = case tt of
|
||||||
@@ -145,10 +160,8 @@ craftInfo fit = case fit of
|
|||||||
TUBE -> "A wide rigid cylinder."
|
TUBE -> "A wide rigid cylinder."
|
||||||
HARDWARE -> "A collection of equipment and devices useful for general construction."
|
HARDWARE -> "A collection of equipment and devices useful for general construction."
|
||||||
SPRING -> "An object that exerts an opposing force when compressed or stretched."
|
SPRING -> "An object that exerts an opposing force when compressed or stretched."
|
||||||
|
|
||||||
HOSE -> "A flexible cylinder."
|
HOSE -> "A flexible cylinder."
|
||||||
TAPE -> "A strip of material with an adhesive side."
|
TAPE -> "A strip of material with an adhesive side."
|
||||||
|
|
||||||
CAN -> "A small metal cylindrical container."
|
CAN -> "A small metal cylindrical container."
|
||||||
TIN -> "A small metal continer."
|
TIN -> "A small metal continer."
|
||||||
STEELDRUM -> "A metal cylindrical container."
|
STEELDRUM -> "A metal cylindrical container."
|
||||||
@@ -192,13 +205,10 @@ craftInfo fit = case fit of
|
|||||||
TIMEMODULE -> "A device that can affect temporality."
|
TIMEMODULE -> "A device that can affect temporality."
|
||||||
SIZEMODULE -> "A device that can affect physical size."
|
SIZEMODULE -> "A device that can affect physical size."
|
||||||
GRAVITYMODULE -> "A device that can affect gravitational fields."
|
GRAVITYMODULE -> "A device that can affect gravitational fields."
|
||||||
|
|
||||||
TARGETMODULE _ -> "A targeting module."
|
TARGETMODULE _ -> "A targeting module."
|
||||||
|
|
||||||
FLAKCRAFT -> "Creates flak bullets."
|
FLAKCRAFT -> "Creates flak bullets."
|
||||||
FRAGCRAFT -> "Creates fragmentation bullets."
|
FRAGCRAFT -> "Creates fragmentation bullets."
|
||||||
|
|
||||||
|
|
||||||
detectorInfo :: Detector -> String
|
detectorInfo :: Detector -> String
|
||||||
detectorInfo d = case d of
|
detectorInfo d = case d of
|
||||||
ITEMDETECTOR -> "items"
|
ITEMDETECTOR -> "items"
|
||||||
@@ -208,8 +218,9 @@ detectorInfo d = case d of
|
|||||||
itmUsageInfo :: Item -> String
|
itmUsageInfo :: Item -> String
|
||||||
itmUsageInfo itm = case itm ^. itType . iyBase of
|
itmUsageInfo itm = case itm ^. itType . iyBase of
|
||||||
HELD _ -> heldPositionInfo itm
|
HELD _ -> heldPositionInfo itm
|
||||||
LEFT _ -> "This item can be equipped" ++ itmEquipSiteInfo itm
|
LEFT _ ->
|
||||||
++ ". When equipped, it can be activated."
|
"This item can be equipped" ++ itmEquipSiteInfo itm
|
||||||
|
++ ". When equipped, it can be activated."
|
||||||
EQUIP _ -> "This item can be equipped " ++ itmEquipSiteInfo itm ++ "."
|
EQUIP _ -> "This item can be equipped " ++ itmEquipSiteInfo itm ++ "."
|
||||||
Consumable _ -> "This item can be consumed."
|
Consumable _ -> "This item can be consumed."
|
||||||
CRAFT _ -> ""
|
CRAFT _ -> ""
|
||||||
@@ -223,6 +234,7 @@ aimStanceInfo as = case as of
|
|||||||
TwoHandTwist -> "It is held in two hands along its length."
|
TwoHandTwist -> "It is held in two hands along its length."
|
||||||
TwoHandFlat -> "It is held in two hands at its sides."
|
TwoHandFlat -> "It is held in two hands at its sides."
|
||||||
OneHand -> "It is held in one hand."
|
OneHand -> "It is held in one hand."
|
||||||
|
|
||||||
-- LeaveHolstered -> "It is to be left holstered."
|
-- LeaveHolstered -> "It is to be left holstered."
|
||||||
|
|
||||||
itmEquipSiteInfo :: Item -> String
|
itmEquipSiteInfo :: Item -> String
|
||||||
@@ -239,21 +251,25 @@ equipSiteInfo es = case es of
|
|||||||
itmModuleInfo :: M.Map ModuleSlot ItemModuleType -> String
|
itmModuleInfo :: M.Map ModuleSlot ItemModuleType -> String
|
||||||
itmModuleInfo m
|
itmModuleInfo m
|
||||||
| m == mempty = ""
|
| m == mempty = ""
|
||||||
| otherwise = mms ++ ems
|
| otherwise = mms ++ ems
|
||||||
where
|
where
|
||||||
(mademods,emptymods) = M.partition (/= EMPTYMODULE) m
|
(mademods, emptymods) = M.partition (/= EMPTYMODULE) m
|
||||||
mms | mademods == mempty = ""
|
mms
|
||||||
| otherwise = " Modifications have been made "
|
| mademods == mempty = ""
|
||||||
++ makeCommaList (map moduleInfo $ M.keys mademods)
|
| otherwise =
|
||||||
ems | emptymods == mempty = ""
|
" Modifications have been made "
|
||||||
| otherwise = " Modifications can be made "
|
++ makeCommaList (map moduleInfo $ M.keys mademods)
|
||||||
++ makeCommaList (map moduleInfo $ M.keys emptymods)
|
ems
|
||||||
|
| emptymods == mempty = ""
|
||||||
|
| otherwise =
|
||||||
|
" Modifications can be made "
|
||||||
|
++ makeCommaList (map moduleInfo $ M.keys emptymods)
|
||||||
|
|
||||||
makeCommaList :: [String] -> String
|
makeCommaList :: [String] -> String
|
||||||
makeCommaList [] = ""
|
makeCommaList [] = ""
|
||||||
makeCommaList [x] = x ++ "."
|
makeCommaList [x] = x ++ "."
|
||||||
makeCommaList [x,y] = x ++ " and " ++ y ++ "."
|
makeCommaList [x, y] = x ++ " and " ++ y ++ "."
|
||||||
makeCommaList (x:xs) = x ++ ", " ++ makeCommaList xs
|
makeCommaList (x : xs) = x ++ ", " ++ makeCommaList xs
|
||||||
|
|
||||||
moduleInfo :: ModuleSlot -> String
|
moduleInfo :: ModuleSlot -> String
|
||||||
moduleInfo imt = case imt of
|
moduleInfo imt = case imt of
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ droneLauncher =
|
|||||||
& itUse . heldAim . aimRange .~ 0.5
|
& itUse . heldAim . aimRange .~ 0.5
|
||||||
& itUse . heldAim . aimStance .~ TwoHandTwist
|
& itUse . heldAim . aimStance .~ TwoHandTwist
|
||||||
& itUse . heldConsumption . laAmmoType .~ DroneAmmo{_amString = "LASDRONE"}
|
& itUse . heldConsumption . laAmmoType .~ DroneAmmo{_amString = "LASDRONE"}
|
||||||
& itUse . heldConsumption . laMax .~ 2
|
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 2
|
||||||
& itType . iyBase .~ HELD DRONELAUNCHER
|
& itType . iyBase .~ HELD DRONELAUNCHER
|
||||||
|
|
||||||
lasDronesPic :: Item -> SPic
|
lasDronesPic :: Item -> SPic
|
||||||
|
|||||||
@@ -1,22 +1,26 @@
|
|||||||
module Dodge.Item.Weapon.FractionLoaded
|
module Dodge.Item.Weapon.FractionLoaded (
|
||||||
( fractionLoadedAmmo
|
fractionLoadedAmmo,
|
||||||
, fractionLoadedAmmo2
|
fractionLoadedAmmo2,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Control.Lens
|
||||||
|
import Data.Maybe
|
||||||
import Dodge.Data.Item
|
import Dodge.Data.Item
|
||||||
|
|
||||||
---- this shouldn't really be used
|
---- this shouldn't really be used
|
||||||
loadedAmmo :: Item -> Int
|
loadedAmmo :: Item -> Int
|
||||||
loadedAmmo = _laLoaded . _heldConsumption . _itUse
|
loadedAmmo itm = fromMaybe 0 $ itm ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||||
|
|
||||||
-- | _laTransfer (_itConsumption it) == NoTransfer = _laLoaded (_itConsumption it)
|
-- | _laTransfer (_itConsumption it) == NoTransfer = _laLoaded (_itConsumption it)
|
||||||
-- | otherwise = 0
|
-- | otherwise = 0
|
||||||
|
|
||||||
fractionLoadedAmmo :: Item -> Float
|
fractionLoadedAmmo :: Item -> Float
|
||||||
fractionLoadedAmmo it = fromIntegral (loadedAmmo it) / fromIntegral (itmaxammo it)
|
fractionLoadedAmmo it = fromIntegral (loadedAmmo it) / fromIntegral itmaxammo
|
||||||
where
|
where
|
||||||
itmaxammo = _laMax . _heldConsumption . _itUse
|
itmaxammo = fromMaybe 1 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaMax
|
||||||
|
|
||||||
fractionLoadedAmmo2 :: Item -> Float
|
fractionLoadedAmmo2 :: Item -> Float
|
||||||
fractionLoadedAmmo2 it = 1 -
|
fractionLoadedAmmo2 it =
|
||||||
(1 - fromIntegral (loadedAmmo it) / fromIntegral (itMaxAmmo it))**2
|
1 - (1 - fromIntegral (loadedAmmo it) / fromIntegral itmaxammo) ** 2
|
||||||
where
|
where
|
||||||
itMaxAmmo = _laMax . _heldConsumption . _itUse
|
itmaxammo = fromMaybe 1 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaMax
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ module Dodge.Item.Weapon.TriggerType (
|
|||||||
withItem,
|
withItem,
|
||||||
withItemUpdate,
|
withItemUpdate,
|
||||||
withItemUpdate',
|
withItemUpdate',
|
||||||
ammoUseCheck,
|
|
||||||
rateIncAB,
|
rateIncAB,
|
||||||
torqueBefore,
|
torqueBefore,
|
||||||
torqueBeforeAtLeast,
|
torqueBeforeAtLeast,
|
||||||
@@ -55,16 +54,16 @@ module Dodge.Item.Weapon.TriggerType (
|
|||||||
duplicateOffsets,
|
duplicateOffsets,
|
||||||
duplicateOffsetsV2,
|
duplicateOffsetsV2,
|
||||||
duplicateOffsetsFocus,
|
duplicateOffsetsFocus,
|
||||||
hammerCheckI,
|
|
||||||
hammerCheckL,
|
hammerCheckL,
|
||||||
shootL,
|
shootL,
|
||||||
useTimeCheck,
|
useTimeCheck,
|
||||||
ammoCheckI,
|
ammoCheckI,
|
||||||
applyInaccuracy,
|
applyInaccuracy,
|
||||||
modClock,
|
modClock,
|
||||||
ammoHammerCheck,
|
blCheck,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import qualified SDL
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
@@ -80,6 +79,7 @@ import Geometry
|
|||||||
import LensHelp
|
import LensHelp
|
||||||
import RandomHelp
|
import RandomHelp
|
||||||
import Sound.Data
|
import Sound.Data
|
||||||
|
import qualified IntMapHelp as IM
|
||||||
|
|
||||||
type ChainEffect =
|
type ChainEffect =
|
||||||
(Item -> Creature -> World -> World) ->
|
(Item -> Creature -> World -> World) ->
|
||||||
@@ -136,28 +136,25 @@ withThickSmokeI eff item cr w =
|
|||||||
-- TODO create a trigger that does different things on first and continued
|
-- TODO create a trigger that does different things on first and continued
|
||||||
-- fire.
|
-- fire.
|
||||||
ammoCheckI :: ChainEffect
|
ammoCheckI :: ChainEffect
|
||||||
ammoCheckI eff itm cr w
|
ammoCheckI eff itm cr w = case itm ^? itUse . heldConsumption . laSource of
|
||||||
| _laLoaded ic <= 0 || not (_laPrimed ic) = w
|
Just (InternalSource ia) | _iaLoaded ia <= 0 || not (_iaPrimed ia)
|
||||||
| otherwise = eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
-> failsound w
|
||||||
|
Just AboveSource | fromMaybe True $ do
|
||||||
|
invid <- itm ^? itLocation . ipInvID
|
||||||
|
x <- cr ^? crInv . ix (invid - 1) . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||||
|
return $ x <= 0
|
||||||
|
-> failsound w
|
||||||
|
_ -> eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
||||||
where
|
where
|
||||||
ic = _heldConsumption $ _itUse itm
|
failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
|
||||||
|
Just 0 -> soundStart (CrReloadSound (_crID cr)) (_crPos cr) click1S Nothing
|
||||||
-- combined ammo and hammer check: want to be able to auto-reload even if the
|
_ -> soundContinue (CrReloadSound (_crID cr)) (_crPos cr) click1S Nothing
|
||||||
-- hammer is down?
|
|
||||||
ammoHammerCheck :: ChainEffect
|
|
||||||
ammoHammerCheck eff it cr w
|
|
||||||
| _laLoaded ic <= 0 || not (_laPrimed ic) = w -- fromMaybe w (startReloadingWeapon cr w)
|
|
||||||
| otherwise = case it ^? itUse . heldHammer of
|
|
||||||
Just HammerUp -> eff it cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
|
||||||
_ -> w
|
|
||||||
where
|
|
||||||
ic = _heldConsumption $ _itUse it
|
|
||||||
|
|
||||||
itUseCharge :: Int -> Item -> Item
|
itUseCharge :: Int -> Item -> Item
|
||||||
itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
|
itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
|
||||||
|
|
||||||
itUseAmmo :: Int -> Item -> Item
|
itUseAmmo :: Int -> Item -> Item
|
||||||
itUseAmmo x = itUse . heldConsumption . laLoaded %~ (max 0 . subtract x)
|
itUseAmmo x = itUse . heldConsumption . laSource . _InternalSource . iaLoaded %~ (max 0 . subtract x)
|
||||||
|
|
||||||
{- | Fires at an increasing rate.
|
{- | Fires at an increasing rate.
|
||||||
Has different effect after first fire.
|
Has different effect after first fire.
|
||||||
@@ -341,14 +338,14 @@ withSidePushAfterI maxSide eff item cr w =
|
|||||||
useAllAmmo :: ChainEffect
|
useAllAmmo :: ChainEffect
|
||||||
useAllAmmo eff item cr =
|
useAllAmmo eff item cr =
|
||||||
eff item cr
|
eff item cr
|
||||||
. (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itRef . itUse . heldConsumption . laLoaded .~ 0)
|
. (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itRef . itUse . heldConsumption . laSource . _InternalSource . iaLoaded .~ 0)
|
||||||
where
|
where
|
||||||
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||||
|
|
||||||
useAmmoUpTo :: Int -> ChainEffect
|
useAmmoUpTo :: Int -> ChainEffect
|
||||||
useAmmoUpTo amAmount eff item cr =
|
useAmmoUpTo amAmount eff item cr =
|
||||||
eff item cr
|
eff item cr
|
||||||
. ( cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itRef . itUse . heldConsumption . laLoaded
|
. ( cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itRef . itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||||
%~ (max 0 . subtract amAmount)
|
%~ (max 0 . subtract amAmount)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
@@ -357,9 +354,18 @@ useAmmoUpTo amAmount eff item cr =
|
|||||||
useAmmoAmount :: Int -> ChainEffect
|
useAmmoAmount :: Int -> ChainEffect
|
||||||
useAmmoAmount amAmount eff item cr =
|
useAmmoAmount amAmount eff item cr =
|
||||||
eff item cr
|
eff item cr
|
||||||
. (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itRef . itUse . heldConsumption . laLoaded -~ amAmount)
|
. (cWorld . lWorld . creatures . ix (_crID cr) . crInv %~ useAmmoAmount' itref amAmount) -- . _InternalSource . iaLoaded -~ amAmount)
|
||||||
where
|
where
|
||||||
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
itref = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||||
|
|
||||||
|
useAmmoAmount' :: Int -> Int -> IM.IntMap Item -> IM.IntMap Item
|
||||||
|
useAmmoAmount' itref x inv = case inv ^? ix itref . itUse . heldConsumption . laSource of
|
||||||
|
Just InternalSource{}
|
||||||
|
-> inv & ix itref . itUse . heldConsumption . laSource . _InternalSource . iaLoaded -~ x
|
||||||
|
Just AboveSource
|
||||||
|
-> inv & ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
||||||
|
_ -> inv
|
||||||
|
-- . crInv . ix itRef . itUse . heldConsumption . laSource
|
||||||
|
|
||||||
{- |
|
{- |
|
||||||
Applies a world effect after an item use cooldown check.
|
Applies a world effect after an item use cooldown check.
|
||||||
@@ -374,37 +380,13 @@ useTimeCheck f item cr w = case item ^? itUse . heldDelay . rateTime of
|
|||||||
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||||
userate = fromMaybe 0 $ item ^? itUse . heldDelay . rateMax
|
userate = fromMaybe 0 $ item ^? itUse . heldDelay . rateMax
|
||||||
|
|
||||||
|
|
||||||
-- | Applies a world effect after a hammer position check.
|
-- | Applies a world effect after a hammer position check.
|
||||||
hammerCheckI :: ChainEffect
|
blCheck :: ChainEffect
|
||||||
hammerCheckI f it cr w = case it ^? itUse . heldHammer of
|
blCheck f it cr w = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
|
||||||
Just HammerUp
|
Just 0 -> f it cr w
|
||||||
| _laPrimed (_heldConsumption (_itUse it)) ->
|
|
||||||
f it cr w
|
|
||||||
_ -> w
|
_ -> w
|
||||||
|
|
||||||
-- | Applies a world effect after an ammo check.
|
|
||||||
|
|
||||||
-- this should be made "safe" incase there is no _rateTime
|
|
||||||
ammoUseCheck :: ChainEffect
|
|
||||||
ammoUseCheck f item cr w
|
|
||||||
| fireCondition =
|
|
||||||
f item cr w & pointerToItem
|
|
||||||
%~ ( itUseAmmo 1
|
|
||||||
. (itUse . heldDelay . rateTime .~ _rateMax (_heldDelay (_itUse item)))
|
|
||||||
)
|
|
||||||
-- | reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
|
||||||
| otherwise = w
|
|
||||||
where
|
|
||||||
cid = _crID cr
|
|
||||||
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
|
||||||
pointerToItem = cWorld . lWorld . creatures . ix cid . crInv . ix itRef
|
|
||||||
fireCondition =
|
|
||||||
crWeaponReady cr
|
|
||||||
&& _rateTime (_heldDelay (_itUse item)) == 0
|
|
||||||
&& _laLoaded (_heldConsumption (_itUse item)) > 0
|
|
||||||
|
|
||||||
-- reloadCondition = _laLoaded (_itConsumption item) == 0
|
|
||||||
|
|
||||||
{- | Applies a world effect after a hammer position check.
|
{- | Applies a world effect after a hammer position check.
|
||||||
Arbitrary inventory position.
|
Arbitrary inventory position.
|
||||||
-}
|
-}
|
||||||
@@ -649,7 +631,7 @@ spreadLoaded eff item cr w = foldr f w dirs
|
|||||||
dirs = subtract cd . (spread *) . fromIntegral <$> [0 .. numBulLoaded - 1]
|
dirs = subtract cd . (spread *) . fromIntegral <$> [0 .. numBulLoaded - 1]
|
||||||
f dir = eff item (cr & crDir +~ dir)
|
f dir = eff item (cr & crDir +~ dir)
|
||||||
spread = _spreadAngle . _brlSpread . _gunBarrels $ _itParams item
|
spread = _spreadAngle . _brlSpread . _gunBarrels $ _itParams item
|
||||||
numBulLoaded = _laLoaded $ _heldConsumption (_itUse item)
|
numBulLoaded = item ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||||
|
|
||||||
sideEffectOnFrame ::
|
sideEffectOnFrame ::
|
||||||
Int ->
|
Int ->
|
||||||
@@ -684,7 +666,7 @@ duplicateLoaded :: ChainEffect
|
|||||||
duplicateLoaded eff it cr w = foldr f w [1 .. numBul]
|
duplicateLoaded eff it cr w = foldr f w [1 .. numBul]
|
||||||
where
|
where
|
||||||
f _ = eff it cr
|
f _ = eff it cr
|
||||||
numBul = _laLoaded $ _heldConsumption (_itUse it)
|
numBul = it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||||
|
|
||||||
duplicateLoadedBarrels :: ChainEffect
|
duplicateLoadedBarrels :: ChainEffect
|
||||||
duplicateLoadedBarrels eff item cr w = foldr f w poss
|
duplicateLoadedBarrels eff item cr w = foldr f w poss
|
||||||
@@ -695,7 +677,7 @@ duplicateLoadedBarrels eff item cr w = foldr f w poss
|
|||||||
poss = map (rotateV (_crDir cr) . V2 0 . (* 5) . (+ cp) . fromIntegral) [0 .. numBul - 1]
|
poss = map (rotateV (_crDir cr) . V2 0 . (* 5) . (+ cp) . fromIntegral) [0 .. numBul - 1]
|
||||||
f pos = eff item (cr & crPos %~ (+.+ pos))
|
f pos = eff item (cr & crPos %~ (+.+ pos))
|
||||||
numBar = _brlNum . _gunBarrels $ _itParams item
|
numBar = _brlNum . _gunBarrels $ _itParams item
|
||||||
numBul = _laLoaded $ _heldConsumption (_itUse item)
|
numBul = item ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||||
|
|
||||||
duplicateOffsetsFocus :: [Float] -> ChainEffect
|
duplicateOffsetsFocus :: [Float] -> ChainEffect
|
||||||
duplicateOffsetsFocus xs eff item cr w = foldr f w poss
|
duplicateOffsetsFocus xs eff item cr w = foldr f w poss
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ colStrToSelItem (col, str) =
|
|||||||
, _siIsSelectable = True
|
, _siIsSelectable = True
|
||||||
, _siColor = col
|
, _siColor = col
|
||||||
, _siOffX = 0
|
, _siOffX = 0
|
||||||
|
, _siOffY = 0
|
||||||
, _siPayload = id
|
, _siPayload = id
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,6 +121,7 @@ menuOptionToSelectionItem w padAmount mo =
|
|||||||
, _siIsSelectable = isselectable
|
, _siIsSelectable = isselectable
|
||||||
, _siColor = thecol
|
, _siColor = thecol
|
||||||
, _siOffX = 0
|
, _siOffX = 0
|
||||||
|
, _siOffY = 0
|
||||||
, _siPayload = (f, g)
|
, _siPayload = (f, g)
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
|
|||||||
+37
-32
@@ -1,14 +1,13 @@
|
|||||||
module Dodge.Reloading (
|
module Dodge.Reloading (
|
||||||
crCancelReloading,
|
crCancelReloading,
|
||||||
crToggleReloading,
|
crUpdateLoadSource,
|
||||||
stepReloading,
|
stepReloading,
|
||||||
tryStartLoading,
|
tryStartLoading,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Dodge.Data.Item.Use.Consumption.LoadAction
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Dodge.Data.Creature
|
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
import Dodge.Data.Creature
|
||||||
|
|
||||||
crCancelReloading :: Creature -> Creature
|
crCancelReloading :: Creature -> Creature
|
||||||
crCancelReloading cr =
|
crCancelReloading cr =
|
||||||
@@ -18,7 +17,9 @@ crCancelReloading cr =
|
|||||||
where
|
where
|
||||||
updateProgress = fromMaybe id $ do
|
updateProgress = fromMaybe id $ do
|
||||||
InInventory (SelItem i _) <- cr ^? crManipulation . manObject
|
InInventory (SelItem i _) <- cr ^? crManipulation . manObject
|
||||||
return $ crInv . ix i . itUse . heldConsumption . laProgress %~ const Nothing
|
return $
|
||||||
|
crInv . ix i . itUse . heldConsumption . laSource . _InternalSource . iaProgress
|
||||||
|
%~ const Nothing
|
||||||
|
|
||||||
stepReloading :: Creature -> Creature
|
stepReloading :: Creature -> Creature
|
||||||
stepReloading cr = case cr ^? crManipulation . manObject . inInventory of
|
stepReloading cr = case cr ^? crManipulation . manObject . inInventory of
|
||||||
@@ -27,59 +28,63 @@ stepReloading cr = case cr ^? crManipulation . manObject . inInventory of
|
|||||||
cr & crManipulation . manObject . inInventory . iselAction . actionProgress -~ 1
|
cr & crManipulation . manObject . inInventory . iselAction . actionProgress -~ 1
|
||||||
| otherwise ->
|
| otherwise ->
|
||||||
cr
|
cr
|
||||||
& crInv . ix i . itUse . heldConsumption %~ doLoadAction la
|
& crInv . ix i . itUse . heldConsumption . laSource . _InternalSource %~ doLoadAction la
|
||||||
& crInv . ix i . itUse . heldConsumption %~ rotateActionProgress
|
& crInv . ix i . itUse . heldConsumption . laSource . _InternalSource %~ rotateActionProgress
|
||||||
& tryNextLoadAction
|
& tryNextLoadAction
|
||||||
_ -> cr
|
_ -> cr
|
||||||
|
|
||||||
tryNextLoadAction :: Creature -> Creature
|
tryNextLoadAction :: Creature -> Creature
|
||||||
tryNextLoadAction cr = case cr ^? crManipulation . manObject . inInventory of
|
tryNextLoadAction cr = case cr ^? crManipulation . manObject . inInventory of
|
||||||
Just (SelItem i _) -> case cr ^? crInv . ix i . itUse . heldConsumption . laProgress . _Just . ix 0 of
|
Just (SelItem i _) -> case cr ^? crInv . ix i . itUse . heldConsumption . laSource . _InternalSource . iaProgress . _Just . ix 0 of
|
||||||
Nothing -> cr & crManipulation . manObject . inInventory . iselAction .~ NoInvSelAction
|
Nothing -> cr & crManipulation . manObject . inInventory . iselAction .~ NoInvSelAction
|
||||||
Just la ->
|
Just la ->
|
||||||
cr & crManipulation . manObject . inInventory . iselAction . actionProgress .~ _actionTime la
|
cr & crManipulation . manObject . inInventory . iselAction . actionProgress .~ _actionTime la
|
||||||
& crManipulation . manObject . inInventory . iselAction . reloadAction .~ la
|
& crManipulation . manObject . inInventory . iselAction . reloadAction .~ la
|
||||||
_ -> cr
|
_ -> cr
|
||||||
|
|
||||||
crToggleReloading :: Creature -> Creature
|
crUpdateLoadSource :: Creature -> Creature
|
||||||
crToggleReloading cr = case cr ^? crManipulation . manObject . inInventory . iselAction of
|
crUpdateLoadSource cr = case cr ^? crManipulation . manObject . inInventory . iselAction of
|
||||||
Just ReloadAction{} -> cr & crManipulation . manObject . inInventory . iselAction .~ NoInvSelAction
|
Just NoInvSelAction -> cr & tryStartLoading
|
||||||
_ -> cr & tryStartLoading
|
_ -> cr & crManipulation . manObject . inInventory . iselAction .~ NoInvSelAction
|
||||||
|
|
||||||
tryStartLoading :: Creature -> Creature
|
tryStartLoading :: Creature -> Creature
|
||||||
tryStartLoading cr = fromMaybe cr $ do
|
tryStartLoading cr = fromMaybe cr $ do
|
||||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||||
hc <- cr ^? crInv . ix i . itUse . heldConsumption
|
ia <- cr ^? crInv . ix i . itUse . heldConsumption . laSource . _InternalSource
|
||||||
return $ startLoading hc cr
|
return $ startLoading ia cr
|
||||||
|
|
||||||
startLoading :: HeldConsumption -> Creature -> Creature
|
-- case as of
|
||||||
startLoading ic cr = case ic ^? laProgress . _Just . ix 0 of
|
-- InternalSource ia -> return $ startLoading ia cr
|
||||||
|
-- AboveSource -> return cr
|
||||||
|
|
||||||
|
startLoading :: InternalAmmo -> Creature -> Creature
|
||||||
|
startLoading ic cr = case ic ^? iaProgress . _Just . ix 0 of
|
||||||
Just la -> cr & startLoadingStep la
|
Just la -> cr & startLoadingStep la
|
||||||
Nothing -> case ic ^? laCycle of
|
Nothing -> case ic ^. iaCycle of
|
||||||
Nothing -> cr
|
[] -> error "item has empty load cycle"
|
||||||
Just [] -> error "item has empty load cycle"
|
_ | _iaLoaded ic >= _iaMax ic -> cr
|
||||||
Just _ | _laLoaded ic >= _laMax ic -> cr
|
(la : las) -> fromMaybe (error "item loading error") $ do
|
||||||
Just (la : las) -> fromMaybe (error "item loading error") $ do
|
|
||||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||||
return $ cr & startLoadingStep la
|
return $
|
||||||
& crInv . ix i . itUse . heldConsumption . laProgress ?~ (la : las)
|
cr & startLoadingStep la
|
||||||
|
& crInv . ix i . itUse . heldConsumption . laSource . _InternalSource . iaProgress ?~ (la : las)
|
||||||
|
|
||||||
startLoadingStep :: LoadAction -> Creature -> Creature
|
startLoadingStep :: LoadAction -> Creature -> Creature
|
||||||
startLoadingStep la cr = cr & crManipulation . manObject . inInventory . iselAction .~ ReloadAction (_actionTime la) la
|
startLoadingStep la cr = cr & crManipulation . manObject . inInventory . iselAction .~ ReloadAction (_actionTime la) la
|
||||||
|
|
||||||
rotateActionProgress :: HeldConsumption -> HeldConsumption
|
rotateActionProgress :: InternalAmmo -> InternalAmmo
|
||||||
rotateActionProgress ic = case ic ^? laProgress . _Just of
|
rotateActionProgress ic = case ic ^. iaProgress of
|
||||||
Just (_ : la : las) -> ic & laProgress . _Just .~ (la : las)
|
Just (_ : la : las) -> ic & iaProgress . _Just .~ (la : las)
|
||||||
_ | _laLoaded ic < _laMax ic -> ic & laProgress ?~ _laCycle ic
|
_ | _iaLoaded ic < _iaMax ic -> ic & iaProgress ?~ _iaCycle ic
|
||||||
_ -> ic & laProgress .~ Nothing
|
_ -> ic & iaProgress .~ Nothing
|
||||||
|
|
||||||
doLoadAction :: LoadAction -> HeldConsumption -> HeldConsumption
|
doLoadAction :: LoadAction -> InternalAmmo -> InternalAmmo
|
||||||
doLoadAction la ic = case la of
|
doLoadAction la ic = case la of
|
||||||
LoadEject{} -> ic & laLoaded .~ 0 & laPrimed .~ False
|
LoadEject{} -> ic & iaLoaded .~ 0 & iaPrimed .~ False
|
||||||
LoadInsert{} -> ic & laLoaded .~ _laMax ic
|
LoadInsert{} -> ic & iaLoaded .~ _iaMax ic
|
||||||
LoadAdd{_insertMax = x} ->
|
LoadAdd{_insertMax = x} ->
|
||||||
ic & laLoaded +~ min x (_laMax ic - _laLoaded ic)
|
ic & iaLoaded +~ min x (_iaMax ic - _iaLoaded ic)
|
||||||
LoadPrime{} -> ic & laPrimed .~ True
|
LoadPrime{} -> ic & iaPrimed .~ True
|
||||||
|
|
||||||
--{- | Start reloading if clip is empty. -}
|
--{- | Start reloading if clip is empty. -}
|
||||||
--crAutoReload :: Creature -> Creature
|
--crAutoReload :: Creature -> Creature
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ drawExamineInventory cfig mtweaki w =
|
|||||||
, _siIsSelectable = True
|
, _siIsSelectable = True
|
||||||
, _siColor = white
|
, _siColor = white
|
||||||
, _siOffX = 0
|
, _siOffX = 0
|
||||||
|
, _siOffY = 0
|
||||||
, _siPayload = ()
|
, _siPayload = ()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,12 +173,9 @@ drawRBOptions cfig w = fromMaybe mempty $ do
|
|||||||
examineInventoryExtra :: Maybe Int -> Configuration -> Picture
|
examineInventoryExtra :: Maybe Int -> Configuration -> Picture
|
||||||
examineInventoryExtra mtweaki cfig = fromMaybe mempty $ do
|
examineInventoryExtra mtweaki cfig = fromMaybe mempty $ do
|
||||||
tweaki <- mtweaki
|
tweaki <- mtweaki
|
||||||
-- consider moving this functionality out into a tweaks module
|
|
||||||
--tparam <- mitm ^? _Just . itTweaks . tweakParams . ix tweaki
|
|
||||||
return $
|
return $
|
||||||
toTopLeft cfig $
|
toTopLeft cfig $
|
||||||
translate subInvX (-71) $
|
translate subInvX (-71) $
|
||||||
--listCursorChooseBorderScale 0 1 [North,South,West] tweaki 0 white (length $ showTweak tparam) 1
|
|
||||||
listCursorChooseBorderScale 0 1 [North, South, West] tweaki 0 white 10 1
|
listCursorChooseBorderScale 0 1 [North, South, West] tweaki 0 white 10 1
|
||||||
|
|
||||||
combineInventoryExtra :: SelectionSections CombinableItem -> Configuration -> World -> Picture
|
combineInventoryExtra :: SelectionSections CombinableItem -> Configuration -> World -> Picture
|
||||||
@@ -217,7 +215,7 @@ displayTerminal tid cfig w = fromMaybe mempty $ do
|
|||||||
invHead cfig (_tmTitle tm ++ ":T" ++ show tid)
|
invHead cfig (_tmTitle tm ++ ":T" ++ show tid)
|
||||||
<> drawSelectionList secondColumnParams cfig (thesellist tm)
|
<> drawSelectionList secondColumnParams cfig (thesellist tm)
|
||||||
where
|
where
|
||||||
toselitm (str, col) = SelectionItem [str] 1 True col 0 ()
|
toselitm (str, col) = SelectionItem [str] 1 True col 0 0 ()
|
||||||
thesellist tm = defaultSelectionList & slItems .~ thelist tm
|
thesellist tm = defaultSelectionList & slItems .~ thelist tm
|
||||||
thelist tm =
|
thelist tm =
|
||||||
map toselitm . displayTermInput tm
|
map toselitm . displayTermInput tm
|
||||||
@@ -336,6 +334,7 @@ picsToSelectable pics =
|
|||||||
, _siIsSelectable = True
|
, _siIsSelectable = True
|
||||||
, _siColor = white
|
, _siColor = white
|
||||||
, _siOffX = 0
|
, _siOffX = 0
|
||||||
|
, _siOffY = 0
|
||||||
, _siPayload = ()
|
, _siPayload = ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ module Dodge.Render.List (
|
|||||||
listCursorChooseBorderScale,
|
listCursorChooseBorderScale,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Dodge.SelectionSections
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Base.Window
|
import Dodge.Base.Window
|
||||||
import Dodge.Data.CardinalPoint
|
import Dodge.Data.CardinalPoint
|
||||||
@@ -19,7 +20,6 @@ import Dodge.Data.Config
|
|||||||
import Dodge.Data.SelectionList
|
import Dodge.Data.SelectionList
|
||||||
import Dodge.ScreenPos
|
import Dodge.ScreenPos
|
||||||
import Dodge.SelectionList
|
import Dodge.SelectionList
|
||||||
import Dodge.SelectionSections
|
|
||||||
import Geometry
|
import Geometry
|
||||||
import LensHelp
|
import LensHelp
|
||||||
import ListHelp
|
import ListHelp
|
||||||
@@ -98,7 +98,7 @@ selSecDrawCursor xsize ldp sss = fromMaybe mempty $ do
|
|||||||
xint
|
xint
|
||||||
(_siColor si)
|
(_siColor si)
|
||||||
xsize
|
xsize
|
||||||
(length $ _siPictures si)
|
(_siHeight si)
|
||||||
|
|
||||||
-- displays a cursor that should match up to list text pictures
|
-- displays a cursor that should match up to list text pictures
|
||||||
listCursorChooseBorderScale ::
|
listCursorChooseBorderScale ::
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import RandomHelp
|
|||||||
roomsContaining :: RandomGen g => [Creature] -> [Item] -> State g (MetaTree Room String)
|
roomsContaining :: RandomGen g => [Creature] -> [Item] -> State g (MetaTree Room String)
|
||||||
roomsContaining crs its = tToBTree str <$> roomsContaining' crs its
|
roomsContaining crs its = tToBTree str <$> roomsContaining' crs its
|
||||||
where
|
where
|
||||||
str = "roomsContaining " ++ concatMap _crName crs ++ concatMap (head . itemDisplay) its
|
str = "roomsContaining " ++ concatMap _crName crs ++ concatMap (head . basicItemDisplay) its
|
||||||
|
|
||||||
roomsContaining' :: RandomGen g => [Creature] -> [Item] -> State g (Tree Room)
|
roomsContaining' :: RandomGen g => [Creature] -> [Item] -> State g (Tree Room)
|
||||||
roomsContaining' crs its = do
|
roomsContaining' crs its = do
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ selSecYint i j sss = do
|
|||||||
return . (secpos +)
|
return . (secpos +)
|
||||||
. subtract (ss ^. ssOffset)
|
. subtract (ss ^. ssOffset)
|
||||||
. sum
|
. sum
|
||||||
. fmap (length . _siPictures)
|
. fmap (_siHeight)
|
||||||
. fst
|
. fst
|
||||||
$ IM.split j (ss ^. ssItems)
|
$ IM.split j (ss ^. ssItems)
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ updateInitialPressInGame uv sc = case sc of
|
|||||||
ScancodeP -> pauseGame uv
|
ScancodeP -> pauseGame uv
|
||||||
ScancodeF -> over uvWorld youDropItem uv
|
ScancodeF -> over uvWorld youDropItem uv
|
||||||
ScancodeM -> toggleMap uv
|
ScancodeM -> toggleMap uv
|
||||||
ScancodeR -> over (uvWorld . cWorld . lWorld . creatures . ix 0) crToggleReloading uv
|
ScancodeR -> over (uvWorld . cWorld . lWorld . creatures . ix 0) crUpdateLoadSource uv
|
||||||
ScancodeT -> over uvWorld testEvent uv
|
ScancodeT -> over uvWorld testEvent uv
|
||||||
ScancodeX -> uv & uvWorld %~ toggleTweakInv
|
ScancodeX -> uv & uvWorld %~ toggleTweakInv
|
||||||
ScancodeC -> toggleCombineInv uv
|
ScancodeC -> toggleCombineInv uv
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import SDL
|
|||||||
updateUseInputOnScreen :: ScreenLayer -> Universe -> Universe
|
updateUseInputOnScreen :: ScreenLayer -> Universe -> Universe
|
||||||
updateUseInputOnScreen sl = case sl of
|
updateUseInputOnScreen sl = case sl of
|
||||||
InputScreen{} -> doInputScreenInput (sl ^. scInput)
|
InputScreen{} -> doInputScreenInput (sl ^. scInput)
|
||||||
_ -> optionScreenUpdate sl
|
_ -> optionScreenUpdate
|
||||||
|
|
||||||
doInputScreenInput :: String -> Universe -> Universe
|
doInputScreenInput :: String -> Universe -> Universe
|
||||||
doInputScreenInput s u =
|
doInputScreenInput s u =
|
||||||
@@ -35,38 +35,28 @@ doInputScreenInput s u =
|
|||||||
| ispressed ScancodeEscape = uvScreenLayers %~ tail
|
| ispressed ScancodeEscape = uvScreenLayers %~ tail
|
||||||
| otherwise = id
|
| otherwise = id
|
||||||
|
|
||||||
optionScreenUpdate ::
|
optionScreenUpdate :: Universe -> Universe
|
||||||
ScreenLayer ->
|
optionScreenUpdate u =
|
||||||
Universe ->
|
|
||||||
Universe
|
|
||||||
optionScreenUpdate screen u =
|
|
||||||
(uvScreenLayers . ix 0 . scDisplayTime +~ 1)
|
(uvScreenLayers . ix 0 . scDisplayTime +~ 1)
|
||||||
. refreshOptionsSelectionList
|
. refreshOptionsSelectionList
|
||||||
. optionScreenDefaultEffect mop
|
. mouseOverSelectionList
|
||||||
. mouseClickOptionsList screen
|
. optionScreenDefaultEffect
|
||||||
. mouseOverSelectionList ldps screen
|
. mouseClickOptionsList
|
||||||
. menuWheelEvents
|
. menuWheelEvents
|
||||||
. over (uvScreenLayers . _head) (setSelectionListRestriction (u ^. uvConfig))
|
. over (uvScreenLayers . _head) (setSelectionListRestriction (u ^. uvConfig))
|
||||||
$ u
|
$ u
|
||||||
where
|
|
||||||
mop = _scPositionedMenuOption screen
|
|
||||||
ldps = _scListDisplayParams screen
|
|
||||||
|
|
||||||
optionScreenDefaultEffect :: EscapeMenuOption -> Universe -> Universe
|
optionScreenDefaultEffect :: Universe -> Universe
|
||||||
optionScreenDefaultEffect f u =
|
optionScreenDefaultEffect u = fromMaybe u $ do
|
||||||
fromMaybe
|
f <- u ^? uvScreenLayers . ix 0 . scPositionedMenuOption
|
||||||
id
|
ptype <- u ^. uvWorld . input . pressedKeys . at ScancodeEscape
|
||||||
( do
|
guard $ ptype == InitialPress
|
||||||
ptype <- u ^. uvWorld . input . pressedKeys . at ScancodeEscape
|
(f ^? emoMenuOption . moEff) <*> return u
|
||||||
guard $ ptype == InitialPress
|
|
||||||
f ^? emoMenuOption . moEff
|
|
||||||
)
|
|
||||||
u
|
|
||||||
|
|
||||||
-- ouch this is not good
|
-- ouch this is not good
|
||||||
mouseClickOptionsList :: ScreenLayer -> Universe -> Universe
|
mouseClickOptionsList :: Universe -> Universe
|
||||||
mouseClickOptionsList screen u = fromMaybe u $ do
|
mouseClickOptionsList u = fromMaybe u $ do
|
||||||
sl <- screen ^? scSelectionList
|
sl <- u ^? uvScreenLayers . ix 0 . scSelectionList
|
||||||
Just $ case u ^. uvWorld . input . mouseButtons . at ButtonLeft of
|
Just $ case u ^. uvWorld . input . mouseButtons . at ButtonLeft of
|
||||||
Just 0 -> fromMaybe u $ do
|
Just 0 -> fromMaybe u $ do
|
||||||
i <- sl ^. slSelPos
|
i <- sl ^. slSelPos
|
||||||
@@ -79,8 +69,11 @@ mouseClickOptionsList screen u = fromMaybe u $ do
|
|||||||
return $ f u
|
return $ f u
|
||||||
_ -> u
|
_ -> u
|
||||||
|
|
||||||
mouseOverSelectionList :: ListDisplayParams -> ScreenLayer -> Universe -> Universe
|
mouseOverSelectionList :: Universe -> Universe
|
||||||
mouseOverSelectionList ldps screen u = fromMaybe u $ do
|
mouseOverSelectionList u = fromMaybe u $ do
|
||||||
|
screen <- u ^? uvScreenLayers . ix 0
|
||||||
|
ldps <- screen ^? scListDisplayParams
|
||||||
|
let ymax = maybe 0 length $ screen ^? scSelectionList . slItems
|
||||||
yi <- ldpVerticalSelection (u ^. uvConfig) ldps (u ^. uvWorld . input . mousePos)
|
yi <- ldpVerticalSelection (u ^. uvConfig) ldps (u ^. uvWorld . input . mousePos)
|
||||||
guard $ mmoving || (_scDisplayTime screen <= 1)
|
guard $ mmoving || (_scDisplayTime screen <= 1)
|
||||||
let myi = do
|
let myi = do
|
||||||
@@ -91,7 +84,6 @@ mouseOverSelectionList ldps screen u = fromMaybe u $ do
|
|||||||
isselectable yi =
|
isselectable yi =
|
||||||
fromMaybe False $
|
fromMaybe False $
|
||||||
u ^? uvScreenLayers . _head . scSelectionList . slItems . ix yi . siIsSelectable
|
u ^? uvScreenLayers . _head . scSelectionList . slItems . ix yi . siIsSelectable
|
||||||
ymax = maybe 0 length $ screen ^? scSelectionList . slItems
|
|
||||||
mmoving = u ^. uvWorld . input . mouseMoving
|
mmoving = u ^. uvWorld . input . mouseMoving
|
||||||
|
|
||||||
ldpVerticalSelection :: Configuration -> ListDisplayParams -> Point2 -> Maybe Int
|
ldpVerticalSelection :: Configuration -> ListDisplayParams -> Point2 -> Maybe Int
|
||||||
|
|||||||
@@ -103,8 +103,8 @@ terminalWheelEvent yi tmid w
|
|||||||
|
|
||||||
scrollRBOption :: Int -> Int -> Int -> Int
|
scrollRBOption :: Int -> Int -> Int -> Int
|
||||||
scrollRBOption dy ymax
|
scrollRBOption dy ymax
|
||||||
| dy < 0 = (min (ymax -1) . subtract dy)
|
| dy < 0 = min (ymax -1) . subtract dy
|
||||||
| dy > 0 = (max 0 . subtract dy)
|
| dy > 0 = max 0 . subtract dy
|
||||||
| otherwise = id
|
| otherwise = id
|
||||||
|
|
||||||
moveTweakSel :: Int -> World -> World
|
moveTweakSel :: Int -> World -> World
|
||||||
|
|||||||
+3
-1
@@ -329,7 +329,9 @@ stringToList gap = concatMap (uncurry charToTuple) . zip [0, 100 + gap ..]
|
|||||||
|
|
||||||
charToTuple :: Float -> Char -> [(Point3, Point4, Point3)]
|
charToTuple :: Float -> Char -> [(Point3, Point4, Point3)]
|
||||||
{-# INLINE charToTuple #-}
|
{-# INLINE charToTuple #-}
|
||||||
charToTuple xoff c = [f 0 0, f 1 0, f 1 1, f 0 0, f 1 1, f 0 1]
|
charToTuple xoff c
|
||||||
|
| fromEnum c == 32 = [] -- don't draw space characters
|
||||||
|
| otherwise = [f 0 0, f 1 0, f 1 1, f 0 0, f 1 1, f 0 1]
|
||||||
where
|
where
|
||||||
f x y = (V3 (xoff + x * 100) (y * 200) 0, white, V3 x (1 - y) charnum)
|
f x y = (V3 (xoff + x * 100) (y * 200) 0, white, V3 x (1 - y) charnum)
|
||||||
-- textures in opengl have origins at the lower left, my char array has its
|
-- textures in opengl have origins at the lower left, my char array has its
|
||||||
|
|||||||
Reference in New Issue
Block a user