Trippy flamer

This commit is contained in:
2021-08-28 14:33:23 +01:00
parent 882a8e9824
commit 3a8b28a916
10 changed files with 81 additions and 28 deletions
+7 -6
View File
@@ -290,7 +290,7 @@ hvAutoGun = defaultAutoGun
, _itUse = useAmmoParams
, _itUseModifiers =
[ ammoCheckI
, rateIncABI 24 7 (torqueBeforeForcedI 0.1) (torqueAfterI 0.2)
, rateIncABI 24 7 (torqueBeforeAtLeast 0.1 0.1) (torqueAfterI 0.2)
, withSoundI longGunSound
, withThinSmokeI
, withMuzFlareI
@@ -347,8 +347,8 @@ miniGun = defaultAutoGun
, _wpLoadedAmmo = 1500
, _wpReloadTime = 200
, _wpReloadState = 0
, _wpMaxWarmUp = 50
, _itUseRate = 1
, _wpMaxWarmUp = 100
, _itUseRate = 0
, _itUseTime = 0
, _itUse = useAmmoParamsVelMod vm4
, _itUseModifiers =
@@ -358,8 +358,8 @@ miniGun = defaultAutoGun
, withRecoilI 25
, withSoundForI 28 2
, torqueAfterI 0.05
--, withSidePushI 53
--, withRandomOffsetI 12
, withSidePushI 53
, withRandomOffsetI 12
, trigDoAlso (useAmmoParamsVelMod vm1)
--, torqueBeforeForcedI 0.001
, withSidePushI 52
@@ -565,7 +565,8 @@ flamer = defaultAutoGun
, _itUseModifiers =
[ ammoUseCheckI
, withSidePushI 5
, withSidePushAfterI 10
, withTempLight 1 100 (V3 1 0 0)
--, withSidePushAfterI 20
]
, _wpSpread = 0
, _wpRange = 8
+1 -1
View File
@@ -34,7 +34,7 @@ autoGun = defaultAutoGun
[ ammoCheckI
, useTimeCheckI
, charFiringStratI
[('M', torqueBeforeForcedI 0.05)
[('M', torqueBefore 0.05)
,('S', hammerCheckI)
]
, withSoundI autoGunSound
+1 -1
View File
@@ -31,7 +31,7 @@ bezierGun = defaultGun
, useAmmo 1
, withMuzFlareI
. withRecoilI 40
. torqueBeforeForcedI 0.05
. torqueBefore 0.05
]
, _itFloorPict = onLayer FlItLayer bezierGunPic
, _itEquipPict = pictureWeaponOnAim bezierGunPic
+44 -13
View File
@@ -5,10 +5,12 @@ module Dodge.Item.Weapon.TriggerType
, withMuzFlareI
, withOldDir
, trigDoAlso
, withTempLight
--, withVelWthHiteff
, ammoUseCheckI
, rateIncABI
, torqueBeforeForcedI
, torqueBefore
, torqueBeforeAtLeast
, torqueAfterI
, withSoundI
, withSoundForI
@@ -38,6 +40,7 @@ import Dodge.WorldEvent.Cloud
import Dodge.RandomHelp
import Dodge.Item.Attachment.Data
import Dodge.Item.Data
import Dodge.Default
import Geometry
import System.Random
@@ -162,23 +165,25 @@ Applied before the underlying effect. -}
withSidePushI
:: Float -- ^ Maximal possible side push amount
-> ChainEffect
withSidePushI maxSide eff item cr w = eff item cr $
withSidePushI maxSide eff item cr w = eff item (push cr) $
w & creatures . ix cid %~ push
& randGen .~ g
where
cid = _crID cr
push = over crPos (+.+ rotateV (_crDir cr) (V2 0 (pushAmount / _crMass cr)))
(pushAmount, _) = randomR (-maxSide,maxSide) $ _randGen w
(pushAmount, g) = randomR (-maxSide,maxSide) $ _randGen w
-- consider unifying the pushes using a direction vector
{- | Pushes a creature sideways by a random amount.
Applied after the underlying effect. -}
withSidePushAfterI
:: Float -- ^ Maximal possible side push amount
-> ChainEffect
withSidePushAfterI maxSide eff item cr w = over (creatures . ix cid) push . eff item cr $ w
withSidePushAfterI maxSide eff item cr w = over (creatures . ix cid) push . eff item cr $
w & randGen .~ g
where
cid = _crID cr
push = over crPos (+.+ rotateV (_crDir cr) (V2 0 (pushAmount / _crMass cr)))
(pushAmount, _) = randomR (-maxSide,maxSide) $ _randGen w
(pushAmount, g) = randomR (-maxSide,maxSide) $ _randGen w
useAmmo
:: Int -- ^ amount of ammo to use
-> ChainEffect
@@ -253,6 +258,18 @@ shootL f cr invid w
&& _itUseTime item == 0
&& _wpLoadedAmmo item > 0
reloadCondition = _wpLoadedAmmo item == 0
withTempLight :: Int -> Float -> V3 Float -> ChainEffect
withTempLight time rad col eff item cr = eff item cr
. over tempLightSources (theTLS :)
where
theTLS = defaultTLS
{ _tlsPos = V3 x y 20
, _tlsRad=rad
, _tlsIntensity = col
, _tlsTime = time
}
V2 x y = _crPos cr +.+ 5 *.* unitVectorAtAngle (_crDir cr)
withMuzFlareI :: ChainEffect
withMuzFlareI f it cr w = tempLightForAt 3 pos . muzzleFlashAt pos2 $ f it cr w
where
@@ -278,12 +295,26 @@ withRandomOffsetI offsetAmount f item cr w = f item (cr & crPos %~ (+.+ offV)) $
where
(offsetVal , g) = randomR (-offsetAmount,offsetAmount) $ _randGen w
offV = rotateV (_crDir cr) (V2 0 offsetVal)
-- | Rotates a creature with minimum rotation at least 0.1.
-- Rotates the player creature before applying the effect, other creatures after.
torqueBeforeForcedI
:: Float -- ^ Max possible rotation (less the 0.1 forced rotation)
-- | Rotates a creature
torqueBefore
:: Float -- ^ Max possible rotation
-> ChainEffect
torqueBeforeForcedI torque feff item cr w
torqueBefore torque feff item cr w
| cid == 0 = feff item (cr & crDir +~ rot) $ w
& randGen .~ g
& creatures . ix cid . crDir +~ rot
& cameraRot +~ rot
| otherwise = feff item cr $ set randGen g $ over (creatures . ix cid . crDir) (+rot) w
where
cid = _crID cr
(rot, g) = randomR (-torque,torque) $ _randGen w
-- | Rotates a creature with minimum rotation
-- Rotates the player creature before applying the effect, other creatures after.
torqueBeforeAtLeast
:: Float -- ^ Minimal possible rotation
-> Float -- ^ Extra possible rotation
-> ChainEffect
torqueBeforeAtLeast minTorque exTorque feff item cr w
| cid == 0 = feff item (cr & crDir +~ rot') $ w
& randGen .~ g
& creatures . ix cid . crDir +~ rot'
@@ -291,9 +322,9 @@ torqueBeforeForcedI torque feff item cr w
| otherwise = feff item cr $ set randGen g $ over (creatures . ix cid . crDir) (+rot') w
where
cid = _crID cr
(rot, g) = randomR (-torque,torque) $ _randGen w
rot' | rot < 0 = rot - 0.1
| otherwise = rot + 0.1
(rot, g) = randomR (-exTorque,exTorque) $ _randGen w
rot' | rot < 0 = rot - minTorque
| otherwise = rot + minTorque
-- | Rotate a randomly creature after applying an effect.
torqueAfterI
:: Float -- ^ Max possible rotation