Remove (by commenting out) module item-type system

This commit is contained in:
2024-09-30 11:42:10 +01:00
parent 4545caa7e6
commit 0701c4043e
37 changed files with 877 additions and 696 deletions
+115 -1
View File
@@ -1 +1,115 @@
All good (616 modules, at 21:51:07)
/home/justin/Haskell/loop/src/Dodge/Combine.hs:6:1-19: warning: [-Wunused-imports]
The import of Control.Lens is redundant
|
6 | import Control.Lens
| ^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Combine.hs:7:1-20: warning: [-Wunused-imports]
The import of Control.Monad is redundant
|
7 | import Control.Monad
| ^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Combine.hs:11:1-28: warning: [-Wunused-imports]
The import of Data.Map.Merge.Strict is redundant
|
11 | import Data.Map.Merge.Strict
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Combine.hs:13:1-17: warning: [-Wunused-imports]
The import of Data.Maybe is redundant
|
13 | import Data.Maybe
| ^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Combine.hs:21:1-19: warning: [-Wunused-imports]
The import of Dodge.Module is redundant
|
21 | import Dodge.Module
| ^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Combine.hs:64:5-7: warning: [-Wunused-matches]
Defined but not used: inv
|
64 | cmm inv (is, itm) = (is, ([], itm))
| ^^^
/home/justin/Haskell/loop/src/Dodge/Item/Display.hs:16:1-19: warning: [-Wunused-imports]
The import of Dodge.Module is redundant
|
16 | import Dodge.Module
| ^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Item/SlotsTaken.hs:7:1-19: warning: [-Wunused-imports]
The import of Dodge.Module is redundant
|
7 | import Dodge.Module
| ^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Module.hs:7:1-37: warning: [-Wunused-imports]
The qualified import of Data.Map.Strict is redundant
|
7 | import qualified Data.Map.Strict as M
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Module.hs:8:1-22: warning: [-Wunused-imports]
The import of Dodge.Data.Item is redundant
|
8 | import Dodge.Data.Item
| ^^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Module.hs:9:1-24: warning: [-Wunused-imports]
The import of Dodge.Module.Info is redundant
|
9 | import Dodge.Module.Info
| ^^^^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Combine/Combinations.hs:226:1-15: warning: [-Wunused-top-binds]
Defined but not used: homingLaunchers
|
226 | homingLaunchers = launcher : [launcherX i | i <- [2 .. 10]]
| ^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Combine/Combinations.hs:241:1-15: warning: [-Wunused-top-binds]
Defined but not used: bulletMagazines
|
241 | bulletMagazines =
| ^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Item/Held/BatteryGuns.hs:9:1-37: warning: [-Wunused-imports]
The qualified import of Data.Map.Strict is redundant
|
9 | import qualified Data.Map.Strict as M
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Item/Info.hs:4:1-37: warning: [-Wunused-imports]
The qualified import of Data.Map.Strict is redundant
|
4 | import qualified Data.Map.Strict as M
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Item/Draw/SPic.hs:8:1-37: warning: [-Wunused-imports]
The qualified import of Data.Map.Strict is redundant
|
8 | import qualified Data.Map.Strict as M
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Combine/Module.hs:3:1-20: warning: [-Wunused-imports]
The import of Data.Foldable is redundant
|
3 | import Data.Foldable
| ^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Combine/Module.hs:4:1-22: warning: [-Wunused-imports]
The import of Dodge.Data.Beam is redundant
|
4 | import Dodge.Data.Beam
| ^^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Combine/Module.hs:5:1-22: warning: [-Wunused-imports]
The import of Dodge.Data.Item is redundant
|
5 | import Dodge.Data.Item
| ^^^^^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Combine/Module.hs:6:1-18: warning: [-Wunused-imports]
The import of Dodge.Tesla is redundant
|
6 | import Dodge.Tesla
| ^^^^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Combine/Module.hs:7:1-15: warning: [-Wunused-imports]
The import of Geometry is redundant
|
7 | import Geometry
| ^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Combine/Module.hs:8:1-15: warning: [-Wunused-imports]
The import of LensHelp is redundant
|
8 | import LensHelp
| ^^^^^^^^^^^^^^^
/home/justin/Haskell/loop/src/Dodge/Data/Item/Combine.hs:12:1-37: warning: [-Wunused-imports]
The qualified import of Data.Map.Strict is redundant
|
12 | import qualified Data.Map.Strict as M
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+1 -1
View File
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -39,7 +39,7 @@ mvBullet x w bu
$ applyMagnetsToBul bu w
where
endspawn = fromMaybe id $ do
partspawn <- bulletSpawn bu
partspawn <- useBulletPayload bu
return $ partspawn p
p = _buPos bu
@@ -102,8 +102,8 @@ bounceDir (_, Right wl) | _wlBouncy wl = Just $ uncurry (-.-) (_wlLine wl)
bounceDir (p, Left cr) | crIsArmouredFrom p cr = Just $ vNormal $ p -.- _crPos cr
bounceDir _ = Nothing
bulletSpawn :: Bullet -> Maybe (Point2 -> World -> World)
bulletSpawn bu = case _buSpawn bu of
useBulletPayload :: Bullet -> Maybe (Point2 -> World -> World)
useBulletPayload bu = case _buPayload bu of
BulSpark -> Nothing
BulFlak -> Just (makeFlak bu)
BulFrag -> Just makeFragBullets
@@ -135,7 +135,7 @@ makeFlak bu _ w = w & cWorld . lWorld . instantBullets .++~ [f x | x <- xs]
xs = take 5 $ randomRs (-s,s) $ _randGen w
f x = bu & buVel %~ g x
& buTimer .~ 97
& buSpawn .~ BulSpark
& buPayload .~ BulSpark
& buWidth .~ 0.5
& buDamages .~
[ Damage PIERCING 25 0 0 0 $ PushBackDamage 2
+29 -26
View File
@@ -61,34 +61,37 @@ combineListInfo w = filter f . map (cmm inv) $ combineItemListYouX w
f (is, (_, itm)) = _itType itm `notElem` fmap _itType (IM.restrictKeys inv (IS.fromList is))
cmm :: IM.IntMap Item -> ([Int], Item) -> ([Int], ([String], Item))
cmm inv (is, itm) = (is, itm & itType . iyModules %%~ flip combineModuleMaps mms)
where
mms = map (_iyModules . _itType . (inv IM.!)) is
cmm inv (is, itm) = (is, ([], itm))
combineModuleMaps ::
M.Map ModuleSlot ItemModuleType ->
[M.Map ModuleSlot ItemModuleType] ->
([String], M.Map ModuleSlot ItemModuleType)
combineModuleMaps = foldM combineTwoModuleMaps
--cmm :: IM.IntMap Item -> ([Int], Item) -> ([Int], ([String], Item))
--cmm inv (is, itm) = (is, itm & itType . iyModules %%~ flip combineModuleMaps mms)
-- where
-- mms = map (_iyModules . _itType . (inv IM.!)) is
combineTwoModuleMaps ::
M.Map ModuleSlot ItemModuleType ->
M.Map ModuleSlot ItemModuleType ->
([String], M.Map ModuleSlot ItemModuleType)
combineTwoModuleMaps =
mergeA
preserveMissing
(filterAMissing f)
(zipWithAMatched g)
where
f _ EMPTYMODULE = ([], False)
f _ md = ([rm "REMOVES" md], False)
g _ EMPTYMODULE md = ([], md)
g _ md EMPTYMODULE = ([], md)
g _ md2 md1 = ([rm "REPLACES" md1 ++ rm " WITH" md2], md2)
rm str md = str ++ " " ++ fullModuleName md
--combineModuleMaps ::
-- M.Map ModuleSlot ItemModuleType ->
-- [M.Map ModuleSlot ItemModuleType] ->
-- ([String], M.Map ModuleSlot ItemModuleType)
--combineModuleMaps = foldM combineTwoModuleMaps
--combineTwoModuleMaps ::
-- M.Map ModuleSlot ItemModuleType ->
-- M.Map ModuleSlot ItemModuleType ->
-- ([String], M.Map ModuleSlot ItemModuleType)
--combineTwoModuleMaps =
-- mergeA
-- preserveMissing
-- (filterAMissing f)
-- (zipWithAMatched g)
-- where
-- f _ EMPTYMODULE = ([], False)
-- f _ md = ([rm "REMOVES" md], False)
-- g _ EMPTYMODULE md = ([], md)
-- g _ md EMPTYMODULE = ([], md)
-- g _ md2 md1 = ([rm "REPLACES" md1 ++ rm " WITH" md2], md2)
-- rm str md = str ++ " " ++ fullModuleName md
-- g above could be a monoid of some description...
fullModuleName :: ItemModuleType -> String
fullModuleName = fromMaybe "EMPTYMODULE" . moduleName
--fullModuleName :: ItemModuleType -> String
--fullModuleName = fromMaybe "EMPTYMODULE" . moduleName
+91 -91
View File
@@ -116,11 +116,11 @@ itemCombinations =
++ map (\i -> po [hd (VOLLEYGUN i), HELD (BANGSTICK 1)] $ volleyGun (i + 1)) [3 .. 5]
++ map (\i -> po [hd (MINIGUNX i), HELD (BANGSTICK 1)] $ miniGunX (i + 1)) [3 .. 15]
++ map (\i -> po [hd (GRAPECANNON i), cr STEELDRUM] $ grapeCannon (i + 1)) [1, 2, 3]
++ [ po (_iyBase (_itType it) : mtype) $ it & itType . iyModules . ix modtype .~ m
| (modtype, is, ms) <- moduleCombinations
, it <- is
, (mtype, m) <- ms
]
-- ++ [ po (_iyBase (_itType it) : mtype) $ it & itType . iyModules . ix modtype .~ m
-- | (modtype, is, ms) <- moduleCombinations
-- , it <- is
-- , (mtype, m) <- ms
-- ]
where
p = (,)
po xs it = (map o xs, it)
@@ -132,95 +132,95 @@ itemCombinations =
-- so there are two requirements for a module combination: the module slot must
-- exist on the item, and the item must be in the given list below
-- these two requirements should probably be combined
moduleCombinations :: [(ModuleSlot, [Item], [([ItemBaseType], ItemModuleType)])]
moduleCombinations =
[
( ModHeldAttach
,
[ rifle
, autoRifle
, burstRifle
]
,
[ amod [cr TAPE, HELD TORCH] ATTACHTORCH
]
)
,
( ModAutoMag
,
[ autoRifle
, autoPistol
, smg
]
,
[ amod [cr MAGNET, cr HARDWARE] MAGNETMAG
]
)
,
( ModBulletCollision
, bulletWeapons
,
[ amod [cr (BULBODYCRAFT be)] (BULBODY be) | be <- [minBound..]
]
)
,
( ModBulletPayload
, bulletMagazines
,
[ amod [cr (ENERGYBALLCRAFT x)] (BULPAY (BulBall x)) | x <- [minBound ..]
] ++
[ amod [cr GASINJECTOR] (BULPAY BulGas)
, amod [cr FRAGCRAFT] (BULPAY BulFrag)
, amod [cr FLAKCRAFT] (BULPAY BulFlak)
]
)
,
( ModTarget
, homingLaunchers ++ bulletWeapons
,
[ amod [cr MICROCHIP, cr HEATSENSOR] (TARGET TargetRBCreature)
, amod [cr MICROCHIP, cr LIGHTSENSOR] (TARGET TARGETLASER)
, amod [cr MICROCHIP, cr SOUNDSENSOR] (TARGET TargetRBPress)
]
)
,
( ModBulletTrajectory
, bulletWeapons
,
[ amod [cr MAGNET, cr MICROCHIP, cr HARDWARE] (BULTRAJ MagnetTrajectoryType)
, amod [cr MICROCHIP, cr HARDWARE] (BULTRAJ FlechetteTrajectoryType)
, amod [cr ANTIMATTER, cr HARDWARE] (BULTRAJ BezierTrajectoryType)
]
)
,
( ModDualBeam
,[]
-- , [dualBeam]
,
[ amod [cr (ENERGYBALLCRAFT IncBall)] INCENDLAS
, amod [cr TRANSFORMER] SPLITLAS
, amod [cr (ENERGYBALLCRAFT TeslaBall)] STATICLAS
]
)
-- ,
-- ( ModTeleport
-- , teleportableWeapons
--moduleCombinations :: [(ModuleSlot, [Item], [([ItemBaseType], ItemModuleType)])]
--moduleCombinations =
-- [
-- ( ModHeldAttach
-- ,
-- [ amod [cr TELEPORTMODULE, cr MICROCHIP] WEPTELE
-- [ rifle
-- , autoRifle
-- , burstRifle
-- ]
-- ,
-- [ amod [cr TAPE, HELD TORCH] ATTACHTORCH
-- ]
-- )
,
( ModLauncherHoming
, homingLaunchers
,
[ amod [cr MICROCHIP, cr TRANSMITTER] LAUNCHHOME
]
)
]
where
amod = (,)
cr = CRAFT
-- ,
-- ( ModAutoMag
-- ,
-- [ autoRifle
-- , autoPistol
-- , smg
-- ]
-- ,
-- [ amod [cr MAGNET, cr HARDWARE] MAGNETMAG
-- ]
-- )
-- ,
-- ( ModBulletCollision
-- , bulletWeapons
-- ,
-- [ amod [cr (BULBODYCRAFT be)] (BULBODY be) | be <- [minBound..]
-- ]
-- )
-- ,
-- ( ModBulletPayload
-- , bulletMagazines
-- ,
-- [ amod [cr (ENERGYBALLCRAFT x)] (BULPAY (BulBall x)) | x <- [minBound ..]
-- ] ++
-- [ amod [cr GASINJECTOR] (BULPAY BulGas)
-- , amod [cr FRAGCRAFT] (BULPAY BulFrag)
-- , amod [cr FLAKCRAFT] (BULPAY BulFlak)
-- ]
-- )
-- ,
-- ( ModTarget
-- , homingLaunchers ++ bulletWeapons
-- ,
-- [ amod [cr MICROCHIP, cr HEATSENSOR] (TARGET TargetRBCreature)
-- , amod [cr MICROCHIP, cr LIGHTSENSOR] (TARGET TARGETLASER)
-- , amod [cr MICROCHIP, cr SOUNDSENSOR] (TARGET TargetRBPress)
-- ]
-- )
-- ,
-- ( ModBulletTrajectory
-- , bulletWeapons
-- ,
-- [ amod [cr MAGNET, cr MICROCHIP, cr HARDWARE] (BULTRAJ MagnetTrajectoryType)
-- , amod [cr MICROCHIP, cr HARDWARE] (BULTRAJ FlechetteTrajectoryType)
-- , amod [cr ANTIMATTER, cr HARDWARE] (BULTRAJ BezierTrajectoryType)
-- ]
-- )
-- ,
-- ( ModDualBeam
-- ,[]
---- , [dualBeam]
-- ,
-- [ amod [cr (ENERGYBALLCRAFT IncBall)] INCENDLAS
-- , amod [cr TRANSFORMER] SPLITLAS
-- , amod [cr (ENERGYBALLCRAFT TeslaBall)] STATICLAS
-- ]
-- )
---- ,
---- ( ModTeleport
---- , teleportableWeapons
---- ,
---- [ amod [cr TELEPORTMODULE, cr MICROCHIP] WEPTELE
---- ]
---- )
-- ,
-- ( ModLauncherHoming
-- , homingLaunchers
-- ,
-- [ amod [cr MICROCHIP, cr TRANSMITTER] LAUNCHHOME
-- ]
-- )
--
-- ]
-- where
-- amod = (,)
-- cr = CRAFT
homingLaunchers :: [Item]
homingLaunchers = launcher : [launcherX i | i <- [2 .. 10]]
+36 -36
View File
@@ -7,40 +7,40 @@ import Dodge.Tesla
import Geometry
import LensHelp
moduleModification :: ItemModuleType -> Item -> Item
moduleModification imt = case imt of
EMPTYMODULE -> id
-- BELTMAG -> itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 150
MAGNETMAG -> itUse . heldDelay . rateMax .~ 4
BULPAY BulFlak -> (itUse . amagParams . ampBullet . buSpawn .~ BulFlak)
. (itUse . amagParams . ampBullet . buTimer .~ 3)
BULPAY thepayload -> itUse . amagParams . ampBullet . buSpawn .~ thepayload
BULBODY thebody -> itUse . amagParams . ampBullet . buEffect .~ thebody
TARGET {} -> id -- itUse . useTargeting ?~ t
BULTRAJ BasicBulletTrajectoryType -> id
BULTRAJ MagnetTrajectoryType ->
(itUse . amagParams . ampBullet . buTrajectory .~ MagnetTrajectory 0)
. (itUse . amagParams . ampBullet . buVel .~ V2 10 0)
BULTRAJ FlechetteTrajectoryType ->
itUse . amagParams . ampBullet . buTrajectory .~ FlechetteTrajectory 0
BULTRAJ BezierTrajectoryType ->
itUse . amagParams . ampBullet . buTrajectory .~ BezierTrajectory 0 0 0
INCENDLAS -> itParams . lasBeam .~ BeamCombine FlameBeamCombine
SPLITLAS -> itParams . lasBeam .~ BeamCombine SplitBeamCombine
STATICLAS ->
(itParams . lasBeam .~ BeamCombine TeslaBeamCombine)
. (itParams . subParams ?~ teslaParams)
-- WEPTELE -> makeDirectedTele
--LAUNCHHOME -> itUse . heldConsumption . laAmmoType . amPjCreation .~ CreateTrackingShell
LAUNCHHOME -> id
ATTACHTORCH -> id
-- where
-- makeDirectedTele it =
-- it
-- & itUse . heldMods %~ ModWithDirectedTeleport -- .:~ withPosDirWallCheck directedTelPos
-- -- for the camera: the simplest option is to remove all zoom/offset
-- & itUse . heldAim . aimZoom . izFac .~ 1
-- & itUse . heldAim . aimRange .~ 0
--moduleModification :: ItemModuleType -> Item -> Item
--moduleModification imt = case imt of
-- EMPTYMODULE -> id
---- BELTMAG -> itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 150
-- MAGNETMAG -> itUse . heldDelay . rateMax .~ 4
-- BULPAY BulFlak -> (itUse . amagParams . ampBullet . buPayload .~ BulFlak)
-- . (itUse . amagParams . ampBullet . buTimer .~ 3)
-- BULPAY thepayload -> itUse . amagParams . ampBullet . buPayload .~ thepayload
-- BULBODY thebody -> itUse . amagParams . ampBullet . buEffect .~ thebody
-- TARGET {} -> id -- itUse . useTargeting ?~ t
-- BULTRAJ BasicBulletTrajectoryType -> id
-- BULTRAJ MagnetTrajectoryType ->
-- (itUse . amagParams . ampBullet . buTrajectory .~ MagnetTrajectory 0)
-- . (itUse . amagParams . ampBullet . buVel .~ V2 10 0)
-- BULTRAJ FlechetteTrajectoryType ->
-- itUse . amagParams . ampBullet . buTrajectory .~ FlechetteTrajectory 0
-- BULTRAJ BezierTrajectoryType ->
-- itUse . amagParams . ampBullet . buTrajectory .~ BezierTrajectory 0 0 0
-- INCENDLAS -> itParams . lasBeam .~ BeamCombine FlameBeamCombine
-- SPLITLAS -> itParams . lasBeam .~ BeamCombine SplitBeamCombine
-- STATICLAS ->
-- (itParams . lasBeam .~ BeamCombine TeslaBeamCombine)
-- . (itParams . subParams ?~ teslaParams)
---- WEPTELE -> makeDirectedTele
-- --LAUNCHHOME -> itUse . heldConsumption . laAmmoType . amPjCreation .~ CreateTrackingShell
-- LAUNCHHOME -> id
-- ATTACHTORCH -> id
---- where
---- makeDirectedTele it =
---- it
---- & itUse . heldMods %~ ModWithDirectedTeleport -- .:~ withPosDirWallCheck directedTelPos
---- -- for the camera: the simplest option is to remove all zoom/offset
---- & itUse . heldAim . aimZoom . izFac .~ 1
---- & itUse . heldAim . aimRange .~ 0
-- a better option would be to involve a "scope" centered on the firing
-- position
@@ -49,5 +49,5 @@ moduleModification imt = case imt of
-- p = fromMaybe (_crPos cr) $ it ^? itTargeting . tgPos . _Just
-- a = argV (mouseWorldPos w -.- p)
applyModules :: Item -> Item
applyModules it = foldl' (flip moduleModification) it (it ^. itType . iyModules)
--applyModules :: Item -> Item
--applyModules it = foldl' (flip moduleModification) it (it ^. itType . iyModules)
+4 -1
View File
@@ -251,10 +251,13 @@ inventoryX c = case c of
'V' ->
[targetingScope tt | tt <- [minBound .. maxBound]]
<>
[ autoRifle
[ augmentedHUD
, autoRifle
, megaTinMag 10200
] <>
[bulletTargetingModule btt | btt <- [minBound .. maxBound]]
<> [bulletModule (BulletModPayload (BulBall x)) | x <- [minBound .. maxBound]]
<> [bulletModule (BulletModEffect x) | x <- [minBound .. maxBound]]
_ -> []
testInventory :: [Item]
+1 -1
View File
@@ -44,7 +44,7 @@ itemUseEffect cr it w = case it ^. ldtValue . itUse of
TargetingUse {} -> w
AmmoMagUse{} -> w
ScopeUse{} -> w
BulletTrajectoryUse{} -> w
BulletModUse{} -> w
where
itm = it ^. ldtValue
doequipmentchange = fromMaybe w $ do
+2 -1
View File
@@ -9,6 +9,7 @@ module Dodge.Creature.Picture (
deadFeet,
) where
import Dodge.Item.Grammar
import Shape
import Control.Lens
import Dodge.Creature.HandPos (translateToLeftHand, translateToRightHand)
@@ -172,4 +173,4 @@ shoulderSH = translateSHz 20
drawEquipment :: Creature -> SPic
{-# INLINE drawEquipment #-}
drawEquipment cr = foldMap (itemEquipPict cr) (_crInv cr)
drawEquipment cr = foldMap (itemEquipPict cr) (invLDT $ _crInv cr)
+4 -4
View File
@@ -17,7 +17,7 @@ import Geometry.Data
data Bullet = Bullet
{ _buDelayFraction :: Float
, _buEffect :: BulletEffect
, _buSpawn :: BulletSpawn
, _buPayload :: BulletPayload
, _buTrajectory :: BulletTrajectory
, _buVel :: Point2
, _buDrag :: Float
@@ -39,7 +39,7 @@ data BulletEffect
| PenetrateBullet
deriving (Eq, Ord, Show, Enum, Bounded, Read) --Generic, Flat)
data BulletSpawn
data BulletPayload
= BulBall {_spawnEBT :: EnergyBallType}
| BulSpark
| BulFlak
@@ -62,10 +62,10 @@ data BulletTrajectoryType
deriving (Show, Eq, Ord, Read, Enum, Bounded) --Generic, Flat)
makeLenses ''Bullet
makeLenses ''BulletSpawn
makeLenses ''BulletPayload
deriveJSON defaultOptions ''EnergyBallType
deriveJSON defaultOptions ''BulletEffect
deriveJSON defaultOptions ''BulletSpawn
deriveJSON defaultOptions ''BulletPayload
deriveJSON defaultOptions ''BulletTrajectory
deriveJSON defaultOptions ''BulletTrajectoryType
deriveJSON defaultOptions ''Bullet
+6
View File
@@ -16,20 +16,26 @@ data ComposeLinkType
= AmmoInLink Int AmmoType
| AmmoModLink
| AmmoTargetingLink
| AmmoPayloadLink
| AmmoEffectLink
| WeaponScopeLink
| WeaponTargetingLink
| RemoteScreenLink
| AugmentedHUDLink
deriving (Eq,Ord,Show,Read)
data ItemStructuralFunction
= WeaponPlatformSF
| WeaponScopeSF
| WeaponTargetingSF
| AugmentedHUDSF
| AmmoMagSF AmmoType
| RemoteScreenSF
| UncomposableIsolateSF
| AmmoModifierSF AmmoType
| AmmoTargetingSF AmmoType
| AmmoPayloadSF AmmoType
| AmmoEffectSF AmmoType
deriving (Eq,Ord,Show,Read)
type PartiallyComposedItem = (Item, ItemStructuralFunction, LinkTest)
+20 -18
View File
@@ -5,6 +5,7 @@
module Dodge.Data.Item.Combine where
import Dodge.Data.Item.BulletMod
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
@@ -15,7 +16,7 @@ import Dodge.Data.Item.Use.Consumption
data ItemType = ItemType
{ _iyBase :: ItemBaseType
, _iyModules :: M.Map ModuleSlot ItemModuleType
-- , _iyModules :: M.Map ModuleSlot ItemModuleType
}
deriving (Eq, Ord, Show, Read)
@@ -91,7 +92,7 @@ data ItemBaseType
| ATTACH {_ibtAttach :: AttachType}
| AMMOMAG {_ibtAmmoMag :: AmmoMagType}
| TARGETING {_ibtTargeting :: TargetingType}
| HOMING {_ibtHoming :: BulletTrajectoryType}
| BULLETMOD {_ibtBulletMod :: BulletMod}
deriving (Eq, Ord, Show, Read)
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
@@ -101,6 +102,7 @@ data AttachType
| BULLETSYNTHESIZER
| REMOTESCREEN
| HOMINGMODULE
| AUGMENTEDHUD
-- | FLETCHINGMODULE
-- | BULPAYLOADATTACH
-- | BULTRAJECTORYATTACH
@@ -204,20 +206,20 @@ data HeldItemType
| KEYCARD Int
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data ItemModuleType
= EMPTYMODULE
| MAGNETMAG
| BULPAY BulletSpawn
| BULBODY BulletEffect
| BULTRAJ {_imtBulletTrajectoryType :: BulletTrajectoryType}
| TARGET {_imtTargetType :: TargetingType}
| INCENDLAS
| SPLITLAS
| STATICLAS
-- | WEPTELE
| LAUNCHHOME
| ATTACHTORCH
deriving (Eq, Ord, Show, Read) --Generic, Flat)
--data ItemModuleType
-- = EMPTYMODULE
-- | MAGNETMAG
-- | BULPAY BulletPayload
-- | BULBODY BulletEffect
-- | BULTRAJ {_imtBulletTrajectoryType :: BulletTrajectoryType}
-- | TARGET {_imtTargetType :: TargetingType}
-- | INCENDLAS
-- | SPLITLAS
-- | STATICLAS
---- | WEPTELE
-- | LAUNCHHOME
-- | ATTACHTORCH
-- deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Detector
= ITEMDETECTOR
@@ -242,7 +244,7 @@ data ModuleSlot
makeLenses ''ItemType
makeLenses ''ItemBaseType
makeLenses ''HeldItemType
makeLenses ''ItemModuleType
--makeLenses ''ItemModuleType
makeLenses ''AttachType
deriveJSON defaultOptions ''Stack
deriveJSON defaultOptions ''CraftType
@@ -253,7 +255,7 @@ deriveJSON defaultOptions ''Detector
deriveJSON defaultOptions ''EquipItemType
deriveJSON defaultOptions ''LeftItemType
deriveJSON defaultOptions ''HeldItemType
deriveJSON defaultOptions ''ItemModuleType
--deriveJSON defaultOptions ''ItemModuleType
deriveJSON defaultOptions ''ModuleSlot
deriveJSON defaultOptions ''ItemBaseType
deriveJSON defaultOptions ''ItemType
+5 -3
View File
@@ -12,9 +12,11 @@ module Dodge.Data.Item.Use (
module Dodge.Data.Hammer,
module Dodge.Data.Item.Targeting,
module Dodge.Data.GenFloat,
module Dodge.Data.Item.Scope
module Dodge.Data.Item.Scope,
module Dodge.Data.Item.BulletMod
) where
import Dodge.Data.Item.BulletMod
import Dodge.Data.Item.Scope
import Control.Lens
import Data.Aeson
@@ -78,8 +80,8 @@ data ItemUse
, _tgID :: Maybe Int
, _tgActive :: Bool
}
| BulletTrajectoryUse
{ _btuBulletTrajectory :: BulletTrajectoryType
| BulletModUse
{ _buMod :: BulletMod
}
deriving (Eq, Show, Read) --Generic, Flat)
+2 -2
View File
@@ -22,7 +22,7 @@ defaultItemDimension = ItemDimension
defaultHeldItem :: Item
defaultHeldItem = Item
{ _itCurseStatus = Uncursed
, _itType = ItemType (HELD PISTOL) mempty
, _itType = ItemType (HELD PISTOL) -- mempty
, _itEffect = defaultItEffect
, _itID = 0
, _itInvSize = 1
@@ -50,7 +50,7 @@ defaultBulletWeapon =
-- & itUse . heldMods .~ PistolMod
& itUse . heldAmmoTypes .~ singleAmmo BulletAmmo
-- & itUse . heldUse .~ HeldUseAmmoParams -- useAmmoParams
& itType . iyModules . at ModBulletCollision ?~ EMPTYMODULE
-- & itType . iyModules . at ModBulletCollision ?~ EMPTYMODULE
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01 0 PistolFlare MuzzleShootBullet]
-- & itType . iyModules . at ModBulletPayload ?~ EMPTYMODULE
-- & itType . iyModules . at ModBulletTrajectory ?~ EMPTYMODULE
+9 -11
View File
@@ -3,9 +3,6 @@ module Dodge.HeldUse
(heldEffect
, mcUseHeld
)
-- ( heldEffect
-- , mcUseHeld
-- )
where
import Dodge.Base.Coordinate
@@ -45,13 +42,6 @@ import RandomHelp
--import Sound.Data
--import Data.Foldable
--heldEffect :: HeldMod -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
--heldEffect effecttype = case effecttype of
-- PistolMod -> bulGunEffect
---- FireRemoteShellMod -> undefined
-- ExplodeRemoteShellMod -> undefined
-- DoNothingMod -> const $ const id
heldEffect :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
heldEffect = hammerCheck $ useTimeCheck heldEffectMuzzles
@@ -280,14 +270,22 @@ getBulletType :: LabelDoubleTree ComposeLinkType Item
-> Maybe Bullet
getBulletType itmtree magtree mz cr w = magtree ^? ldtValue . itUse . amagParams . ampBullet
<&> buTrajectory .~ btraj
<&> buPayload .~ bpayload
<&> buEffect .~ beffect
where
-- consider modifying other parameters here too
btraj = fromMaybe BasicBulletTrajectory $ do
targetingtree <- lookup WeaponTargetingLink (itmtree ^. ldtRight) -- left or right for these
tp <- targetingtree ^? ldtValue . itUse . tgPos . _Just
attree <- lookup AmmoTargetingLink (magtree ^. ldtLeft)
bt <- attree ^? ldtValue . itUse . btuBulletTrajectory
bt <- attree ^? ldtValue . itUse . buMod . bmTrajectory
return $ getBulletTrajectory mz (itmtree ^. ldtValue) bt tp cr w
bpayload = fromMaybe BulSpark $ do
attree <- lookup AmmoPayloadLink (magtree ^. ldtLeft)
attree ^? ldtValue . itUse . buMod . bmPayload
beffect = fromMaybe DestroyBullet $ do
attree <- lookup AmmoEffectLink (magtree ^. ldtLeft)
attree ^? ldtValue . itUse . buMod . bmEffect
getBulletTrajectory :: Muzzle -> Item
-> BulletTrajectoryType -> Point2 -> Creature -> World -> BulletTrajectory
+2 -1
View File
@@ -26,7 +26,7 @@ itemFromBase ibt = case ibt of
ATTACH at -> itemFromAttachType at
AMMOMAG t -> itemFromAmmoMag t
TARGETING tt -> targetingScope tt
HOMING btt -> bulletTargetingModule btt
BULLETMOD bm -> bulletModule bm
itemFromAmmoMag :: AmmoMagType -> Item
itemFromAmmoMag at = case at of
@@ -45,6 +45,7 @@ itemFromAttachType at = case at of
REMOTESCREEN -> remoteScreen
-- ROCKETHOMER -> rocketHomer
HOMINGMODULE -> homingModule
AUGMENTEDHUD -> augmentedHUD
itemFromConsumableType :: ConsumableItemType -> Item
+2 -2
View File
@@ -13,8 +13,8 @@ megaTinMag x = tinMag
tinMag :: Item
tinMag =
defaultHeldItem & itType . iyBase .~ AMMOMAG TINMAG
& itType . iyModules . at ModBulletPayload ?~ EMPTYMODULE
& itType . iyModules . at ModBulletTrajectory ?~ EMPTYMODULE
-- & itType . iyModules . at ModBulletPayload ?~ EMPTYMODULE
-- & itType . iyModules . at ModBulletTrajectory ?~ EMPTYMODULE
& itUse
.~ AmmoMagUse
{ _amagParams = BulletParams defaultBullet
+12 -9
View File
@@ -1,6 +1,6 @@
module Dodge.Item.Display (
itemDisplay,
canAttachTargeting,
-- canAttachTargeting,
itemString,
itemBaseName,
basicItemDisplay,
@@ -17,11 +17,11 @@ import Dodge.Module
import LensHelp
import Padding
canAttachTargeting :: TargetingType -> Item -> Bool
canAttachTargeting TARGETLASER _ = True
canAttachTargeting _ itm =
isJust (itm ^? itType . iyModules . ix ModBulletTrajectory . imtBulletTrajectoryType)
|| Just LAUNCHHOME == (itm ^? itType . iyModules . ix ModLauncherHoming)
--canAttachTargeting :: TargetingType -> Item -> Bool
--canAttachTargeting TARGETLASER _ = True
--canAttachTargeting _ itm =
-- isJust (itm ^? itType . iyModules . ix ModBulletTrajectory . imtBulletTrajectoryType)
-- || Just LAUNCHHOME == (itm ^? itType . iyModules . ix ModLauncherHoming)
--targetingTypeString :: TargetType -> String
--targetingTypeString tt = case tt of
@@ -54,7 +54,7 @@ basicItemDisplay itm =
itemBaseName itm :
--catMaybes [maybeWarmupStatus itm, maybeRateStatus itm]
catMaybes [maybeWarmupStatus itm]
++ moduleStrings itm
-- ++ moduleStrings itm
++ repeat "*"
itemString :: Item -> String
@@ -72,7 +72,9 @@ itemBaseName itm = case _iyBase $ _itType itm of
ATTACH ait -> showAttachItem ait itm
AMMOMAG ait -> show ait
TARGETING tt -> show tt
HOMING btt -> show btt
BULLETMOD (BulletModTrajectory btt) -> show btt
BULLETMOD (BulletModPayload btt) -> show btt
BULLETMOD (BulletModEffect btt) -> show btt
showAttachItem :: AttachType -> Item -> String
showAttachItem t itm = case t of
@@ -81,6 +83,7 @@ showAttachItem t itm = case t of
BULLETSYNTHESIZER -> "BSYNTH"
REMOTESCREEN -> "REMOTE SCREEN " ++ show (itm ^? itUse . atLinkedProjectile . _Just)
HOMINGMODULE -> "HOMING MOD"
AUGMENTEDHUD -> "AUGMENTED HUD"
showEquipItem :: EquipItemType -> String
showEquipItem eit = case eit of
@@ -124,7 +127,7 @@ itemNumberDisplay cr itm = case iu of
ScopeUse {} -> []
TargetingUse {_tgPos = mp} -> [maybe "" shortShow mp]
-- this could be cleaner here...
BulletTrajectoryUse {} -> mempty
BulletModUse {} -> mempty
where
iu = itm ^?! itUse
+10 -6
View File
@@ -5,6 +5,8 @@ module Dodge.Item.Draw (
heldItemOffset,
) where
import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
import Geometry.Data
import Control.Lens
import Data.Maybe
@@ -14,15 +16,17 @@ import Dodge.Item.Draw.SPic
import Dodge.Item.HeldOffset
import ShapePicture
itemEquipPict :: Creature -> Item -> SPic
itemEquipPict cr it = case it ^. itUse of
HeldUse{} | it ^? itLocation . ilIsRoot == Just True
-> overPosSP (heldItemOffset it cr) (itemSPic it)
itemEquipPict :: Creature -> LabelDoubleTree ComposeLinkType PartiallyComposedItem -> SPic
itemEquipPict cr itmtree = case itm ^. itUse of
HeldUse{} | itm ^? itLocation . ilIsRoot == Just True
-> overPosSP (heldItemOffset itm cr) (itemSPic itmtree)
ituse -> fromMaybe mempty $ do
attachpos <- ituse ^? equipEffect . eeAttachPos
i <- it ^? itLocation . ilInvID
i <- itm ^? itLocation . ilInvID
epos <- cr ^? crInvEquipped . ix i
return $ equipPosition epos cr attachpos (itemSPic it)
return $ equipPosition epos cr attachpos (itemSPic itmtree)
where
itm = itmtree ^. ldtValue . _1
equipPosition :: EquipPosition -> Creature -> Point3 -> SPic -> SPic
equipPosition epos cr p sh = case epos of
+13 -8
View File
@@ -2,6 +2,8 @@ module Dodge.Item.Draw.SPic (
itemSPic,
) where
import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
import Color
import qualified Data.Map.Strict as M
--import Data.Maybe
@@ -24,9 +26,10 @@ import ShapePicture
-- hit <- itm ^? itType . iyBase . ibtHeld
-- return mempty
itemSPic :: Item -> SPic
itemSPic it =
M.foldMapWithKey (modulesSPic it) (_iyModules $ _itType it) <> case it ^. itType . iyBase of
itemSPic :: LabelDoubleTree ComposeLinkType PartiallyComposedItem -> SPic
itemSPic itmtree =
--M.foldMapWithKey (modulesSPic it) (_iyModules $ _itType it) <> case it ^. itType . iyBase of
case it ^. itType . iyBase of
CRAFT _ -> defSPic
HELD ht -> heldItemSPic ht it
LEFT lt -> leftItemSPic lt it
@@ -35,7 +38,9 @@ itemSPic it =
ATTACH {} -> defSPic
AMMOMAG {} -> defSPic
TARGETING {} -> defSPic
HOMING {} -> defSPic
BULLETMOD {} -> defSPic
where
it = itmtree ^. ldtValue . _1
equipItemSPic :: EquipItemType -> Item -> SPic
equipItemSPic et _ = case et of
@@ -216,10 +221,10 @@ torchShape =
bot = upperPrismPolySE 0.5 $ rectXH 9 2
back = upperPrismPolySE 3 $ rectXH 1 2
modulesSPic :: Item -> ModuleSlot -> ItemModuleType -> SPic
modulesSPic it _ imt = case imt of
ATTACHTORCH -> noPic (overPosSH (+.+.+ _dimAttachPos (_itDimension it)) torchShape)
_ -> mempty
--modulesSPic :: Item -> ModuleSlot -> ItemModuleType -> SPic
--modulesSPic it _ imt = case imt of
-- ATTACHTORCH -> noPic (overPosSH (+.+.+ _dimAttachPos (_itDimension it)) torchShape)
-- _ -> mempty
baseStickShapeX :: Item -> Int -> Shape
baseStickShapeX it _ = foldMap f (it ^?! itUse . heldAim . aimMuzzles)
-7
View File
@@ -1,7 +0,0 @@
module Dodge.Item.Family where
data ItemFamily = HeldFamily
| CraftingFamily
| EquipmentFamily
| LeftClickFamily
| ConsumableFamily
+11 -4
View File
@@ -1,4 +1,5 @@
module Dodge.Item.Grammar (
invLDT,
invTrees,
invIndentIM,
invAdj,
@@ -38,12 +39,14 @@ basePartiallyComposedItem itm = case itm ^. itType . iyBase of
[(WeaponTargetingSF,WeaponTargetingLink), (WeaponScopeSF,WeaponScopeLink)]
)
AMMOMAG _ -> ammoComposedItem itm
TARGETING {} -> (itm,WeaponTargetingSF, LinkTest (const Nothing) (const Nothing))
TARGETING {} -> (itm,WeaponTargetingSF, useBreakListsLinkTest [(AugmentedHUDSF,AugmentedHUDLink)] [])
ATTACH ZOOMSCOPE -> (itm,WeaponScopeSF, LinkTest (const Nothing) (const Nothing))
ATTACH HOMINGMODULE -> (itm,AmmoTargetingSF ProjectileAmmo, LinkTest (const Nothing) (const Nothing))
HOMING {}
-> (itm,AmmoTargetingSF BulletAmmo, LinkTest (const Nothing) (const Nothing))
ATTACH REMOTESCREEN -> (itm,RemoteScreenSF, LinkTest (const Nothing) (const Nothing))
ATTACH AUGMENTEDHUD -> nolinks AugmentedHUDSF
BULLETMOD BulletModTrajectory {} -> nolinks $ AmmoTargetingSF BulletAmmo
BULLETMOD BulletModPayload {} -> nolinks $ AmmoPayloadSF BulletAmmo
BULLETMOD BulletModEffect {} -> nolinks $ AmmoEffectSF BulletAmmo
ATTACH REMOTESCREEN -> nolinks RemoteScreenSF
ATTACH BULLETSYNTHESIZER -> (itm,AmmoModifierSF BulletAmmo, LinkTest (const Nothing) (const Nothing))
LEFT {} -> isolate
EQUIP {} -> isolate
@@ -51,6 +54,7 @@ basePartiallyComposedItem itm = case itm ^. itType . iyBase of
CRAFT {} -> isolate
-- _ ->
where
nolinks x = (itm,x, LinkTest (const Nothing) (const Nothing))
isolate = (itm,UncomposableIsolateSF, LinkTest (const Nothing) (const Nothing))
ammoComposedItem :: Item -> PartiallyComposedItem
@@ -61,6 +65,8 @@ ammoComposedItem itm = fromMaybe (error "in ammoComposedItem, wrong item") $ do
, useBreakListsLinkTest
[(AmmoModifierSF atype, AmmoModLink)
,(AmmoTargetingSF atype, AmmoTargetingLink)
,(AmmoPayloadSF atype, AmmoPayloadLink)
,(AmmoEffectSF atype, AmmoEffectLink)
,(RemoteScreenSF, RemoteScreenLink)
]
[]
@@ -150,6 +156,7 @@ invIndentIM :: IM.IntMap Item -> IM.IntMap (Item, Int, LabelDoubleTreeNodeType C
invIndentIM = IM.fromAscList . zip [0 ..] . reverse . map (over _1 (^. _1))
. concatMap ldtToIndentList . invLDT
-- returns an intmap with trees for all items, including non-roots
invTrees :: IM.IntMap Item -> IM.IntMap (LabelDoubleTree ComposeLinkType Item)
invTrees = IM.unions . map (ldtToIM getindex . fmap (^. _1)) . invLDT
where
+13 -12
View File
@@ -21,7 +21,8 @@ sparkGun =
teslaGun :: Item
teslaGun =
defaultBatteryGun
--defaultBatteryGun
defaultHeldItem
& itUse . heldParams .~ BeamShooterParams (Just (elecCrackleS,2))
& itDimension . dimRad .~ 9
& itDimension . dimCenter .~ V3 4 0 0
@@ -43,7 +44,7 @@ teslaGun =
lasGun :: Item
lasGun =
defaultHeldItem
& itType . iyModules .~ batteryModules
-- & itType . iyModules .~ batteryModules
-- & itUse . heldMods .~ PistolMod
& itUse . heldParams .~ BeamShooterParams (Just (tone440sawtoothquietS,2))
& itUse . heldAmmoTypes .~ singleAmmo ElectricalAmmo
@@ -119,17 +120,17 @@ tractorGunTweak =
-- & itUse . heldAim . aimMuzzles
-- .~ [Muzzle (V2 30 y) 0 0 0 DefaultFlareType MuzzleLaser Nothing | y <- spreadFromCenter n 1]
defaultBatteryGun :: Item
defaultBatteryGun =
defaultHeldItem
& itType . iyModules .~ batteryModules
--defaultBatteryGun :: Item
--defaultBatteryGun =
-- defaultHeldItem
-- & itType . iyModules .~ batteryModules
batteryModules :: M.Map ModuleSlot ItemModuleType
batteryModules =
M.fromList
[ (ModBattery, EMPTYMODULE)
, (ModTeleport, EMPTYMODULE)
]
--batteryModules :: M.Map ModuleSlot ItemModuleType
--batteryModules =
-- M.fromList
-- [ (ModBattery, EMPTYMODULE)
-- , (ModTeleport, EMPTYMODULE)
-- ]
--lasCircle :: Item
--lasCircle =
+2 -2
View File
@@ -57,7 +57,7 @@ rifle =
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 25 0
& itType . iyModules . at ModHeldAttach ?~ EMPTYMODULE
-- & itType . iyModules . at ModHeldAttach ?~ EMPTYMODULE
--repeater :: Item
--repeater =
@@ -71,7 +71,7 @@ autoRifle =
& itType . iyBase .~ HELD AUTORIFLE
& itUse . heldTriggerType .~ AutoTrigger
-- & itUse . heldMods .~ AutoRifleMod
& itType . iyModules . at ModAutoMag ?~ EMPTYMODULE
-- & itType . iyModules . at ModAutoMag ?~ EMPTYMODULE
-- & itUse . useDelay . rateMax .~ 6
burstRifle :: Item
+1 -1
View File
@@ -38,7 +38,7 @@ launcher =
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleLauncher
& itUse . heldAmmoTypes .~ singleAmmo ProjectileAmmo
& itType . iyBase .~ HELD LAUNCHER
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
-- & itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
& itUse . heldParams . muzVel .~ ConstFloat 0
& itUse . heldParams . rifling .~ ConstFloat 0
& itUse . heldParams . recoil .~ 0
+2 -2
View File
@@ -57,7 +57,7 @@ autoPistol =
& itUse . heldTriggerType .~ AutoTrigger
& itUse . heldParams . bulGunSound ?~ (tap1S,0)
& itType . iyBase .~ HELD AUTOPISTOL
& itType . iyModules . at ModAutoMag ?~ EMPTYMODULE
-- & itType . iyModules . at ModAutoMag ?~ EMPTYMODULE
machinePistol :: Item
machinePistol =
@@ -66,7 +66,7 @@ machinePistol =
--rateMax .~ 2
-- & itUse . heldMods .~ PistolMod -- (ammoCheckI : machinePistolAfterHamMods)
& itType . iyBase .~ HELD MACHINEPISTOL
& itType . iyModules . at ModAutoMag .~ Nothing
-- & itType . iyModules . at ModAutoMag .~ Nothing
& itUse . heldParams . recoil .~ 20
smg :: Item
+1 -1
View File
@@ -35,7 +35,7 @@ forceFieldGun :: Item
forceFieldGun =
defaultHeldItem
-- & itUse . useTargeting ?~ TargetRBLine
& itType . iyModules . at ModTarget ?~ TARGET TargetRBLine
-- & itType . iyModules . at ModTarget ?~ TARGET TargetRBLine
& itParams .~ ParamMID Nothing
-- & itUse . heldUse .~ HeldForceField --useForceFieldGun
& itUse . heldDelay .~ NoDelay
+17 -17
View File
@@ -11,7 +11,7 @@ itemInfo :: Item -> String
itemInfo itm =
itmBaseInfo itm ++ " " ++ itmUsageInfo itm
++ itmSpaceInfo itm
++ itmModuleInfo (itm ^. itType . iyModules)
-- ++ itmModuleInfo (itm ^. itType . iyModules)
itmSpaceInfo :: Item -> String
itmSpaceInfo itm = case ceiling $ _itInvSize itm of
@@ -232,22 +232,22 @@ equipSiteInfo es = case es of
GoesOnWrist -> " on a wrist"
GoesOnLegs -> " on both legs"
itmModuleInfo :: M.Map ModuleSlot ItemModuleType -> String
itmModuleInfo m
| m == mempty = ""
| otherwise = mms ++ ems
where
(mademods, emptymods) = M.partition (/= EMPTYMODULE) m
mms
| mademods == mempty = ""
| otherwise =
" Modifications have been made "
++ makeCommaList (map moduleInfo $ M.keys mademods)
ems
| emptymods == mempty = ""
| otherwise =
" Modifications can be made "
++ makeCommaList (map moduleInfo $ M.keys emptymods)
--itmModuleInfo :: M.Map ModuleSlot ItemModuleType -> String
--itmModuleInfo m
-- | m == mempty = ""
-- | otherwise = mms ++ ems
-- where
-- (mademods, emptymods) = M.partition (/= EMPTYMODULE) m
-- mms
-- | mademods == mempty = ""
-- | otherwise =
-- " Modifications have been made "
-- ++ makeCommaList (map moduleInfo $ M.keys mademods)
-- ems
-- | emptymods == mempty = ""
-- | otherwise =
-- " Modifications can be made "
-- ++ makeCommaList (map moduleInfo $ M.keys emptymods)
makeCommaList :: [String] -> String
makeCommaList [] = ""
+1 -1
View File
@@ -14,4 +14,4 @@ itemInvColor itm = case itm ^. itType . iyBase of
ATTACH {} -> orange
TARGETING {} -> chartreuse
AMMOMAG {} -> greyN 0.8
HOMING {} -> rose
BULLETMOD {} -> rose
+18 -4
View File
@@ -5,6 +5,9 @@ module Dodge.Item.Scope (
homingModule,
fletchingModule,
bulletTargetingModule,
augmentedHUD,
bulletModule,
bulletPayloadModule,
) where
import Control.Lens
@@ -33,11 +36,22 @@ homingModule =
fletchingModule :: Item
fletchingModule = bulletTargetingModule FlechetteTrajectoryType
bulletTargetingModule :: BulletTrajectoryType -> Item
bulletTargetingModule btt =
bulletModule :: BulletMod -> Item
bulletModule bm =
defaultHeldItem
& itType . iyBase .~ HOMING btt
& itUse .~ BulletTrajectoryUse btt
& itType . iyBase .~ BULLETMOD bm
& itUse .~ BulletModUse bm
bulletTargetingModule :: BulletTrajectoryType -> Item
bulletTargetingModule = bulletModule . BulletModTrajectory
bulletPayloadModule :: BulletPayload -> Item
bulletPayloadModule = bulletModule . BulletModPayload
augmentedHUD :: Item
augmentedHUD = defaultHeldItem
& itType . iyBase .~ ATTACH AUGMENTEDHUD
& itUse .~ AttachUse Nothing
remoteScreen :: Item
remoteScreen =
+2 -1
View File
@@ -7,7 +7,8 @@ import Dodge.Data.Item
import Dodge.Module
itSlotsTaken :: Item -> Int
itSlotsTaken it = moduleSizes it + ceiling (_itInvSize it)
itSlotsTaken it = ceiling (_itInvSize it)
--itSlotsTaken it = moduleSizes it + ceiling (_itInvSize it)
--itSlotsTaken :: Item -> Int
--itSlotsTaken it = case it ^? itUse . useAmount of
+1 -1
View File
@@ -12,7 +12,7 @@ defaultBullet =
Bullet
{ _buDelayFraction = 1
, _buEffect = DestroyBullet
, _buSpawn = BulSpark
, _buPayload = BulSpark
, _buTrajectory = BasicBulletTrajectory
, _buVel = V2 50 0
, _buDrag = 1
+8 -3
View File
@@ -1,5 +1,9 @@
module Dodge.Machine.Draw where
module Dodge.Machine.Draw
( drawMachine
) where
import Dodge.Data.ComposedItem
import Dodge.DoubleTree
import Dodge.Data.Machine
import Dodge.Item.Draw.SPic
import Dodge.Item.HeldOffset
@@ -56,9 +60,10 @@ drawBaseMachine h mc =
$ _mcWidth mc
drawTurret :: Turret -> Machine -> SPic
drawTurret tu mc = overPosSP (turretItemOffset it tu mc) (itemSPic it)
drawTurret tu mc = overPosSP (turretItemOffset itm tu mc) (itemSPic ittree)
where
it = _tuWeapon tu
itm = _tuWeapon tu
ittree = singleLDT (itm,UncomposableIsolateSF,LinkTest (const Nothing) (const Nothing))
sensorSPic :: (PaletteColor, DecorationShape) -> Machine -> SPic
sensorSPic (pc, ds) mc =
+31 -31
View File
@@ -1,43 +1,43 @@
module Dodge.Module (
moduleSizes,
moduleStrings,
moduleName,
-- moduleSizes,
-- moduleStrings,
-- moduleName,
) where
import qualified Data.Map.Strict as M
import Dodge.Data.Item
import Dodge.Module.Info
moduleSizes :: Item -> Int
moduleSizes = sum . fmap moduleSize . _iyModules . _itType
--moduleSizes :: Item -> Int
--moduleSizes = sum . fmap moduleSize . _iyModules . _itType
--
--moduleSize :: ItemModuleType -> Int
--moduleSize imt = case imt of
-- EMPTYMODULE -> 0
-- _ -> 1
moduleSize :: ItemModuleType -> Int
moduleSize imt = case imt of
EMPTYMODULE -> 0
_ -> 1
--moduleStrings :: Item -> [String]
--moduleStrings = M.elems . M.mapMaybe moduleName . _iyModules . _itType
moduleStrings :: Item -> [String]
moduleStrings = M.elems . M.mapMaybe moduleName . _iyModules . _itType
moduleName :: ItemModuleType -> Maybe String
moduleName imt = case imt of
EMPTYMODULE -> Nothing
-- BELTMAG -> Just "+BELT FEED"
MAGNETMAG -> Just "+MAGNET FEED"
BULPAY thepayload -> Just $ "+" ++ displayBulletPayload thepayload
BULBODY thebody -> Just $ "+" ++ displayBulletBody thebody
BULTRAJ thetraj -> Just $ "+" ++ displayBulletTraj thetraj
TARGET TargetRBCreature -> Just "+CREATURETARGETING"
TARGET TARGETLASER -> Just "+LASERTARGETING"
TARGET TargetRBPress -> Just "+POSTIONALTARGETING"
TARGET TargetCursor -> Just "+CURSORTARGETING"
TARGET TargetRBLine -> Just "+LINETARGETING"
INCENDLAS -> Just "+INCENDIARY"
SPLITLAS -> Just "+SPLIT"
STATICLAS -> Just "+STATIC"
-- WEPTELE -> Just "+DIRECTEDTELE"
LAUNCHHOME -> Just "+TARGET HOMING"
ATTACHTORCH -> Just "+TORCH"
--moduleName :: ItemModuleType -> Maybe String
--moduleName imt = case imt of
-- EMPTYMODULE -> Nothing
---- BELTMAG -> Just "+BELT FEED"
-- MAGNETMAG -> Just "+MAGNET FEED"
-- BULPAY thepayload -> Just $ "+" ++ displayBulletPayload thepayload
-- BULBODY thebody -> Just $ "+" ++ displayBulletBody thebody
-- BULTRAJ thetraj -> Just $ "+" ++ displayBulletTraj thetraj
-- TARGET TargetRBCreature -> Just "+CREATURETARGETING"
-- TARGET TARGETLASER -> Just "+LASERTARGETING"
-- TARGET TargetRBPress -> Just "+POSTIONALTARGETING"
-- TARGET TargetCursor -> Just "+CURSORTARGETING"
-- TARGET TargetRBLine -> Just "+LINETARGETING"
-- INCENDLAS -> Just "+INCENDIARY"
-- SPLITLAS -> Just "+SPLIT"
-- STATICLAS -> Just "+STATIC"
---- WEPTELE -> Just "+DIRECTEDTELE"
-- LAUNCHHOME -> Just "+TARGET HOMING"
-- ATTACHTORCH -> Just "+TORCH"
--moduleFold :: (m -> m -> m) -> (ItemModule -> Maybe m) -> m -> Item -> m
+1 -1
View File
@@ -8,7 +8,7 @@ displayBulletBody be = case be of
BounceBullet -> "bouncing"
PenetrateBullet -> "penetrating"
displayBulletPayload :: BulletSpawn -> String
displayBulletPayload :: BulletPayload -> String
displayBulletPayload x = case x of
BulSpark -> ""
BulFrag -> "fragmentation"
+4 -1
View File
@@ -2,6 +2,8 @@ module Dodge.Render.ShapePicture (
worldSPic,
) where
import Dodge.DoubleTree
import Dodge.Data.ComposedItem
import NewInt
import Dodge.Render.List
import Control.Lens
@@ -161,7 +163,8 @@ ppDraw c = uncurryV translate (_ppPos c) $ rotate (_ppRot c) (_ppPict c)
floorItemSPic :: FloorItem -> SPic
floorItemSPic flit =
uncurryV translateSPxy (_flItPos flit) $
rotateSP (_flItRot flit) (itemSPic (_flIt flit))
rotateSP (_flItRot flit)
(itemSPic $ singleLDT ((_flIt flit),UncomposableIsolateSF,LinkTest (const Nothing) (const Nothing)))
btSPic :: Button -> SPic
btSPic bt =
+396 -381
View File
File diff suppressed because it is too large Load Diff