Move AmmoType, going towards no need for Aeson
This commit is contained in:
@@ -45,10 +45,10 @@ digraph {
|
||||
,label="HELD {_ibtHeld = FLAMESPITTER}"];
|
||||
57 [shape=box
|
||||
,label="HELD {_ibtHeld = BLOWTORCH}"];
|
||||
59 [shape=box
|
||||
,label="HELD {_ibtHeld = FLAMETHROWER}"];
|
||||
61 [shape=box
|
||||
60 [shape=box
|
||||
,label="HELD {_ibtHeld = FLAMEWALL}"];
|
||||
61 [shape=box
|
||||
,label="HELD {_ibtHeld = FLAMETHROWER}"];
|
||||
63 [shape=box
|
||||
,label="HELD {_ibtHeld = FLAMETORRENT}"];
|
||||
65 [shape=box
|
||||
@@ -109,7 +109,7 @@ digraph {
|
||||
52 [shape=point];
|
||||
56 [shape=point];
|
||||
58 [shape=point];
|
||||
60 [shape=point];
|
||||
59 [shape=point];
|
||||
62 [shape=point];
|
||||
64 [shape=point];
|
||||
68 [shape=point];
|
||||
@@ -235,14 +235,14 @@ digraph {
|
||||
,arrowhead=onone
|
||||
,headport=w];
|
||||
56 -> 57 [xlabel="",tailport=e];
|
||||
58 -> 59 [xlabel="",tailport=e];
|
||||
59 -> 60 [xlabel=1
|
||||
58 -> 13 [xlabel="",tailport=e];
|
||||
59 -> 60 [xlabel="",tailport=e];
|
||||
61 -> 59 [xlabel=1
|
||||
,arrowhead=onone
|
||||
,headport=w];
|
||||
59 -> 62 [xlabel=1
|
||||
61 -> 62 [xlabel=1
|
||||
,arrowhead=onone
|
||||
,headport=w];
|
||||
60 -> 61 [xlabel="",tailport=e];
|
||||
62 -> 63 [xlabel="",tailport=e];
|
||||
64 -> 65 [xlabel="",tailport=e];
|
||||
68 -> 69 [xlabel="",tailport=e];
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -5,6 +5,7 @@
|
||||
|
||||
module Dodge.Data.ComposedItem where
|
||||
|
||||
import Dodge.Data.AmmoType
|
||||
import Dodge.Data.DoubleTree
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
|
||||
@@ -13,7 +13,7 @@ module Dodge.Data.Item (
|
||||
) where
|
||||
|
||||
import Geometry.Data
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
--import qualified Data.IntMap.Strict as IM
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
@@ -34,7 +34,7 @@ data Consumables
|
||||
| AmmoMag
|
||||
{ _magLoadStatus :: ReloadStatus
|
||||
, _magParams :: AmmoParams
|
||||
, _magType :: AmmoType
|
||||
-- , _magType :: AmmoType
|
||||
}
|
||||
deriving (Eq, Show, Read)
|
||||
|
||||
@@ -47,7 +47,7 @@ data Item = Item
|
||||
, _itLocation :: ItemLocation
|
||||
, _itEffect :: ItEffect
|
||||
, _itTargeting :: ItemTargeting
|
||||
, _itAmmoSlots :: IM.IntMap AmmoType
|
||||
-- , _itAmmoSlots :: IM.IntMap AmmoType
|
||||
, _itParams :: ItemParams
|
||||
, _itScroll :: ItemScroll
|
||||
, _itTimeLastUsed :: Int
|
||||
|
||||
@@ -21,16 +21,6 @@ data ProjectileUpdate
|
||||
| RemoteDirectionPU {_pjuStart :: Int, _pjuEnd :: Int}
|
||||
deriving (Show, Eq, Ord, Read) --Generic, Flat)
|
||||
|
||||
data AmmoType
|
||||
= LauncherAmmo
|
||||
| BulletAmmo
|
||||
| BeltBulletAmmo
|
||||
| ElectricalAmmo
|
||||
| DroneAmmo
|
||||
| GasAmmo
|
||||
| PrintMaterial
|
||||
| ExplosivePutty
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
data ForceFieldType = DefaultForceField
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
@@ -42,9 +32,9 @@ data GasCreate = CreatePoisonGas | CreateFlame
|
||||
deriving (Eq, Ord, Show, Enum, Bounded, Read) --Generic, Flat)
|
||||
|
||||
makeLenses ''ProjectileUpdate
|
||||
makeLenses ''AmmoType
|
||||
--makeLenses ''AmmoType
|
||||
deriveJSON defaultOptions ''GasFuel
|
||||
deriveJSON defaultOptions ''ProjectileUpdate
|
||||
deriveJSON defaultOptions ''GasCreate
|
||||
deriveJSON defaultOptions ''ForceFieldType
|
||||
deriveJSON defaultOptions ''AmmoType
|
||||
--deriveJSON defaultOptions ''AmmoType
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Dodge.Default.Item (
|
||||
defaultHeldItem,
|
||||
singleAmmo,
|
||||
-- singleAmmo,
|
||||
defaultBulletWeapon,
|
||||
-- defaultLeftItem,
|
||||
defaultCraftItem,
|
||||
@@ -8,7 +8,7 @@ module Dodge.Default.Item (
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
--import qualified Data.IntMap.Strict as IM
|
||||
import Dodge.Data.Item
|
||||
import Dodge.Default.Item.Use
|
||||
--import Geometry.Data
|
||||
@@ -21,7 +21,7 @@ defaultHeldItem =
|
||||
, _itEffect = defaultItEffect
|
||||
, _itID = 0 -- should this return an error ? const $ error "itID not correctly initialised" ?
|
||||
, _itTargeting = NoItTargeting
|
||||
, _itAmmoSlots = mempty
|
||||
-- , _itAmmoSlots = mempty
|
||||
, _itLocation = InVoid
|
||||
, _itUse = UseHeld
|
||||
, _itParams = NoParams
|
||||
@@ -36,13 +36,13 @@ defaultHeldItem =
|
||||
defaultCraftItem :: Item
|
||||
defaultCraftItem = defaultHeldItem & itUse .~ UseNothing
|
||||
|
||||
singleAmmo :: a -> IM.IntMap a
|
||||
singleAmmo x = IM.insert 0 x mempty
|
||||
--singleAmmo :: a -> IM.IntMap a
|
||||
--singleAmmo x = IM.insert 0 x mempty
|
||||
|
||||
defaultBulletWeapon :: Item
|
||||
defaultBulletWeapon =
|
||||
defaultHeldItem
|
||||
& itAmmoSlots .~ singleAmmo BulletAmmo
|
||||
-- & itAmmoSlots .~ singleAmmo BulletAmmo
|
||||
-- & itUse . heldMuzzles .~
|
||||
-- [Muzzle (V2 15 0) 0 0.01 0 BasicFlare MuzzleShootBullet (UseExactly 1) 0]
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ tinMag =
|
||||
& itConsumables
|
||||
.~ AmmoMag
|
||||
{ _magParams = BulletParams defaultBullet
|
||||
, _magType = BulletAmmo
|
||||
-- , _magType = BulletAmmo
|
||||
, _magLoadStatus =
|
||||
ReloadStatus
|
||||
{ _iaMax = 15
|
||||
@@ -48,7 +48,7 @@ beltMag :: Item
|
||||
beltMag = tinMag & itType . ibtAmmoMag .~ BELTMAG
|
||||
& itConsumables . magLoadStatus . iaLoaded .~ 10000
|
||||
& itConsumables . magLoadStatus . iaMax .~ 20000
|
||||
& itConsumables . magType .~ BeltBulletAmmo
|
||||
-- & itConsumables . magType .~ BeltBulletAmmo
|
||||
|
||||
megaShellMag :: Item
|
||||
megaShellMag = shellMag
|
||||
@@ -70,7 +70,7 @@ shellMag =
|
||||
{ _iaMax = 1
|
||||
, _iaLoaded = 1
|
||||
}
|
||||
, _magType = LauncherAmmo
|
||||
-- , _magType = LauncherAmmo
|
||||
}
|
||||
|
||||
megaBattery :: Item
|
||||
@@ -91,7 +91,7 @@ battery =
|
||||
& itConsumables
|
||||
.~ AmmoMag
|
||||
{ _magParams = NoAmmoParams
|
||||
, _magType = ElectricalAmmo
|
||||
-- , _magType = ElectricalAmmo
|
||||
, _magLoadStatus =
|
||||
ReloadStatus
|
||||
{ _iaMax = 10 ^ (9 :: Int)
|
||||
@@ -106,7 +106,7 @@ chemFuelPouch =
|
||||
& itConsumables
|
||||
.~ AmmoMag
|
||||
{ _magParams = GasParams ChemFuel
|
||||
, _magType = GasAmmo
|
||||
-- , _magType = GasAmmo
|
||||
, _magLoadStatus =
|
||||
ReloadStatus
|
||||
{ _iaMax = 1000
|
||||
|
||||
@@ -45,7 +45,7 @@ maybeWarmupStatus :: Item -> Maybe String
|
||||
maybeWarmupStatus it = case useDelay it ^? warmMax of
|
||||
Nothing -> Nothing
|
||||
--Just m -> case m - (_warmTime . _heldDelay $ _itUse it) of
|
||||
Just m -> case m - (_wTime $ _itParams it) of
|
||||
Just m -> case m - _wTime (_itParams it) of
|
||||
x
|
||||
| x <= 1 -> Just "*WARM"
|
||||
| otherwise ->
|
||||
|
||||
@@ -61,7 +61,7 @@ batteryPack =
|
||||
& itConsumables
|
||||
.~ AmmoMag
|
||||
{ _magParams = NoAmmoParams
|
||||
, _magType = ElectricalAmmo
|
||||
-- , _magType = ElectricalAmmo
|
||||
, _magLoadStatus =
|
||||
ReloadStatus
|
||||
{ _iaMax = 10000000
|
||||
@@ -80,7 +80,7 @@ fuelPack =
|
||||
& itConsumables
|
||||
.~ AmmoMag
|
||||
{ _magParams = GasParams ChemFuel
|
||||
, _magType = GasAmmo
|
||||
-- , _magType = GasAmmo
|
||||
, _magLoadStatus =
|
||||
ReloadStatus
|
||||
{ _iaMax = 100000
|
||||
@@ -97,7 +97,7 @@ bulletBeltPack =
|
||||
& itConsumables
|
||||
.~ AmmoMag
|
||||
{ _magParams = BulletParams defaultBullet
|
||||
, _magType = BeltBulletAmmo
|
||||
-- , _magType = BeltBulletAmmo
|
||||
, _magLoadStatus =
|
||||
ReloadStatus
|
||||
{ _iaMax = 10000000
|
||||
@@ -115,7 +115,7 @@ bulletBeltBracer =
|
||||
& itConsumables
|
||||
.~ AmmoMag
|
||||
{ _magParams = BulletParams defaultBullet
|
||||
, _magType = BeltBulletAmmo
|
||||
-- , _magType = BeltBulletAmmo
|
||||
, _magLoadStatus =
|
||||
ReloadStatus
|
||||
{ _iaMax = 100000
|
||||
|
||||
@@ -7,6 +7,9 @@ module Dodge.Item.Grammar (
|
||||
allInvLocs,
|
||||
) where
|
||||
|
||||
import Dodge.Item.MagAmmoType
|
||||
import Dodge.Data.AmmoType
|
||||
import Dodge.Item.AmmoSlots
|
||||
import Dodge.Data.TriggerType
|
||||
import Dodge.BaseTriggerType
|
||||
import Dodge.Data.AimStance
|
||||
@@ -87,7 +90,7 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
||||
, [(TriggerSF, TriggerLink), (WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
|
||||
)
|
||||
(_, AmmoMagSF{}) -> fromMaybe ([], []) $ do
|
||||
atype <- itm ^? itConsumables . magType
|
||||
atype <- magAmmoType itm
|
||||
let screenanddet = case atype of
|
||||
LauncherAmmo ->
|
||||
[ (RemoteScreenSF, RemoteScreenLink)
|
||||
@@ -138,7 +141,7 @@ getAmmoLinks :: Item -> [(ItemStructuralFunction, ComposeLinkType)]
|
||||
getAmmoLinks itm =
|
||||
map
|
||||
(\(i, a) -> (AmmoMagSF a, AmmoInLink i a))
|
||||
(IM.toList $ itm ^. itAmmoSlots)
|
||||
(IM.toList $ itemAmmoSlots itm)
|
||||
|
||||
itemToFunction :: Item -> ItemStructuralFunction
|
||||
itemToFunction itm = case itm ^. itType of
|
||||
@@ -152,10 +155,10 @@ itemToFunction itm = case itm ^. itType of
|
||||
--Just MustBeHeld -> UnloadedWeaponSF
|
||||
_ -> GadgetPlatformSF
|
||||
_
|
||||
| Just amtype <- itm ^? itConsumables . magType
|
||||
| Just amtype <- magAmmoType itm-- ^? itConsumables . magType
|
||||
, Just _ <- itm ^? itLocation . ilEquipSite . _Just ->
|
||||
AmmoMagSF amtype
|
||||
AMMOMAG{} -> maybe NoSF AmmoMagSF $ itm ^? itConsumables . magType
|
||||
AMMOMAG{} -> maybe NoSF AmmoMagSF $ magAmmoType itm -- ^? itConsumables . magType
|
||||
ATTACH REMOTESCREEN -> RemoteScreenSF
|
||||
ATTACH JOYSTICK -> JoystickSF
|
||||
ATTACH REMOTEDETONATOR -> RemoteDetonatorSF
|
||||
|
||||
@@ -27,7 +27,7 @@ teslaGun =
|
||||
-- & itUse . heldMuzzles . ix 0 . mzFlareType .~ TeslaGunFlare
|
||||
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleTesla
|
||||
& itType .~ HELD TESLAGUN
|
||||
& itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
-- & itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
|
||||
teslaParams :: ItemParams
|
||||
teslaParams =
|
||||
@@ -42,7 +42,7 @@ laser :: Item
|
||||
laser =
|
||||
defaultHeldItem
|
||||
-- & itUse . heldParams .~ BeamShooterParams-- Nothing
|
||||
& itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
-- & itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
-- & itUse . heldDelay .~ NoDelay
|
||||
-- & itUse . heldMuzzles . ix 0 . mzPos .~ V2 6 0
|
||||
-- & itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
|
||||
@@ -61,7 +61,7 @@ tractorGun :: Item
|
||||
tractorGun =
|
||||
defaultHeldItem
|
||||
-- & itUse . heldParams .~ BeamShooterParams
|
||||
& itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
-- & itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
-- & itUse . heldMuzzles . ix 0 . mzPos .~ V2 30 0
|
||||
-- & itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
|
||||
-- & itUse . heldMuzzles . ix 0 . mzFlareType .~ NoFlare
|
||||
|
||||
@@ -9,7 +9,7 @@ module Dodge.Item.Held.Cane (
|
||||
|
||||
import Dodge.Data.Item
|
||||
import Dodge.Default
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
--import qualified Data.IntMap.Strict as IM
|
||||
import LensHelp
|
||||
|
||||
defaultBangCane :: Item
|
||||
@@ -32,7 +32,7 @@ volleyGun i =
|
||||
-- <*> ZipList [0..i-1]
|
||||
-- )
|
||||
& itType .~ HELD (VOLLEYGUN i)
|
||||
& itAmmoSlots .~ IM.fromList (zip [0..i-1] $ repeat BulletAmmo)
|
||||
-- & itAmmoSlots .~ IM.fromList (zip [0..i-1] $ repeat BulletAmmo)
|
||||
-- & itUse . heldUseEffect .~ RandomiseMuzzleFrames i
|
||||
|
||||
rifle :: Item
|
||||
@@ -42,7 +42,7 @@ rifle = defaultBangCane & itType .~ HELD RIFLE
|
||||
alteRifle :: Item
|
||||
alteRifle = rifle
|
||||
& itType .~ HELD ALTERIFLE
|
||||
& itAmmoSlots .~ IM.fromList (zip [0..1] $ repeat BulletAmmo)
|
||||
-- & itAmmoSlots .~ IM.fromList (zip [0..1] $ repeat BulletAmmo)
|
||||
& itParams .~ AlteRifleSwitch 0
|
||||
|
||||
autoRifle :: Item
|
||||
@@ -63,7 +63,7 @@ miniGunX i =
|
||||
-- & itUse . heldDelay .~ WarmUpNoDelay{
|
||||
-- --_warmTime = 0,
|
||||
-- _warmMax = 100, _warmSound = crankSlowS}
|
||||
& itAmmoSlots .~ singleAmmo BeltBulletAmmo
|
||||
-- & itAmmoSlots .~ singleAmmo BeltBulletAmmo
|
||||
-- & itUse . heldMuzzles
|
||||
-- .~ replicate i
|
||||
-- (Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet (UseExactly 1) 0)
|
||||
|
||||
@@ -9,7 +9,7 @@ import Control.Lens
|
||||
import Dodge.Data.Item
|
||||
import Dodge.Default.Item
|
||||
--import Geometry.Data
|
||||
import qualified IntMapHelp as IM
|
||||
--import qualified IntMapHelp as IM
|
||||
|
||||
rLauncher :: Item
|
||||
rLauncher =
|
||||
@@ -18,7 +18,7 @@ rLauncher =
|
||||
-- & itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
|
||||
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleRLauncher
|
||||
-- & itUse . heldMuzzles . ix 0 . mzPos .~ V2 20 0
|
||||
& itAmmoSlots .~ singleAmmo LauncherAmmo
|
||||
-- & itAmmoSlots .~ singleAmmo LauncherAmmo
|
||||
& itType .~ HELD RLAUNCHER
|
||||
|
||||
gLauncher :: Item
|
||||
@@ -40,6 +40,6 @@ rLauncherX i =
|
||||
-- <*> pure (UseExactly 1)
|
||||
-- <*> pure 0
|
||||
-- )
|
||||
& itAmmoSlots .~ IM.fromList [(j, LauncherAmmo) | j <- [0 .. i -1]]
|
||||
where
|
||||
-- & itAmmoSlots .~ IM.fromList [(j, LauncherAmmo) | j <- [0 .. i -1]]
|
||||
-- where
|
||||
-- angles = take i [0, 2 * pi / fromIntegral i ..]
|
||||
|
||||
@@ -18,7 +18,7 @@ poisonSprayer :: Item
|
||||
poisonSprayer =
|
||||
flameThrower
|
||||
& itType .~ HELD POISONSPRAYER
|
||||
& itAmmoSlots .~ singleAmmo GasAmmo
|
||||
-- & itAmmoSlots .~ singleAmmo GasAmmo
|
||||
|
||||
flameSpitter :: Item
|
||||
flameSpitter =
|
||||
@@ -77,8 +77,8 @@ flameThrower =
|
||||
-- (UseExactly 1)
|
||||
-- 0
|
||||
-- ]
|
||||
& itAmmoSlots .~ singleAmmo GasAmmo
|
||||
& itType .~ HELD FLAMETHROWER
|
||||
-- & itAmmoSlots .~ singleAmmo GasAmmo
|
||||
-- & itType .~ HELD FLAMETHROWER
|
||||
-- & itUse . heldParams .~ GasSprayParams
|
||||
-- { _weaponInvLock = 0
|
||||
---- , _weaponRepeat = mempty
|
||||
|
||||
@@ -29,7 +29,7 @@ torch =
|
||||
defaultHeldItem
|
||||
& itType .~ HELD TORCH
|
||||
-- & itUse . heldMuzzles . ix 0 . mzPos . _x .~ 10
|
||||
& itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
-- & itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
|
||||
-- | Sends out pulses that display walls.
|
||||
detector :: Detector -> Item
|
||||
@@ -37,7 +37,7 @@ detector dt =
|
||||
defaultHeldItem
|
||||
& itUseCondition .~ UseableAnytime
|
||||
-- & itUse . heldDelay . rateMax .~ 20
|
||||
& itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
-- & itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
& itType .~ DETECTOR dt
|
||||
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleDetector
|
||||
-- & itUse . heldMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 100
|
||||
@@ -47,7 +47,7 @@ blinker =
|
||||
defaultHeldItem
|
||||
& itUseCondition .~ UseableAnytime
|
||||
-- & itUse . heldDelay . rateMax .~ 20
|
||||
& itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
-- & itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleBlink
|
||||
-- & itUse . heldMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 10000000
|
||||
& itType .~ HELD BLINKER
|
||||
|
||||
@@ -10,7 +10,7 @@ shatterGun =
|
||||
defaultHeldItem
|
||||
& itType .~ HELD SHATTERGUN
|
||||
-- & itUse . heldDelay . rateMax .~ 10
|
||||
& itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
-- & itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
-- & itUse . heldMuzzles . ix 0 . mzPos .~ V2 30 0
|
||||
-- & itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
|
||||
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleShatter
|
||||
|
||||
Reference in New Issue
Block a user