Defunction-ify item modules, requires more cleanup
This commit is contained in:
@@ -41,9 +41,7 @@ import Data.Maybe
|
||||
|
||||
bangCane :: Item
|
||||
bangCane = defaultGun
|
||||
{ _itName = "BANGCANE"
|
||||
, _itType = BANGCANE
|
||||
, _itParams = BulletShooter
|
||||
{ _itParams = BulletShooter
|
||||
{ _muzVel = 0.8
|
||||
, _rifling = 0.9
|
||||
, _bore = 2
|
||||
@@ -82,11 +80,10 @@ bangCane = defaultGun
|
||||
<> makeSingleClipAt (V3 5 0 3) it
|
||||
}
|
||||
} & itUse . useAim . aimStance .~ OneHand
|
||||
& itType . iyBase .~ BANGCANE
|
||||
bangCaneX :: Int -> Item
|
||||
bangCaneX i = bangCane
|
||||
{ _itName = "BANGCANEx"++show i
|
||||
, _itType = BANGCANEX i
|
||||
, _itUse = ruseAmmoParamsRate 6 upHammer
|
||||
{ _itUse = ruseAmmoParamsRate 6 upHammer
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
, withSoundItemChoiceStart caneStickSoundChoice
|
||||
@@ -121,6 +118,7 @@ bangCaneX i = bangCane
|
||||
,_brlInaccuracy = 0.1
|
||||
}
|
||||
& itParams . torqueAfter .~ 0.48 + 0.2 * fromIntegral i
|
||||
& itType . iyBase .~ BANGCANEX i
|
||||
caneStickSoundChoice :: Item -> SoundID
|
||||
caneStickSoundChoice it
|
||||
| _laLoaded (_itConsumption it) < 2 = tap3S
|
||||
@@ -146,8 +144,7 @@ rifle = bangCane
|
||||
}
|
||||
}
|
||||
& itUse . useAim . aimStance .~ TwoHandTwist
|
||||
& itName .~ "RIFLE"
|
||||
& itType .~ RIFLE
|
||||
& itType . iyBase .~ RIFLE
|
||||
& itConsumption . laMax .~ 1
|
||||
& itUse . useAim . aimWeight .~ 6
|
||||
& itUse . useAim . aimRange .~ 1
|
||||
@@ -155,9 +152,8 @@ rifle = bangCane
|
||||
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 2}
|
||||
repeater :: Item
|
||||
repeater = rifle
|
||||
& itModules . at ModRifleMag ?~ DefaultModule
|
||||
& itName .~ "REPEATER"
|
||||
& itType .~ REPEATER
|
||||
& itType . iyModules . at ModRifleMag ?~ EMPTYMODULE
|
||||
& itType . iyBase .~ REPEATER
|
||||
& itConsumption . laReloadType .~ ActiveClear
|
||||
& itConsumption . laReloadTime .~ 80
|
||||
& itConsumption . laMax .~ 15
|
||||
@@ -173,15 +169,13 @@ baseRifleShape = colorSH red $ upperPrismPoly 3 $ rectXH 25 2
|
||||
|
||||
autoRifle :: Item
|
||||
autoRifle = repeater
|
||||
& itName .~ "AUTORIFLE"
|
||||
& itType .~ AUTORIFLE
|
||||
& itType . iyBase .~ AUTORIFLE
|
||||
& itUse . useMods %~ ((ammoCheckI :) . tail)
|
||||
& itModules . at ModAutoMag ?~ DefaultModule
|
||||
& itType . iyModules . at ModAutoMag ?~ EMPTYMODULE
|
||||
-- & itUse . useDelay . rateMax .~ 6
|
||||
burstRifle :: Item
|
||||
burstRifle = repeater
|
||||
& itName .~ "BURSTRIFLE"
|
||||
& itType .~ BURSTRIFLE
|
||||
& itType . iyBase .~ BURSTRIFLE
|
||||
& itParams . gunBarrels . brlInaccuracy .~ 0.05
|
||||
& itUse . useDelay . rateMax .~ 18
|
||||
& itUse . useMods .~
|
||||
@@ -198,8 +192,7 @@ burstRifle = repeater
|
||||
]
|
||||
fastBurstRifle :: Item
|
||||
fastBurstRifle = repeater
|
||||
& itName .~ "FASTBURSTRIFLE"
|
||||
& itType .~ FASTBURSTRIFLE
|
||||
& itType . iyBase .~ FASTBURSTRIFLE
|
||||
& itParams . gunBarrels . brlInaccuracy .~ 0.06
|
||||
& itUse . useDelay . rateMax .~ 18
|
||||
& itUse . useMods .~
|
||||
@@ -216,9 +209,8 @@ fastBurstRifle = repeater
|
||||
]
|
||||
completeBurstRifle :: Item
|
||||
completeBurstRifle = repeater
|
||||
& itName .~ "COMPLETEBURSTRIFLE"
|
||||
& itType .~ COMPLETEBURSTRIFLE
|
||||
& itModules . at ModRifleMag .~ Nothing
|
||||
& itType . iyBase .~ COMPLETEBURSTRIFLE
|
||||
& itType . iyModules . at ModRifleMag .~ Nothing
|
||||
& itParams . gunBarrels . brlInaccuracy .~ 0.1
|
||||
& itUse . useDelay . rateMax .~ 28
|
||||
& itUse . useMods .~
|
||||
@@ -262,9 +254,7 @@ miniGunUse i = ruseInstant (useAmmoParams $ Just 1) NoHammer $
|
||||
|
||||
miniGunX :: Int -> Item
|
||||
miniGunX i = defaultAutoGun
|
||||
{ _itName = "MINIGUN-" ++ show i
|
||||
, _itType = MINIGUNX i
|
||||
, _itConsumption = defaultAmmo
|
||||
{ _itConsumption = defaultAmmo
|
||||
{ _laType = basicBullet
|
||||
, _laMax = 1500
|
||||
, _laLoaded = 1500
|
||||
@@ -308,7 +298,7 @@ miniGunX i = defaultAutoGun
|
||||
}
|
||||
}
|
||||
& itDimension . dimPortage . muzPos .~ 40
|
||||
|
||||
& itType . iyBase .~ MINIGUNX i
|
||||
miniGunXPictItem :: Int -> Item -> SPic
|
||||
miniGunXPictItem i it = miniGunXPict i spin (_laLoaded $ _itConsumption it)
|
||||
where
|
||||
|
||||
@@ -7,6 +7,7 @@ module Dodge.Item.Weapon.BulletGun.Rod
|
||||
, machineGun
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Default.Item
|
||||
import Dodge.Item.Weapon.BulletGun.Clip
|
||||
import Dodge.Item.Weapon.InventoryDisplay
|
||||
import Dodge.Particle.HitEffect
|
||||
@@ -41,9 +42,7 @@ import Data.Maybe
|
||||
|
||||
bangRod :: Item
|
||||
bangRod = defaultGun
|
||||
{ _itName = "BANGROD"
|
||||
, _itType = BANGROD
|
||||
, _itParams = BulletShooter
|
||||
{ _itParams = BulletShooter
|
||||
{ _muzVel = 0.8
|
||||
, _rifling = 1
|
||||
, _bore = 2
|
||||
@@ -79,6 +78,7 @@ bangRod = defaultGun
|
||||
, _laReloadTime = 20
|
||||
}
|
||||
}
|
||||
& itType . iyBase .~ BANGROD
|
||||
& itUse . useAim . aimWeight .~ 8
|
||||
& itUse . useAim . aimRange .~ 1
|
||||
& itUse . useAim . aimStance .~ OneHand
|
||||
@@ -90,8 +90,7 @@ baseAMRShape :: Shape
|
||||
baseAMRShape = colorSH orange $ upperPrismPoly 3 $ rectXH 30 2
|
||||
elephantGun :: Item
|
||||
elephantGun = bangRod
|
||||
& itName .~ "ELEPHANTGUN"
|
||||
& itType .~ ELEPHANTGUN
|
||||
& itType . iyBase .~ ELEPHANTGUN
|
||||
& itUse . useAim . aimStance .~ TwoHandTwist
|
||||
& itParams . gunBarrels .~ SingleBarrel 0.05
|
||||
& itDimension . dimSPic .~ (\it -> noPic $ baseAMRShape
|
||||
@@ -112,8 +111,7 @@ elephantGun = bangRod
|
||||
& itParams . torqueAfter .~ 0.1
|
||||
amr :: Item
|
||||
amr = elephantGun
|
||||
& itName .~ "ANTIMATERIELRIFLE"
|
||||
& itType .~ AMR
|
||||
& itType . iyBase .~ AMR
|
||||
& itConsumption . laMax .~ 15
|
||||
& itDimension . dimSPic .~ (\it -> noPic $ baseAMRShape
|
||||
<> makeTinClipAt 0 (V3 10 (-2) 0) it
|
||||
@@ -121,14 +119,12 @@ amr = elephantGun
|
||||
|
||||
autoAmr :: Item
|
||||
autoAmr = amr
|
||||
& itName .~ "AUTOAMR"
|
||||
& itType .~ AUTOAMR
|
||||
& itType . iyBase .~ AUTOAMR
|
||||
& itUse . useMods %~ ((ammoCheckI :) . tail)
|
||||
|
||||
sniperRifle :: Item
|
||||
sniperRifle = elephantGun
|
||||
& itName .~ "SNIPERRIFLE"
|
||||
& itType .~ SNIPERRIFLE
|
||||
& itType . iyBase .~ SNIPERRIFLE
|
||||
& itParams . gunBarrels .~ SingleBarrel 0
|
||||
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5}
|
||||
& itUse . heldScroll .~ zoomLongGun
|
||||
@@ -137,8 +133,7 @@ sniperRifle = elephantGun
|
||||
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1}
|
||||
machineGun :: Item
|
||||
machineGun = bangRod
|
||||
& itName .~ "MACHINEGUN"
|
||||
& itType .~ MACHINEGUN
|
||||
& itType . iyBase .~ MACHINEGUN
|
||||
& itUse .~ (ruseAmmoParamsRate 25 NoHammer
|
||||
[ ammoCheckI
|
||||
, rateIncAB (torqueBeforeAtLeast 0.1 0.1) withTorqueAfter
|
||||
|
||||
@@ -41,11 +41,7 @@ bangStickSoundChoice it
|
||||
|
||||
bangStick :: Int -> Item
|
||||
bangStick i = defaultGun
|
||||
{ _itName = case i of
|
||||
1 -> "BANGSTICK"
|
||||
_ -> "BANGSTICKx"++ show i
|
||||
, _itType = BANGSTICK i
|
||||
, _itConsumption = defaultAmmo
|
||||
{ _itConsumption = defaultAmmo
|
||||
{ _laType = basicBullet
|
||||
, _laMax = i
|
||||
, _laReloadTime = 10
|
||||
@@ -62,8 +58,6 @@ bangStick i = defaultGun
|
||||
-- , applyInaccuracy
|
||||
, withRecoil
|
||||
]
|
||||
, _itID = Nothing
|
||||
, _itInvColor = white
|
||||
, _itParams = BulletShooter
|
||||
{ _muzVel = 0.8
|
||||
, _rifling = 0.8
|
||||
@@ -89,6 +83,7 @@ bangStick i = defaultGun
|
||||
<> stickClip it
|
||||
}
|
||||
}
|
||||
& itType . iyBase .~ BANGSTICK i
|
||||
baseStickShapeX :: Int -> Shape
|
||||
baseStickShapeX i = foldMap f [0..i-1]
|
||||
where
|
||||
@@ -115,9 +110,7 @@ stickClip it = case it ^? itConsumption . laLoaded of
|
||||
|
||||
revolver :: Item
|
||||
revolver = pistol
|
||||
{ _itName = "REVOLVER"
|
||||
, _itType = REVOLVER
|
||||
, _itConsumption = defaultAmmo
|
||||
{ _itConsumption = defaultAmmo
|
||||
{ _laType = basicBullet
|
||||
, _laMax = 6
|
||||
, _laLoaded = 0
|
||||
@@ -126,6 +119,7 @@ revolver = pistol
|
||||
}
|
||||
}
|
||||
& itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> revolverClip it)
|
||||
& itType . iyBase .~ REVOLVER
|
||||
|
||||
revolverClip :: Item -> Shape
|
||||
revolverClip it = case it ^? itConsumption . laLoaded of
|
||||
@@ -170,9 +164,7 @@ smgAfterHamMods =
|
||||
|
||||
pistol :: Item
|
||||
pistol = (bangStick 1)
|
||||
{ _itName = "PISTOL"
|
||||
, _itType = PISTOL
|
||||
, _itConsumption = defaultAmmo
|
||||
{ _itConsumption = defaultAmmo
|
||||
{ _laType = basicBullet
|
||||
, _laMax = 15
|
||||
, _laLoaded = 0
|
||||
@@ -183,8 +175,6 @@ pistol = (bangStick 1)
|
||||
(ammoHammerCheck : pistolAfterHamMods)
|
||||
-- , _itZoom = defaultItZoom
|
||||
-- , _itEquipPict = pictureWeaponAim pistolPic
|
||||
, _itID = Nothing
|
||||
, _itInvColor = white
|
||||
} & itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it)
|
||||
& itParams %~
|
||||
( ( muzVel .~ 0.8 )
|
||||
@@ -194,25 +184,23 @@ pistol = (bangStick 1)
|
||||
. ( recoil .~ 10 )
|
||||
. ( torqueAfter .~ 0.2 )
|
||||
)
|
||||
& itType . iyBase .~ PISTOL
|
||||
autoPistol :: Item
|
||||
autoPistol = pistol
|
||||
& itUse . useMods .~ (ammoCheckI : pistolAfterHamMods)
|
||||
& itName .~ "AUTOPISTOL"
|
||||
& itType .~ AUTOPISTOL
|
||||
& itModules . at ModAutoMag ?~ DefaultModule
|
||||
& itType . iyBase .~ AUTOPISTOL
|
||||
& itType . iyModules . at ModAutoMag ?~ EMPTYMODULE
|
||||
machinePistol :: Item
|
||||
machinePistol = autoPistol
|
||||
& itUse . useDelay . rateMax .~ 2
|
||||
& itUse . useMods .~ (ammoCheckI : machinePistolAfterHamMods)
|
||||
& itName .~ "MACHINEPISTOL"
|
||||
& itType .~ MACHINEPISTOL
|
||||
& itModules . at ModAutoMag .~ Nothing
|
||||
& itType . iyBase .~ MACHINEPISTOL
|
||||
& itType . iyModules . at ModAutoMag .~ Nothing
|
||||
& itParams . recoil .~ 20
|
||||
smg :: Item
|
||||
smg = autoPistol -- & some parameter affecting stability
|
||||
& itUse . useMods .~ (ammoCheckI : smgAfterHamMods)
|
||||
& itName .~ "SMG"
|
||||
& itType .~ SMG
|
||||
& itType . iyBase .~ SMG
|
||||
& itUse . useAim . aimStance .~ TwoHandTwist
|
||||
& itDimension . dimPortage . handlePos .~ 2
|
||||
& itParams . torqueAfter .~ 0.05
|
||||
@@ -220,9 +208,7 @@ smg = autoPistol -- & some parameter affecting stability
|
||||
<> makeTinClipAt 0 (V3 7 (-2) 0) it)
|
||||
revolverX :: Int -> Item
|
||||
revolverX i = revolver
|
||||
{ _itName = "REVx"++show i
|
||||
, _itType = REVOLVERX i
|
||||
, _itUse = ruseAmmoParamsRate 8 upHammer
|
||||
{ _itUse = ruseAmmoParamsRate 8 upHammer
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
-- rather than locking the inventory, a better solution may be to check
|
||||
@@ -238,3 +224,4 @@ revolverX i = revolver
|
||||
, withRecoil
|
||||
]
|
||||
} & itConsumption . laMax .~ i * 6
|
||||
& itType . iyBase .~ REVOLVERX i
|
||||
|
||||
Reference in New Issue
Block a user