Trippy flamer
This commit is contained in:
@@ -34,7 +34,7 @@ autoGun = defaultAutoGun
|
||||
[ ammoCheckI
|
||||
, useTimeCheckI
|
||||
, charFiringStratI
|
||||
[('M', torqueBeforeForcedI 0.05)
|
||||
[('M', torqueBefore 0.05)
|
||||
,('S', hammerCheckI)
|
||||
]
|
||||
, withSoundI autoGunSound
|
||||
|
||||
@@ -31,7 +31,7 @@ bezierGun = defaultGun
|
||||
, useAmmo 1
|
||||
, withMuzFlareI
|
||||
. withRecoilI 40
|
||||
. torqueBeforeForcedI 0.05
|
||||
. torqueBefore 0.05
|
||||
]
|
||||
, _itFloorPict = onLayer FlItLayer bezierGunPic
|
||||
, _itEquipPict = pictureWeaponOnAim bezierGunPic
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user