Cleanup, work towards unifying spayguns
This commit is contained in:
@@ -50,12 +50,14 @@ itemCombinations =
|
|||||||
|
|
||||||
, p [p 3 PIPE,o HARDWARE] bangRod
|
, p [p 3 PIPE,o HARDWARE] bangRod
|
||||||
, po [BANGROD,PLANK,HARDWARE] elephantGun
|
, po [BANGROD,PLANK,HARDWARE] elephantGun
|
||||||
|
, po [ELEPHANTGUN,HARDWARE,PRISM] sniperRifle
|
||||||
, po [ELEPHANTGUN,HARDWARE,TIN] amr
|
, po [ELEPHANTGUN,HARDWARE,TIN] amr
|
||||||
, po [ELEPHANTGUN,HARDWARE,CAN] sniperRifle
|
, po [AMR,HARDWARE,SPRING] autoAmr
|
||||||
, po [BANGROD,PLATE,DRUM,MOTOR] machineGun
|
, po [BANGROD,PLATE,DRUM,MOTOR] machineGun
|
||||||
|
|
||||||
, p [p 2 TUBE,o HARDWARE] launcher
|
, p [p 2 TUBE,o HARDWARE] launcher
|
||||||
, p [p 2 TUBE,o LAUNCHER] doubleLauncher
|
, p [p 2 TUBE,o LAUNCHER] (launcherX 2)
|
||||||
|
, p [p 2 TUBE,o $ LAUNCHERX 2] (launcherX 3)
|
||||||
, po [TRANSMITTER,MINIDISPLAY,LAUNCHER] remoteLauncher
|
, po [TRANSMITTER,MINIDISPLAY,LAUNCHER] remoteLauncher
|
||||||
|
|
||||||
, po [LIGHTER,PIPE,CAN] flameStick
|
, po [LIGHTER,PIPE,CAN] flameStick
|
||||||
@@ -155,10 +157,7 @@ moduleCombinations =
|
|||||||
amod cts str func = (cts,ItemModule [str] 1 func)
|
amod cts str func = (cts,ItemModule [str] 1 func)
|
||||||
|
|
||||||
homingLaunchers :: [Item]
|
homingLaunchers :: [Item]
|
||||||
homingLaunchers =
|
homingLaunchers = launcher : [launcherX i | i <- [2..3]]
|
||||||
[ launcher
|
|
||||||
, doubleLauncher
|
|
||||||
]
|
|
||||||
|
|
||||||
bulletWeapons :: [Item]
|
bulletWeapons :: [Item]
|
||||||
bulletWeapons = [bangStick i | i <- [1..9] ]
|
bulletWeapons = [bangStick i | i <- [1..9] ]
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ data CombineType
|
|||||||
| BANGROD
|
| BANGROD
|
||||||
| ELEPHANTGUN
|
| ELEPHANTGUN
|
||||||
| AMR
|
| AMR
|
||||||
|
| AUTOAMR
|
||||||
| SNIPERRIFLE
|
| SNIPERRIFLE
|
||||||
| MACHINEGUN
|
| MACHINEGUN
|
||||||
| FLAMESTICK
|
| FLAMESTICK
|
||||||
@@ -50,7 +51,7 @@ data CombineType
|
|||||||
| SONICGUN
|
| SONICGUN
|
||||||
| TRACTORGUN
|
| TRACTORGUN
|
||||||
| LAUNCHER
|
| LAUNCHER
|
||||||
| DOUBLELAUNCHER
|
| LAUNCHERX Int
|
||||||
-- | TRACKINGLAUNCHER
|
-- | TRACKINGLAUNCHER
|
||||||
| REMOTELAUNCHER
|
| REMOTELAUNCHER
|
||||||
| SPRAYER
|
| SPRAYER
|
||||||
|
|||||||
@@ -170,8 +170,9 @@ testInventory = IM.fromList $ zip [0..]
|
|||||||
, incendiaryModule
|
, incendiaryModule
|
||||||
, bounceModule
|
, bounceModule
|
||||||
, teleportModule
|
, teleportModule
|
||||||
|
, makeTypeCraftNum 1 LIGHTER
|
||||||
, makeTypeCraftNum 5 TUBE
|
, makeTypeCraftNum 5 TUBE
|
||||||
, makeTypeCraftNum 5 CREATURESENSOR
|
-- , makeTypeCraftNum 5 CREATURESENSOR
|
||||||
, makeTypeCraftNum 3 PRISM
|
, makeTypeCraftNum 3 PRISM
|
||||||
, makeTypeCraftNum 1 MAGNET
|
, makeTypeCraftNum 1 MAGNET
|
||||||
, makeTypeCraftNum 5 HARDWARE
|
, makeTypeCraftNum 5 HARDWARE
|
||||||
@@ -181,8 +182,8 @@ testInventory = IM.fromList $ zip [0..]
|
|||||||
, makeTypeCraftNum 3 PLANK
|
, makeTypeCraftNum 3 PLANK
|
||||||
, makeTypeCraftNum 1 MOTOR
|
, makeTypeCraftNum 1 MOTOR
|
||||||
, makeTypeCraftNum 5 MICROCHIP
|
, makeTypeCraftNum 5 MICROCHIP
|
||||||
, makeTypeCraftNum 1 TRANSMITTER
|
-- , makeTypeCraftNum 1 TRANSMITTER
|
||||||
, makeTypeCraftNum 5 AIUNIT
|
-- , makeTypeCraftNum 5 AIUNIT
|
||||||
]
|
]
|
||||||
stackedInventory :: IM.IntMap Item
|
stackedInventory :: IM.IntMap Item
|
||||||
stackedInventory = IM.fromList $ zip [0..]
|
stackedInventory = IM.fromList $ zip [0..]
|
||||||
|
|||||||
@@ -549,6 +549,14 @@ data TweakParam = TweakParam
|
|||||||
, _showTweak :: Int -> String
|
, _showTweak :: Int -> String
|
||||||
, _nameTweak :: String
|
, _nameTweak :: String
|
||||||
}
|
}
|
||||||
|
data Nozzle = Nozzle
|
||||||
|
{ _nzPressure :: Int
|
||||||
|
, _nzDir :: Float
|
||||||
|
, _nzMaxWalkAngle :: Float
|
||||||
|
, _nzCurrentWalkAngle :: Float
|
||||||
|
, _nzWalkSpeed :: Float
|
||||||
|
, _nzLength :: Float
|
||||||
|
}
|
||||||
data GunBarrels
|
data GunBarrels
|
||||||
= MultiBarrel
|
= MultiBarrel
|
||||||
{ _brlSpread :: BarrelSpread
|
{ _brlSpread :: BarrelSpread
|
||||||
@@ -579,6 +587,9 @@ data ItemParams
|
|||||||
{ _nozzleSpread :: Float
|
{ _nozzleSpread :: Float
|
||||||
, _nozzleNum :: Int
|
, _nozzleNum :: Int
|
||||||
}
|
}
|
||||||
|
| Sprayer'
|
||||||
|
{ _sprayerNozzles :: [Nozzle]
|
||||||
|
}
|
||||||
| AngleWalk
|
| AngleWalk
|
||||||
{ _maxWalkAngle :: Float
|
{ _maxWalkAngle :: Float
|
||||||
, _currentWalkAngle :: Float
|
, _currentWalkAngle :: Float
|
||||||
@@ -963,3 +974,4 @@ makeLenses ''Gust
|
|||||||
makeLenses ''GunBarrels
|
makeLenses ''GunBarrels
|
||||||
makeLenses ''ItemModule
|
makeLenses ''ItemModule
|
||||||
makeLenses ''Targeting
|
makeLenses ''Targeting
|
||||||
|
makeLenses ''Nozzle
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ module Dodge.Item.Weapon.BulletGun.Rod
|
|||||||
( bangRod
|
( bangRod
|
||||||
, elephantGun
|
, elephantGun
|
||||||
, amr
|
, amr
|
||||||
|
, autoAmr
|
||||||
, sniperRifle
|
, sniperRifle
|
||||||
, machineGun
|
, machineGun
|
||||||
) where
|
) where
|
||||||
@@ -12,8 +13,9 @@ import Dodge.Item.Weapon.BulletGun.Clip
|
|||||||
import Dodge.Default.Weapon
|
import Dodge.Default.Weapon
|
||||||
--import Dodge.Item.Weapon.InventoryDisplay
|
--import Dodge.Item.Weapon.InventoryDisplay
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
|
import Dodge.Item.Weapon.ZoomScope
|
||||||
--import Dodge.Item.Attachment
|
--import Dodge.Item.Attachment
|
||||||
--import Dodge.Item.Weapon.ExtraEffect
|
import Dodge.Item.Weapon.ExtraEffect
|
||||||
--import Dodge.Item.Weapon.InventoryDisplay
|
--import Dodge.Item.Weapon.InventoryDisplay
|
||||||
import Dodge.Item.Weapon.AmmoParams
|
import Dodge.Item.Weapon.AmmoParams
|
||||||
--import Dodge.Item.Draw
|
--import Dodge.Item.Draw
|
||||||
@@ -43,13 +45,14 @@ bangRod = defaultGun
|
|||||||
, _bore = 2
|
, _bore = 2
|
||||||
, _gunBarrels = SingleBarrel 0.1
|
, _gunBarrels = SingleBarrel 0.1
|
||||||
}
|
}
|
||||||
, _itUse = ruseAmmoParamsRate 6 upHammer
|
, _itUse = ruseAmmoParamsRate 12 upHammer
|
||||||
[ ammoHammerCheck
|
[ ammoHammerCheck
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, withSoundStart autoGunS
|
, withSoundStart bangEchoS
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, torqueAfterI 0.3
|
, torqueAfterI 0.3
|
||||||
, applyInaccuracy
|
, applyInaccuracy
|
||||||
|
, withThickSmokeI
|
||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
, withRecoilI 50
|
, withRecoilI 50
|
||||||
]
|
]
|
||||||
@@ -90,26 +93,38 @@ elephantGun = bangRod
|
|||||||
& itUse . useMods .~
|
& itUse . useMods .~
|
||||||
[ ammoHammerCheck
|
[ ammoHammerCheck
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, withSoundStart autoGunS
|
, withSoundStart bangEchoS
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, torqueAfterI 0.1
|
, torqueAfterI 0.1
|
||||||
, applyInaccuracy
|
, applyInaccuracy
|
||||||
|
, withThickSmokeI
|
||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
, withRecoilI 50
|
, withRecoilI 50
|
||||||
]
|
]
|
||||||
amr :: Item
|
amr :: Item
|
||||||
amr = elephantGun
|
amr = elephantGun
|
||||||
& itName .~ "AMR"
|
& itName .~ "ANTIMATERIELRIFLE"
|
||||||
& itType .~ AMR
|
& itType .~ AMR
|
||||||
& itConsumption . ammoBaseMax .~ 15
|
& itConsumption . ammoBaseMax .~ 15
|
||||||
& itDimension . dimSPic .~ (\it -> noPic $ baseAMRShape
|
& itDimension . dimSPic .~ (\it -> noPic $ baseAMRShape
|
||||||
<> makeTinClipAt 0 (V3 10 (-2) 0) it
|
<> makeTinClipAt 0 (V3 10 (-2) 0) it
|
||||||
)
|
)
|
||||||
|
|
||||||
|
autoAmr :: Item
|
||||||
|
autoAmr = amr
|
||||||
|
& itName .~ "AUTOAMR"
|
||||||
|
& itType .~ AUTOAMR
|
||||||
|
& itUse . useMods %~ ((ammoCheckI :) . tail)
|
||||||
|
|
||||||
sniperRifle :: Item
|
sniperRifle :: Item
|
||||||
sniperRifle = elephantGun
|
sniperRifle = elephantGun
|
||||||
& itName .~ "SNIPERRIFLE"
|
& itName .~ "SNIPERRIFLE"
|
||||||
& itType .~ SNIPERRIFLE
|
& itType .~ SNIPERRIFLE
|
||||||
& itParams . gunBarrels .~ SingleBarrel 0
|
& itParams . gunBarrels .~ SingleBarrel 0
|
||||||
|
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5}
|
||||||
|
& itScroll .~ zoomLongGun
|
||||||
|
& itScope .~ ZoomScope (V2 0 0) 0 1 False
|
||||||
|
& itTargeting .~ targetLaser
|
||||||
machineGun :: Item
|
machineGun :: Item
|
||||||
machineGun = bangRod
|
machineGun = bangRod
|
||||||
& itName .~ "MACHINEGUN"
|
& itName .~ "MACHINEGUN"
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ module Dodge.Item.Weapon.BulletGuns
|
|||||||
import Dodge.Item.Weapon.BulletGun.Stick
|
import Dodge.Item.Weapon.BulletGun.Stick
|
||||||
import Dodge.Item.Weapon.BulletGun.Cane
|
import Dodge.Item.Weapon.BulletGun.Cane
|
||||||
import Dodge.Item.Weapon.BulletGun.Rod
|
import Dodge.Item.Weapon.BulletGun.Rod
|
||||||
|
import Dodge.Item.Weapon.ZoomScope
|
||||||
--import Dodge.Item.Weapon.BulletGun.Clip
|
--import Dodge.Item.Weapon.BulletGun.Clip
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
--import Dodge.ChainEffect
|
--import Dodge.ChainEffect
|
||||||
@@ -29,7 +30,6 @@ import Dodge.Default.Weapon
|
|||||||
import Dodge.Item.Weapon.InventoryDisplay
|
import Dodge.Item.Weapon.InventoryDisplay
|
||||||
import Dodge.Default
|
import Dodge.Default
|
||||||
import Dodge.Item.Attachment
|
import Dodge.Item.Attachment
|
||||||
import Dodge.Item.Weapon.ExtraEffect
|
|
||||||
--import Dodge.Item.Weapon.InventoryDisplay
|
--import Dodge.Item.Weapon.InventoryDisplay
|
||||||
import Dodge.Item.Weapon.AmmoParams
|
import Dodge.Item.Weapon.AmmoParams
|
||||||
import Dodge.Item.Draw
|
import Dodge.Item.Draw
|
||||||
@@ -456,14 +456,8 @@ longGun = defaultGun
|
|||||||
, _itScroll = zoomLongGun
|
, _itScroll = zoomLongGun
|
||||||
, _itAttachment = NoItAttachment
|
, _itAttachment = NoItAttachment
|
||||||
, _itScope = ZoomScope (V2 0 0) 0 1 False
|
, _itScope = ZoomScope (V2 0 0) 0 1 False
|
||||||
, _itEffect = itemLaserScopeEffect
|
-- , _itEffect = itemLaserScopeEffect
|
||||||
}
|
}
|
||||||
|
|
||||||
zoomLongGun :: Float -> Creature -> Item -> Item
|
|
||||||
zoomLongGun x _
|
|
||||||
| x > 0 = itScope . scopeZoomChange %~ (max 5 . (+5))
|
|
||||||
| x < 0 = itScope . scopeZoomChange %~ (min (-5) . subtract 5)
|
|
||||||
| otherwise = id
|
|
||||||
|
|
||||||
autogunSpread :: Float
|
autogunSpread :: Float
|
||||||
autogunSpread = 0.07
|
autogunSpread = 0.07
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{-# LANGUAGE BangPatterns #-}
|
--{-# LANGUAGE BangPatterns #-}
|
||||||
{- |
|
{- |
|
||||||
Extra weapon effects, supplementing explicit use effects.
|
Extra weapon effects, supplementing explicit use effects.
|
||||||
-}
|
-}
|
||||||
module Dodge.Item.Weapon.ExtraEffect
|
module Dodge.Item.Weapon.ExtraEffect
|
||||||
( itemLaserScopeEffect
|
(-- itemLaserScopeEffect
|
||||||
, autoSonarEffect
|
autoSonarEffect
|
||||||
, autoRadarEffect
|
, autoRadarEffect
|
||||||
, targetRBPress
|
, targetRBPress
|
||||||
, targetRBCreature
|
, targetRBCreature
|
||||||
@@ -14,11 +14,10 @@ module Dodge.Item.Weapon.ExtraEffect
|
|||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.Item.Weapon.Decoration
|
--import Dodge.Item.Weapon.Decoration
|
||||||
import Dodge.Item.Weapon.UseEffect
|
import Dodge.Item.Weapon.UseEffect
|
||||||
import Dodge.Item.Weapon.LaserPath
|
import Dodge.Item.Weapon.LaserPath
|
||||||
--import Dodge.Item.Attachment.Data
|
--import Dodge.Item.Attachment.Data
|
||||||
import Dodge.WorldEvent.ThingsHit
|
|
||||||
import Dodge.Picture.Layer
|
import Dodge.Picture.Layer
|
||||||
import Dodge.Creature.Test
|
import Dodge.Creature.Test
|
||||||
import Picture
|
import Picture
|
||||||
@@ -27,43 +26,8 @@ import Geometry.Data
|
|||||||
|
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import qualified Data.IntMap.Strict as IM
|
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
import qualified SDL
|
import qualified SDL
|
||||||
{- |
|
|
||||||
Creates a laser scope and recocks the weapon.
|
|
||||||
TODO add the laser scope!
|
|
||||||
-}
|
|
||||||
itemLaserScopeEffect :: ItEffect
|
|
||||||
itemLaserScopeEffect
|
|
||||||
= ItInvEffect {_itInvEffect = f ,_itEffectCounter = 0 }
|
|
||||||
where
|
|
||||||
moveHammerUp HammerDown = HammerReleased
|
|
||||||
moveHammerUp !_ = HammerUp
|
|
||||||
f _ cr invid w
|
|
||||||
| invid == _crInvSel cr && crIsAiming' cr = w
|
|
||||||
& particles %~ (:) (makeLaserScope sp ep reloadFrac)
|
|
||||||
& creatures . ix (_crID cr) . crInv . ix invid . itUse . useHammer . hammerPosition %~ moveHammerUp
|
|
||||||
| otherwise = w
|
|
||||||
where
|
|
||||||
p = _crPos cr
|
|
||||||
d = _crDir cr
|
|
||||||
r = _crRad cr
|
|
||||||
sp = p +.+ (r + 3) *.* unitVectorAtAngle d
|
|
||||||
xp = sp +.+ 3000 *.* unitVectorAtAngle d
|
|
||||||
ep = case listToMaybe $ thingsHitLongLine sp xp w of
|
|
||||||
Just (pos,_) -> pos
|
|
||||||
Nothing -> xp
|
|
||||||
--glowPoint = case listToMaybe $ thingsHitLongLine sp xp w of
|
|
||||||
-- Just (pos,E3x2 wl) -> pos +.+ 2 *.* wallNormal wl
|
|
||||||
-- _ -> ep -.- 2 *.* unitVectorAtAngle d
|
|
||||||
wpammo = _itConsumption $ (cr ^. crInv) IM.! invid
|
|
||||||
reloadFrac
|
|
||||||
| _ammoLoaded wpammo == 0 = 1
|
|
||||||
| otherwise = case _reloadState wpammo of
|
|
||||||
Just' rs -> fromIntegral rs / fromIntegral (_reloadTime wpammo)
|
|
||||||
Nothing' -> 1
|
|
||||||
--col = mixColors reloadFrac (1-reloadFrac) red green
|
|
||||||
{- | Automatically send out radar pulses that detect walls. -}
|
{- | Automatically send out radar pulses that detect walls. -}
|
||||||
autoRadarEffect :: ItEffect
|
autoRadarEffect :: ItEffect
|
||||||
autoRadarEffect = ItInvEffect {_itInvEffect = f 50 ,_itEffectCounter = 0 }
|
autoRadarEffect = ItInvEffect {_itInvEffect = f 50 ,_itEffectCounter = 0 }
|
||||||
@@ -170,15 +134,22 @@ targetLaserDraw :: Int -> Item -> Creature -> World -> Picture
|
|||||||
targetLaserDraw _ it _ _ = fromMaybe mempty $ do
|
targetLaserDraw _ it _ _ = fromMaybe mempty $ do
|
||||||
ps <- it ^? itTargeting . tgPoints
|
ps <- it ^? itTargeting . tgPoints
|
||||||
return $ setLayer 1 $ pictures
|
return $ setLayer 1 $ pictures
|
||||||
[ setDepth 19 . color (brightX 0 0.5 red) $ thickLine 5 ps
|
[ setDepth 19 . color (brightX 0 0.5 col) $ thickLine 5 ps
|
||||||
, setDepth 19.5 . color (brightX 5 1 red) $ thickLine 1 ps
|
, setDepth 19.5 . color (brightX 5 1 col) $ thickLine 1 ps
|
||||||
]
|
]
|
||||||
|
where
|
||||||
|
wpammo = _itConsumption it
|
||||||
|
reloadFrac
|
||||||
|
| _ammoLoaded wpammo == 0 = 1
|
||||||
|
| otherwise = case _reloadState wpammo of
|
||||||
|
Just' rs -> fromIntegral rs / fromIntegral (_reloadTime wpammo)
|
||||||
|
Nothing' -> 1
|
||||||
|
col = mixColors reloadFrac (1-reloadFrac) red green
|
||||||
targetLaserUpdate :: Item -> Creature -> World -> Targeting -> Targeting
|
targetLaserUpdate :: Item -> Creature -> World -> Targeting -> Targeting
|
||||||
targetLaserUpdate _ cr w t
|
targetLaserUpdate _ cr w t
|
||||||
| SDL.ButtonRight `S.member` _mouseButtons w = t
|
| crIsAiming cr = t
|
||||||
& tgPos .~ fmap fst mp
|
& tgPos .~ fmap fst mp
|
||||||
& tgPoints .~ ps ++ [sp]
|
& tgPoints .~ sp:ps
|
||||||
& tgActive .~ True
|
& tgActive .~ True
|
||||||
| otherwise = t & tgPos %~ const Nothing
|
| otherwise = t & tgPos %~ const Nothing
|
||||||
& tgPoints .~ []
|
& tgPoints .~ []
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module Dodge.Item.Weapon.Launcher
|
module Dodge.Item.Weapon.Launcher
|
||||||
( launcher
|
( launcher
|
||||||
, doubleLauncher
|
, launcherX
|
||||||
, remoteLauncher
|
, remoteLauncher
|
||||||
, fireTrackingShell
|
, fireTrackingShell
|
||||||
) where
|
) where
|
||||||
@@ -83,25 +83,30 @@ launcher = defaultGun
|
|||||||
}
|
}
|
||||||
& itModules . at ModLauncherHoming ?~ DefaultModule
|
& itModules . at ModLauncherHoming ?~ DefaultModule
|
||||||
|
|
||||||
doubleLauncher :: Item
|
launcherX :: Int -> Item
|
||||||
doubleLauncher = launcher
|
launcherX i = launcher
|
||||||
& itName .~ "DOUBLEROCKO"
|
& itName .~ ("ROCKO-" ++ show i)
|
||||||
& itType .~ DOUBLELAUNCHER
|
& itType .~ LAUNCHERX i
|
||||||
& itUse . rUse .~ usePjCreationDouble
|
& itConsumption . ammoBaseMax .~ i
|
||||||
|
& itConsumption . ammoLoaded .~ i
|
||||||
|
& itUse . rUse .~ usePjCreationX i
|
||||||
& itUse . useMods .~
|
& itUse . useMods .~
|
||||||
[ hammerCheckI
|
[ hammerCheckI
|
||||||
, ammoCheckI
|
, ammoCheckI
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, withSoundStart tap4S
|
, withSoundStart tap4S
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount i
|
||||||
]
|
]
|
||||||
|
|
||||||
usePjCreation :: Item -> Creature -> World -> World
|
usePjCreation :: Item -> Creature -> World -> World
|
||||||
usePjCreation it = _amPjCreation (_aoType (_itConsumption it)) it
|
usePjCreation it = _amPjCreation (_aoType (_itConsumption it)) it
|
||||||
|
|
||||||
usePjCreationDouble :: Item -> Creature -> World -> World
|
usePjCreationX :: Int -> Item -> Creature -> World -> World
|
||||||
usePjCreationDouble it cr = _amPjCreation (_aoType (_itConsumption it)) it cr
|
usePjCreationX i it cr = foldr f
|
||||||
. _amPjCreation (_aoType (_itConsumption it)) it (cr & crDir +~ pi)
|
(_amPjCreation (_aoType (_itConsumption it)) it cr)
|
||||||
|
[1..i-1]
|
||||||
|
where
|
||||||
|
f n = (. _amPjCreation (_aoType (_itConsumption it)) it (cr & crDir +~ (2*pi*fromIntegral n / fromIntegral i)))
|
||||||
|
|
||||||
launcherPic :: Item -> SPic
|
launcherPic :: Item -> SPic
|
||||||
launcherPic _ =
|
launcherPic _ =
|
||||||
|
|||||||
@@ -29,9 +29,11 @@ import Geometry
|
|||||||
import Picture
|
import Picture
|
||||||
import Shape
|
import Shape
|
||||||
import ShapePicture
|
import ShapePicture
|
||||||
|
import LensHelp
|
||||||
|
|
||||||
import Data.Function
|
import Data.Traversable
|
||||||
import Control.Lens
|
import qualified Data.IntMap.Strict as IM
|
||||||
|
--import Data.Function
|
||||||
import System.Random
|
import System.Random
|
||||||
poisonSprayer :: Item
|
poisonSprayer :: Item
|
||||||
poisonSprayer = defaultAutoGun
|
poisonSprayer = defaultAutoGun
|
||||||
@@ -80,13 +82,14 @@ flamerPic it =
|
|||||||
r = 5
|
r = 5
|
||||||
am = fractionLoadedAmmo2 it
|
am = fractionLoadedAmmo2 it
|
||||||
flameStick :: Item
|
flameStick :: Item
|
||||||
flameStick = undefined
|
flameStick = flamer
|
||||||
|
& itUse . rUse .~ const aFlame
|
||||||
blowTorch :: Item
|
blowTorch :: Item
|
||||||
blowTorch = undefined
|
blowTorch = flamer
|
||||||
flameThrower :: Item
|
flameThrower :: Item
|
||||||
flameThrower = undefined
|
flameThrower = flamer
|
||||||
flameWall :: Item
|
flameWall :: Item
|
||||||
flameWall = undefined
|
flameWall = flamer
|
||||||
flamer :: Item
|
flamer :: Item
|
||||||
flamer = defaultAutoGun
|
flamer = defaultAutoGun
|
||||||
{ _itName = "FLAMER"
|
{ _itName = "FLAMER"
|
||||||
@@ -124,8 +127,25 @@ aGasCloud cr w = insertCloud $ set randGen g w
|
|||||||
vel = (_crPos cr -.- _crOldPos cr) +.+ 10 *.* unitVectorAtAngle dir
|
vel = (_crPos cr -.- _crOldPos cr) +.+ 10 *.* unitVectorAtAngle dir
|
||||||
insertCloud = makeGasCloud pos vel
|
insertCloud = makeGasCloud pos vel
|
||||||
|
|
||||||
|
overNozzles :: (Creature -> World -> Nozzle -> (World,Nozzle))
|
||||||
|
-> Item -> Creature -> World -> World
|
||||||
|
overNozzles eff it cr w = neww & creatures . ix cid . crInv . ix i . itParams . sprayerNozzles .~ newNozzles
|
||||||
|
where
|
||||||
|
cid = _crID cr
|
||||||
|
i = _crInvSel $ _creatures w IM.! cid
|
||||||
|
(neww,newNozzles) = mapAccumR (eff cr) w $ _sprayerNozzles (_itParams it)
|
||||||
|
|
||||||
|
overNozzle :: (Creature -> World -> World)
|
||||||
|
-> Creature -> World -> Nozzle -> (World, Nozzle)
|
||||||
|
overNozzle eff cr w nz = (eff (cr & crDir +~ wa) w & randGen .~ g,nz & nzCurrentWalkAngle .~ wa)
|
||||||
|
where
|
||||||
|
(walkamount, g) = randomR (-aspeed,aspeed) (_randGen w)
|
||||||
|
aspeed = _nzWalkSpeed nz
|
||||||
|
maxa = _nzMaxWalkAngle nz
|
||||||
|
wa = min maxa $ max (negate maxa) (_nzCurrentWalkAngle nz + walkamount)
|
||||||
|
|
||||||
aFlame :: Creature -> World -> World
|
aFlame :: Creature -> World -> World
|
||||||
aFlame cr w = w & particles %~ (aFlameParticle t pos vel (Just cid) :)
|
aFlame cr w = w & particles .:~ aFlameParticle t pos vel (Just cid)
|
||||||
where
|
where
|
||||||
(t,_) = randomR (99,101) (_randGen w)
|
(t,_) = randomR (99,101) (_randGen w)
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
module Dodge.Item.Weapon.ZoomScope where
|
||||||
|
import Dodge.Data
|
||||||
|
import LensHelp
|
||||||
|
|
||||||
|
zoomLongGun :: Float -> Creature -> Item -> Item
|
||||||
|
zoomLongGun x _
|
||||||
|
| x > 0 = itScope . scopeZoomChange %~ (max 5 . (+5))
|
||||||
|
| x < 0 = itScope . scopeZoomChange %~ (min (-5) . subtract 5)
|
||||||
|
| otherwise = id
|
||||||
Reference in New Issue
Block a user