Start moving item records out into functions
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -82,7 +82,7 @@ data HeldParams
|
|||||||
= DefaultHeldParams
|
= DefaultHeldParams
|
||||||
| GasSprayParams
|
| GasSprayParams
|
||||||
{ _gasCreation :: GasCreate
|
{ _gasCreation :: GasCreate
|
||||||
, _recoil :: Float
|
-- , _recoil :: Float
|
||||||
, _torqueAfter :: Float
|
, _torqueAfter :: Float
|
||||||
, _randomOffset :: Float
|
, _randomOffset :: Float
|
||||||
, _sidePush :: Float
|
, _sidePush :: Float
|
||||||
@@ -96,7 +96,7 @@ data HeldParams
|
|||||||
| BulletShooterParams
|
| BulletShooterParams
|
||||||
{ _muzVel :: GenFloat
|
{ _muzVel :: GenFloat
|
||||||
, _rifling :: GenFloat
|
, _rifling :: GenFloat
|
||||||
, _recoil :: Float
|
-- , _recoil :: Float
|
||||||
, _torqueAfter :: Float
|
, _torqueAfter :: Float
|
||||||
, _randomOffset :: Float
|
, _randomOffset :: Float
|
||||||
, _sidePush :: Float
|
, _sidePush :: Float
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ defaultHeldUse = UseHeld
|
|||||||
, _heldParams = BulletShooterParams
|
, _heldParams = BulletShooterParams
|
||||||
{ _muzVel = ConstFloat 0.8
|
{ _muzVel = ConstFloat 0.8
|
||||||
, _rifling = ConstFloat 0.8
|
, _rifling = ConstFloat 0.8
|
||||||
, _recoil = 10
|
-- , _recoil = 10
|
||||||
, _torqueAfter = 0.2
|
, _torqueAfter = 0.2
|
||||||
, _randomOffset = 0
|
, _randomOffset = 0
|
||||||
, _sidePush = 0
|
, _sidePush = 0
|
||||||
|
|||||||
+48
-2
@@ -198,8 +198,54 @@ applySoundCME itm cr = fromMaybe id $ do
|
|||||||
applyRecoil :: Item -> Creature -> World -> World
|
applyRecoil :: Item -> Creature -> World -> World
|
||||||
applyRecoil itm cr = cWorld . lWorld . creatures . ix (_crID cr) %~ pushback
|
applyRecoil itm cr = cWorld . lWorld . creatures . ix (_crID cr) %~ pushback
|
||||||
where
|
where
|
||||||
recoilAmount = fromMaybe 0 $ itm ^? itUse . heldParams . recoil
|
-- recoilAmount = fromMaybe 0 $ itm ^? itUse . heldParams . recoil
|
||||||
pushback = over crPos (+.+ rotateV (_crDir cr) (V2 ((- recoilAmount) / _crMass cr) 0))
|
pushback = over crPos (+.+ rotateV (_crDir cr) (V2 ((- recoilAmount itm) / _crMass cr) 0))
|
||||||
|
|
||||||
|
recoilAmount :: Item -> Float
|
||||||
|
recoilAmount itm
|
||||||
|
| HELD hit <- itm ^. itType = case hit of
|
||||||
|
BANGSTICK _ -> 25
|
||||||
|
REWINDER -> 0
|
||||||
|
TIMESTOPPER -> 0
|
||||||
|
TIMESCROLLER -> 0
|
||||||
|
PISTOL -> 10
|
||||||
|
MACHINEPISTOL -> 15
|
||||||
|
AUTOPISTOL -> 10
|
||||||
|
SMG -> 10
|
||||||
|
BANGCONE -> 150
|
||||||
|
BLUNDERBUSS -> 150
|
||||||
|
GRAPECANNON i -> 150 + fromIntegral i * 50
|
||||||
|
MINIGUNX i -> 10 * fromIntegral i
|
||||||
|
VOLLEYGUN _ -> 30
|
||||||
|
RIFLE -> 50
|
||||||
|
ALTERIFLE -> 50
|
||||||
|
AUTORIFLE -> 50
|
||||||
|
BURSTRIFLE -> 50
|
||||||
|
BANGROD -> 50
|
||||||
|
ELEPHANTGUN -> 50
|
||||||
|
AMR -> 50
|
||||||
|
AUTOAMR -> 50
|
||||||
|
SNIPERRIFLE -> 50
|
||||||
|
FLAMESPITTER -> 0
|
||||||
|
FLAMETHROWER -> 0
|
||||||
|
FLAMETORRENT -> 0
|
||||||
|
FLAMEWALL -> 0
|
||||||
|
BLOWTORCH -> 0
|
||||||
|
SPARKGUN -> 0
|
||||||
|
TESLAGUN -> 0
|
||||||
|
LASER -> 0
|
||||||
|
TRACTORGUN -> 0
|
||||||
|
RLAUNCHER -> 0
|
||||||
|
RLAUNCHERX _ -> 0
|
||||||
|
GLAUNCHER -> 0
|
||||||
|
POISONSPRAYER -> 0
|
||||||
|
SHATTERGUN -> 0
|
||||||
|
TORCH -> 0
|
||||||
|
FLATSHIELD -> 0
|
||||||
|
KEYCARD _ -> 0
|
||||||
|
BLINKER -> 0
|
||||||
|
BLINKERUNSAFE -> 0
|
||||||
|
| otherwise = 0
|
||||||
|
|
||||||
applySidePush :: Float -> Creature -> World -> World
|
applySidePush :: Float -> Creature -> World -> World
|
||||||
applySidePush 0 _ w = w
|
applySidePush 0 _ w = w
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ defaultBangCane :: Item
|
|||||||
defaultBangCane =
|
defaultBangCane =
|
||||||
defaultBulletWeapon
|
defaultBulletWeapon
|
||||||
& itUse . heldParams . rifling .~ ConstFloat 0.9
|
& itUse . heldParams . rifling .~ ConstFloat 0.9
|
||||||
& itUse . heldParams . recoil .~ 50
|
-- & itUse . heldParams . recoil .~ 50
|
||||||
& itUse . heldParams . torqueAfter .~ 0.1
|
& itUse . heldParams . torqueAfter .~ 0.1
|
||||||
& itUse . heldDelay . rateMax .~ 6
|
& itUse . heldDelay . rateMax .~ 6
|
||||||
-- & itUse . heldMods .~ BangCaneMod
|
-- & itUse . heldMods .~ BangCaneMod
|
||||||
@@ -31,7 +31,6 @@ defaultBangCane =
|
|||||||
volleyGun :: Int -> Item
|
volleyGun :: Int -> Item
|
||||||
volleyGun i =
|
volleyGun i =
|
||||||
defaultBangCane
|
defaultBangCane
|
||||||
-- & itUse . heldMods .~ VolleyGunMod
|
|
||||||
& itUse . heldAim . aimWeight .~ 6
|
& itUse . heldAim . aimWeight .~ 6
|
||||||
& itUse . heldAim . aimRange .~ 1
|
& itUse . heldAim . aimRange .~ 1
|
||||||
& itUse . heldAim . aimStance .~ TwoHandFlat
|
& itUse . heldAim . aimStance .~ TwoHandFlat
|
||||||
@@ -46,7 +45,7 @@ volleyGun i =
|
|||||||
)
|
)
|
||||||
& itUse . heldParams . weaponInvLock .~ i + 1
|
& itUse . heldParams . weaponInvLock .~ i + 1
|
||||||
& itUse . heldParams . torqueAfter .~ 0.1
|
& itUse . heldParams . torqueAfter .~ 0.1
|
||||||
& itUse . heldParams . recoil .~ 30
|
-- & itUse . heldParams . recoil .~ 30
|
||||||
& itType .~ HELD (VOLLEYGUN i)
|
& itType .~ HELD (VOLLEYGUN i)
|
||||||
& itAmmoSlots .~ IM.fromList (zip [0..i-1] $ repeat BulletAmmo)
|
& itAmmoSlots .~ IM.fromList (zip [0..i-1] $ repeat BulletAmmo)
|
||||||
& itUse . heldParams . weaponRepeat .~ [1..i-1]
|
& itUse . heldParams . weaponRepeat .~ [1..i-1]
|
||||||
@@ -106,7 +105,7 @@ miniGunX i =
|
|||||||
& itUse . heldAim . aimMuzzles
|
& itUse . heldAim . aimMuzzles
|
||||||
.~ replicate i
|
.~ replicate i
|
||||||
(Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet (UseExactly 1) 0)
|
(Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet (UseExactly 1) 0)
|
||||||
& itUse . heldParams . recoil .~ 10 * fromIntegral i
|
-- & itUse . heldParams . recoil .~ 10 * fromIntegral i
|
||||||
& itUse . heldParams . torqueAfter .~ 0.04 + 0.02 * fromIntegral i
|
& itUse . heldParams . torqueAfter .~ 0.04 + 0.02 * fromIntegral i
|
||||||
& itUse . heldParams . sidePush .~ 10 * fromIntegral i
|
& itUse . heldParams . sidePush .~ 10 * fromIntegral i
|
||||||
& itUse . heldParams . randomOffset .~ 10
|
& itUse . heldParams . randomOffset .~ 10
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ bangCone =
|
|||||||
& itUse . heldAim . aimMuzzles . ix 0 . mzFlareType .~ BasicFlare
|
& itUse . heldAim . aimMuzzles . ix 0 . mzFlareType .~ BasicFlare
|
||||||
& itUse . heldParams . muzVel .~ UniRandFloat 0.5 0.8
|
& itUse . heldParams . muzVel .~ UniRandFloat 0.5 0.8
|
||||||
& itUse . heldParams . rifling .~ UniRandFloat 0.3 0.8
|
& itUse . heldParams . rifling .~ UniRandFloat 0.3 0.8
|
||||||
& itUse . heldParams . recoil .~ 150
|
-- & itUse . heldParams . recoil .~ 150
|
||||||
& itUse . heldParams . torqueAfter .~ 0.1
|
& itUse . heldParams . torqueAfter .~ 0.1
|
||||||
& itUse . heldParams . randomOffset .~ 12
|
& itUse . heldParams . randomOffset .~ 12
|
||||||
& itUse . heldParams . bulGunSound ?~ (bangEchoS,0)
|
& itUse . heldParams . bulGunSound ?~ (bangEchoS,0)
|
||||||
@@ -37,6 +37,6 @@ grapeCannon :: Int -> Item
|
|||||||
grapeCannon i =
|
grapeCannon i =
|
||||||
blunderbuss
|
blunderbuss
|
||||||
& itType .~ HELD (GRAPECANNON i)
|
& itType .~ HELD (GRAPECANNON i)
|
||||||
& itUse . heldParams . recoil .~ (150 + fromIntegral i * 50)
|
-- & itUse . heldParams . recoil .~ (150 + fromIntegral i * 50)
|
||||||
& itUse . heldParams . torqueAfter .~ (0.1 + 0.2 * fromIntegral i)
|
& itUse . heldParams . torqueAfter .~ (0.1 + 0.2 * fromIntegral i)
|
||||||
& itUse . heldParams . randomOffset .~ (12 + 4 * fromIntegral i)
|
& itUse . heldParams . randomOffset .~ (12 + 4 * fromIntegral i)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ rLauncher =
|
|||||||
& itType .~ HELD RLAUNCHER
|
& itType .~ HELD RLAUNCHER
|
||||||
& itUse . heldParams . muzVel .~ ConstFloat 0
|
& itUse . heldParams . muzVel .~ ConstFloat 0
|
||||||
& itUse . heldParams . rifling .~ ConstFloat 0
|
& itUse . heldParams . rifling .~ ConstFloat 0
|
||||||
& itUse . heldParams . recoil .~ 0
|
-- & itUse . heldParams . recoil .~ 0
|
||||||
& itUse . heldParams . torqueAfter .~ 0
|
& itUse . heldParams . torqueAfter .~ 0
|
||||||
& itUse . heldParams . bulGunSound ?~ (tap4S, 0)
|
& itUse . heldParams . bulGunSound ?~ (tap4S, 0)
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ bangRod :: Item
|
|||||||
bangRod =
|
bangRod =
|
||||||
defaultBulletWeapon
|
defaultBulletWeapon
|
||||||
& itUse . heldParams . rifling .~ ConstFloat 1
|
& itUse . heldParams . rifling .~ ConstFloat 1
|
||||||
& itUse . heldParams . recoil .~ 50
|
-- & itUse . heldParams . recoil .~ 50
|
||||||
& itUse . heldParams . torqueAfter .~ 0.3
|
& itUse . heldParams . torqueAfter .~ 0.3
|
||||||
& itUse . heldParams . bulGunSound ?~ (bangEchoS,0)
|
& itUse . heldParams . bulGunSound ?~ (bangEchoS,0)
|
||||||
& itUse . heldDelay . rateMax .~ 12
|
& itUse . heldDelay . rateMax .~ 12
|
||||||
@@ -39,7 +39,7 @@ elephantGun =
|
|||||||
& itType .~ HELD ELEPHANTGUN
|
& itType .~ HELD ELEPHANTGUN
|
||||||
& itUse . heldAim . aimStance .~ TwoHandUnder
|
& itUse . heldAim . aimStance .~ TwoHandUnder
|
||||||
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0.05
|
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0.05
|
||||||
& itUse . heldParams . recoil .~ 50
|
-- & itUse . heldParams . recoil .~ 50
|
||||||
|
|
||||||
amr :: Item
|
amr :: Item
|
||||||
amr =
|
amr =
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ poisonSprayer =
|
|||||||
& itType .~ HELD POISONSPRAYER
|
& itType .~ HELD POISONSPRAYER
|
||||||
& itAmmoSlots .~ singleAmmo GasAmmo
|
& itAmmoSlots .~ singleAmmo GasAmmo
|
||||||
& itUse . heldParams . gasCreation .~ CreatePoisonGas --aGasCloud
|
& itUse . heldParams . gasCreation .~ CreatePoisonGas --aGasCloud
|
||||||
& itUse . heldParams . recoil .~ 0
|
-- & itUse . heldParams . recoil .~ 0
|
||||||
& itUse . heldParams . torqueAfter .~ 0
|
& itUse . heldParams . torqueAfter .~ 0
|
||||||
& itUse . heldParams . randomOffset .~ 0
|
& itUse . heldParams . randomOffset .~ 0
|
||||||
& itUse . heldParams . sidePush .~ 0
|
& itUse . heldParams . sidePush .~ 0
|
||||||
@@ -91,7 +91,7 @@ flameThrower =
|
|||||||
& itType .~ HELD FLAMETHROWER
|
& itType .~ HELD FLAMETHROWER
|
||||||
& itUse . heldParams .~ GasSprayParams
|
& itUse . heldParams .~ GasSprayParams
|
||||||
{_gasCreation = CreateFlame
|
{_gasCreation = CreateFlame
|
||||||
, _recoil = 0
|
-- , _recoil = 0
|
||||||
, _torqueAfter = 0
|
, _torqueAfter = 0
|
||||||
, _randomOffset = 0
|
, _randomOffset = 0
|
||||||
, _sidePush = 25
|
, _sidePush = 25
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import LensHelp
|
|||||||
bangStick :: Int -> Item
|
bangStick :: Int -> Item
|
||||||
bangStick i =
|
bangStick i =
|
||||||
defaultBulletWeapon
|
defaultBulletWeapon
|
||||||
& itUse . heldParams . recoil .~ 25
|
-- & itUse . heldParams . recoil .~ 25
|
||||||
& itUse . heldParams . torqueAfter .~ 0.18 + 0.02 * fromIntegral i
|
& itUse . heldParams . torqueAfter .~ 0.18 + 0.02 * fromIntegral i
|
||||||
& itType .~ HELD (BANGSTICK i)
|
& itType .~ HELD (BANGSTICK i)
|
||||||
& itUse . heldDelay . rateMax .~ 8
|
& itUse . heldDelay . rateMax .~ 8
|
||||||
@@ -49,7 +49,7 @@ pistol =
|
|||||||
& itUse . heldParams
|
& itUse . heldParams
|
||||||
%~ ( (muzVel .~ ConstFloat 0.8)
|
%~ ( (muzVel .~ ConstFloat 0.8)
|
||||||
. (rifling .~ ConstFloat 0.8)
|
. (rifling .~ ConstFloat 0.8)
|
||||||
. (recoil .~ 10)
|
-- . (recoil .~ 10)
|
||||||
. (torqueAfter .~ 0.2)
|
. (torqueAfter .~ 0.2)
|
||||||
. (sidePush .~ 50)
|
. (sidePush .~ 50)
|
||||||
)
|
)
|
||||||
@@ -67,7 +67,7 @@ machinePistol =
|
|||||||
autoPistol
|
autoPistol
|
||||||
& itUse . heldDelay .~ WarmUpNoDelay{_warmTime = 0, _warmMax = 50, _warmSound = crankSlowS}
|
& itUse . heldDelay .~ WarmUpNoDelay{_warmTime = 0, _warmMax = 50, _warmSound = crankSlowS}
|
||||||
& itType .~ HELD MACHINEPISTOL
|
& itType .~ HELD MACHINEPISTOL
|
||||||
& itUse . heldParams . recoil .~ 20
|
-- & itUse . heldParams . recoil .~ 20
|
||||||
|
|
||||||
smg :: Item
|
smg :: Item
|
||||||
smg =
|
smg =
|
||||||
|
|||||||
+3
-1
@@ -234,13 +234,15 @@ listControls =
|
|||||||
, ("<wheelscroll>", "SELECT ITEM")
|
, ("<wheelscroll>", "SELECT ITEM")
|
||||||
, ("<space>", "PICKUP ITEM")
|
, ("<space>", "PICKUP ITEM")
|
||||||
, ("f", "DROP ITEM")
|
, ("f", "DROP ITEM")
|
||||||
, ("<ctrl>+<wheelscroll>", "SWAP ITEMS")
|
, ("<caps>+<wheelscroll>", "SWAP ITEMS")
|
||||||
, ("<shift>&q|e|0-9", "SET HOTKEY")
|
, ("<shift>&q|e|0-9", "SET HOTKEY")
|
||||||
, ("q|e|0-9", "USE HOTKEY")
|
, ("q|e|0-9", "USE HOTKEY")
|
||||||
|
, ("<caps>&q|e|0-9", "JUMP TO HOTKEY")
|
||||||
, ("c", "COMBINE ITEMS")
|
, ("c", "COMBINE ITEMS")
|
||||||
-- , ("x", "EXAMINE ITEMS")
|
-- , ("x", "EXAMINE ITEMS")
|
||||||
-- , ("m", "DISPLAY MAP")
|
-- , ("m", "DISPLAY MAP")
|
||||||
, ("p|<esc>", "PAUSE")
|
, ("p|<esc>", "PAUSE")
|
||||||
|
, ("<lmb>", "SELECT/MOVE ITEMS")
|
||||||
, ("<F1>", "NORMAL CAMERA")
|
, ("<F1>", "NORMAL CAMERA")
|
||||||
, ("<F2>", "DEBUG CAMERA")
|
, ("<F2>", "DEBUG CAMERA")
|
||||||
, ("<F5>", "QUICKSAVE")
|
, ("<F5>", "QUICKSAVE")
|
||||||
|
|||||||
Reference in New Issue
Block a user