Beef up minigun

This commit is contained in:
2021-08-28 12:09:39 +01:00
parent 1168da0531
commit 882a8e9824
17 changed files with 263 additions and 237 deletions
+90 -34
View File
@@ -60,8 +60,11 @@ pistol = defaultGun
, _itUseTime = 0
, _itUse = useAmmoParams
, _itUseModifiers =
[ hammerCheckI
, shootWithSoundI 0
[ ammoCheckI
, hammerCheckI
, useTimeCheckI
, withSoundI 0
, useAmmo 1
-- , withRandomDirI 0.1
, withMuzFlareI
]
@@ -108,7 +111,7 @@ rezGun = defaultGun
, _wpReloadState = 0
, _itUseRate = 0
, _itUseTime = 0
, _itUse = \_ -> aTeslaArc
, _itUse = const aTeslaArc
, _itUseModifiers =
[]
, _wpSpread = 0.001
@@ -134,9 +137,12 @@ teslaGun = defaultGun
, _wpReloadState = 0
, _itUseRate = 0
, _itUseTime = 0
, _itUse = \_ -> aTeslaArc
, _itUse = const aTeslaArc
, _itUseModifiers =
[ shootWithSoundForI 25 1
[ ammoCheckI
, useTimeCheckI
, withSoundForI 25 1
, useAmmo 1
]
, _wpSpread = 0.001
, _wpRange = 20
@@ -165,9 +171,12 @@ lasGun = defaultAutoGun
, _wpReloadState = 0
, _itUseRate = 0
, _itUseTime = 0
, _itUse = \_ -> aLaser
, _itUse = const aLaser
, _itUseModifiers =
[ shootWithSoundForI 24 1
[ ammoCheckI
, useTimeCheckI
, withSoundForI 24 1
, useAmmo 1
]
, _wpSpread = 0.001
, _wpRange = 20
@@ -255,9 +264,10 @@ remoteLauncher = defaultGun
, _wpReloadState = 0
, _itUseRate = 10
, _itUseTime = 0
, _itUse = \_ -> fireRemoteLauncher
, _itUse = const fireRemoteLauncher
, _itUseModifiers =
[ hammerCheckI
[ ammoCheckI
, hammerCheckI
]
, _wpSpread = 0.02
, _wpRange = 20
@@ -306,7 +316,10 @@ ltAutoGun = defaultAutoGun
, _itUseTime = 0
, _itUse = useAmmoParams
, _itUseModifiers =
[ shootWithSoundI 0
[ ammoCheckI
, useTimeCheckI
, withSoundI 0
, useAmmo 1
, withRandomDirI 0.3
, withSidePushI 50
, withMuzFlareI
@@ -330,22 +343,40 @@ miniGun :: Item
miniGun = defaultAutoGun
{ _itName = "MINI-G"
, _itIdentity = MiniGun
, _wpMaxAmmo = 150
, _wpLoadedAmmo = 150
, _wpMaxAmmo = 1500
, _wpLoadedAmmo = 1500
, _wpReloadTime = 200
, _wpReloadState = 0
, _wpMaxWarmUp = 100
, _wpMaxWarmUp = 50
, _itUseRate = 1
, _itUseTime = 0
, _itUse = useAmmoParams
, _itUse = useAmmoParamsVelMod vm4
, _itUseModifiers =
[ ammoCheckI
, withWarmUpI 26
, shootWithSoundForI 28 2
, torqueBeforeForcedI 0.1
, useTimeCheckI
, withRecoilI 25
, withSoundForI 28 2
, torqueAfterI 0.05
--, withSidePushI 53
--, withRandomOffsetI 12
, trigDoAlso (useAmmoParamsVelMod vm1)
--, torqueBeforeForcedI 0.001
, withSidePushI 52
, withRandomOffsetI 11
, withOldDir od1
, trigDoAlso (useAmmoParamsVelMod vm2)
--, torqueBeforeForcedI 0.001
, withSidePushI 51
, withRandomOffsetI 10
, withOldDir od2
, trigDoAlso (useAmmoParamsVelMod vm3)
, useAmmo 4
--, torqueBeforeForcedI 0.001
, withSidePushI 50
, withRandomOffsetI 9
, withMuzFlareI
, withOldDir od3
]
, _wpRange = 20
, _itFloorPict = onLayer FlItLayer miniGunPict
@@ -354,6 +385,17 @@ miniGun = defaultAutoGun
, _itEquipPict = pictureWeaponOnAim miniGunPict
, _wpAmmo = basicBullet
}
where
[vm1,vm2,vm3,vm4] =
[ 0.25
, 0.5
, 0.75
, 1
]
[od1,od2,od3] =
[ 0.25, 0.5, 0.9]
--[ 0.75, 0.5, 0.25]
--[ 0, 0, 0]
miniGunPict :: Picture
miniGunPict = pictures
[ translate 5 0 . color red $ polygon $ rectNESW 9 7 (-9) (-5)
@@ -372,17 +414,21 @@ spreadGun = defaultGun
--, _itUse = \_ -> spreadNumVelWthHiteff spreadGunSpread 9 (V2 30 0) 2 basicBulletEffect
, _itUse = useAmmoParams
, _itUseModifiers =
[ shootWithSoundI shotgunSound
[ ammoCheckI
, hammerCheckI
, useTimeCheckI
, withSoundI shotgunSound
, useAmmo 1
, withRecoilI 100
, withMuzFlareI
, spreadNumI
]
, _wpSpread = spreadGunSpread
, _wpRange = 20
, _itFloorPict = onLayer FlItLayer $ spreadGunPic
, _itFloorPict = onLayer FlItLayer spreadGunPic
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itEquipPict = pictureWeaponOnAim $ spreadGunPic
, _itEquipPict = pictureWeaponOnAim spreadGunPic
, _wpAmmo = basicBullet
, _wpNumBarrels = 50
}
@@ -400,7 +446,11 @@ multGun = defaultGun
, _itUseTime = 0
, _itUse = useAmmoParams
, _itUseModifiers =
[ shootWithSoundI shotgunSound
[ ammoCheckI
, hammerCheckI
, useTimeCheckI
, withSoundI shotgunSound
, useAmmo 1
, withRecoilI 200
, withMuzFlareI
, numI
@@ -441,7 +491,11 @@ longGun = defaultGun
, _itUseTime = 0
, _itUse = useAmmoParams
, _itUseModifiers =
[ shootWithSoundI longGunSound
[ ammoCheckI
, hammerCheckI
, useTimeCheckI
, withSoundI longGunSound
, useAmmo 1
, withThickSmokeI
, torqueAfterI 0.05
, withMuzFlareI
@@ -483,9 +537,11 @@ poisonSprayer = defaultAutoGun
, _wpReloadState = 0
, _itUseRate = 0
, _itUseTime = 0
, _itUse = \_ -> aGasCloud
, _itUse = const aGasCloud
, _itUseModifiers =
[shootWithSoundI buzzSound
[ useTimeCheckI
, withSoundI buzzSound
, useAmmo 1
]
, _wpSpread = 0.3
, _wpRange = 8
@@ -535,10 +591,10 @@ blinkGun = defaultGun
, _wpReloadState = 0
, _itUseRate = 0
, _itUseTime = 0
, _itUse = \_ -> aSelf
, _itUse = const aSelf
, _itUseModifiers =
[ hammerCheckI
, ammoUseCheckI
[ ammoCheckI
, hammerCheckI
]
, _itLeftClickUse = Just $ hammerCheckL $ shootL aSelfL
, _wpSpread = 0.05
@@ -640,7 +696,7 @@ pointToItem (OnFloor flid) = floorItems . ix flid . flIt
retireRemoteRocket :: Int -> Int -> Int -> World -> World
retireRemoteRocket itid 0 pjid w =
set (pointToItem (_itemPositions w IM.! itid) . itAttachment . _Just . scopePos) (V2 0 0)
$ set (pointToItem (_itemPositions w IM.! itid) . itUse) (\_ -> fireRemoteLauncher)
$ set (pointToItem (_itemPositions w IM.! itid) . itUse) (const fireRemoteLauncher)
(w & projectiles %~ IM.delete pjid)
retireRemoteRocket itid t pjid w = setScope w
& projectiles . ix pjid . pjUpdate .~ (\_ -> retireRemoteRocket itid (t-1) pjid)
@@ -651,13 +707,12 @@ retireRemoteRocket itid t pjid w = setScope w
. _Just . scopePos .~ (pos -.- _crPos (_creatures w' IM.! cid))
_ -> w'
pos = fromMaybe (V2 0 0) $ w ^? projectiles . ix pjid . pjPos
retireRemoteBomb :: Int -> Int -> Int -> World -> World
retireRemoteBomb itid 0 pjid w = w
& pointToItem (_itemPositions w IM.! itid) %~
( (itAttachment . _Just . scopePos .~ V2 0 0)
. (itZoom .~ defaultItZoom)
. (itUse .~ (\_ -> throwRemoteBomb))
. (itUse .~ const throwRemoteBomb)
)
& projectiles %~ IM.delete pjid
retireRemoteBomb itid t pjid w = setScope w
@@ -743,7 +798,7 @@ grenade = Throwable
, _itZoom = defaultItZoom {_itAimZoomMax = f fuseTime, _itAimZoomMin = f fuseTime}
, _itEquipPict = pictureWeaponOnAim $ grenadePic fuseTime
, _itID = Nothing
, _itUseRate = 50
, _itUseRate = 25
, _itUseTime = 0
, _itAttachment = Just $ ItFuse fuseTime
, _itInvColor = white
@@ -787,7 +842,7 @@ remoteBomb = defaultThrowable
, _itFloorPict = onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
, _twMaxRange = 150
, _twAccuracy = 30
, _itUse = \_ -> throwRemoteBomb
, _itUse = const throwRemoteBomb
, _itUseModifiers =
[ hammerCheckI
]
@@ -982,7 +1037,7 @@ radar = defaultGun
, _wpReloadState = 0
, _itUseRate = 120
, _itUseTime = 0
, _itUse = \_ -> aRadarPulse
, _itUse = const aRadarPulse
, _itUseModifiers =
[ ammoUseCheckI
]
@@ -1008,7 +1063,7 @@ sonar = defaultGun
, _wpReloadState = 0
, _itUseRate = 120
, _itUseTime = 0
, _itUse = \_ -> aSonarPulse
, _itUse = const aSonarPulse
, _itUseModifiers =
[ ammoUseCheckI
]
@@ -1065,7 +1120,8 @@ spawnGun cr = defaultGun
, _itUseRate = 100
, _itUse = \_ -> spawnCrNextTo cr
, _itUseModifiers =
[ hammerCheckI
[ ammoCheckI
, hammerCheckI
]
}
spawnCrNextTo