Pass item to item use function
This commit is contained in:
@@ -32,8 +32,8 @@ itemEffect
|
|||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
itemEffect cr Consumable{_cnEffect=eff } w = maybe w (rmSelectedInvItem (_crID cr)) (eff (_crID cr) w)
|
itemEffect cr Consumable{_cnEffect=eff } w = maybe w (rmSelectedInvItem (_crID cr)) (eff (_crID cr) w)
|
||||||
itemEffect cr Weapon{_itUse=eff} w = eff cr w
|
itemEffect cr it@Weapon{_itUse=eff} w = eff it cr w
|
||||||
itemEffect cr Throwable{_itUse = eff} w = eff cr w
|
itemEffect cr it@Throwable{_itUse = eff} w = eff it cr w
|
||||||
itemEffect _ _ w = w
|
itemEffect _ _ w = w
|
||||||
|
|
||||||
useLeftItem
|
useLeftItem
|
||||||
|
|||||||
+5
-3
@@ -199,7 +199,7 @@ data Item
|
|||||||
, _wpReloadState :: Int
|
, _wpReloadState :: Int
|
||||||
, _itUseRate :: Int
|
, _itUseRate :: Int
|
||||||
, _itUseTime :: Int
|
, _itUseTime :: Int
|
||||||
, _itUse :: Creature -> World -> World
|
, _itUse :: Item -> Creature -> World -> World
|
||||||
, _itLeftClickUse :: Maybe (Creature -> Int -> World -> World)
|
, _itLeftClickUse :: Maybe (Creature -> Int -> World -> World)
|
||||||
, _wpSpread :: Float
|
, _wpSpread :: Float
|
||||||
, _wpRange :: Float
|
, _wpRange :: Float
|
||||||
@@ -268,7 +268,7 @@ data Item
|
|||||||
, _itFloorPict :: Picture
|
, _itFloorPict :: Picture
|
||||||
, _twMaxRange :: Float
|
, _twMaxRange :: Float
|
||||||
, _twAccuracy :: Float
|
, _twAccuracy :: Float
|
||||||
, _itUse :: Creature -> World -> World
|
, _itUse :: Item -> Creature -> World -> World
|
||||||
, _itUseRate :: Int
|
, _itUseRate :: Int
|
||||||
, _itUseTime :: Int
|
, _itUseTime :: Int
|
||||||
, _itAimingSpeed :: Float
|
, _itAimingSpeed :: Float
|
||||||
@@ -387,9 +387,11 @@ type HitEffect = Particle -> [(Point2, Either3 Creature Wall ForceField)] -> Wor
|
|||||||
data Ammo
|
data Ammo
|
||||||
= ShellAmmo
|
= ShellAmmo
|
||||||
{ _amPayload :: Point2 -> World -> World
|
{ _amPayload :: Point2 -> World -> World
|
||||||
|
, _amString :: String
|
||||||
}
|
}
|
||||||
| BulletAmmo
|
| BulletAmmo
|
||||||
{ }
|
{ _amString :: String
|
||||||
|
}
|
||||||
| GenericAmmo
|
| GenericAmmo
|
||||||
data Projectile
|
data Projectile
|
||||||
= Projectile
|
= Projectile
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ defaultGun = Weapon
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 8
|
, _itUseRate = 8
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = \_ -> id
|
, _itUse = \_ _ -> id
|
||||||
, _itLeftClickUse = Nothing
|
, _itLeftClickUse = Nothing
|
||||||
, _wpSpread = 0.02
|
, _wpSpread = 0.02
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
|
|||||||
+33
-33
@@ -55,7 +55,7 @@ pistol = Weapon
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 8
|
, _itUseRate = 8
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse =
|
, _itUse = \_ ->
|
||||||
hammerCheck
|
hammerCheck
|
||||||
. shootWithSound 0
|
. shootWithSound 0
|
||||||
. withRandomDir 0.1
|
. withRandomDir 0.1
|
||||||
@@ -90,12 +90,12 @@ defaultAutoGun = autoGun
|
|||||||
effectGun :: String -> (Creature -> World -> World) -> Item
|
effectGun :: String -> (Creature -> World -> World) -> Item
|
||||||
effectGun name eff = defaultGun
|
effectGun name eff = defaultGun
|
||||||
{ _itName = name ++ "Gun"
|
{ _itName = name ++ "Gun"
|
||||||
, _itUse = eff
|
, _itUse = \_ -> eff
|
||||||
}
|
}
|
||||||
autoEffectGun :: String -> (Creature -> World -> World) -> Item
|
autoEffectGun :: String -> (Creature -> World -> World) -> Item
|
||||||
autoEffectGun name eff = defaultAutoGun
|
autoEffectGun name eff = defaultAutoGun
|
||||||
{ _itName = name ++ "Gun"
|
{ _itName = name ++ "Gun"
|
||||||
, _itUse = eff
|
, _itUse = \_ -> eff
|
||||||
}
|
}
|
||||||
autoGun :: Item
|
autoGun :: Item
|
||||||
autoGun = defaultGun
|
autoGun = defaultGun
|
||||||
@@ -107,7 +107,7 @@ autoGun = defaultGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 6
|
, _itUseRate = 6
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = charFiringStrat
|
, _itUse = \_ -> charFiringStrat
|
||||||
[('M',autoFireMode)
|
[('M',autoFireMode)
|
||||||
,('S',singleFireMode)
|
,('S',singleFireMode)
|
||||||
]
|
]
|
||||||
@@ -144,7 +144,7 @@ rezGun = defaultGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shoot aTeslaArc
|
, _itUse = \_ -> shoot aTeslaArc
|
||||||
, _wpSpread = 0.001
|
, _wpSpread = 0.001
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ color chartreuse $ pictures
|
, _itFloorPict = onLayer FlItLayer $ color chartreuse $ pictures
|
||||||
@@ -168,7 +168,7 @@ teslaGun = defaultAutoGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shoot aTeslaArc
|
, _itUse = \_ -> shoot aTeslaArc
|
||||||
, _wpSpread = 0.001
|
, _wpSpread = 0.001
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ color blue $ pictures
|
, _itFloorPict = onLayer FlItLayer $ color blue $ pictures
|
||||||
@@ -193,7 +193,7 @@ lasGun = defaultAutoGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shoot aLaser
|
, _itUse = \_ -> shoot aLaser
|
||||||
, _wpSpread = 0.001
|
, _wpSpread = 0.001
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ color blue $ polygon $ rectNESW 3 3 (-3) (-3)
|
, _itFloorPict = onLayer FlItLayer $ color blue $ polygon $ rectNESW 3 3 (-3) (-3)
|
||||||
@@ -251,7 +251,7 @@ tractorGun = defaultAutoGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shoot $ aTractorBeam 0
|
, _itUse = \_ -> shoot $ aTractorBeam 0
|
||||||
, _wpSpread = 0.00001
|
, _wpSpread = 0.00001
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ color blue $ pictures [polygon $ rectNESW 1.5 6 (-1.5) 0 ]
|
, _itFloorPict = onLayer FlItLayer $ color blue $ pictures [polygon $ rectNESW 1.5 6 (-1.5) 0 ]
|
||||||
@@ -271,7 +271,7 @@ useTargetPos f cr w = case cr ^? crInv . ix (_crInvSel cr) . itAttachment . _Jus
|
|||||||
bezierGun :: Item
|
bezierGun :: Item
|
||||||
bezierGun = defaultAutoGun
|
bezierGun = defaultAutoGun
|
||||||
{ _itName = "B-GUN"
|
{ _itName = "B-GUN"
|
||||||
, _itUse = useTargetPos $ \p ->
|
, _itUse = \_ -> useTargetPos $ \p ->
|
||||||
shootWithSound 0
|
shootWithSound 0
|
||||||
. withMuzFlare
|
. withMuzFlare
|
||||||
. withRecoil 40
|
. withRecoil 40
|
||||||
@@ -321,7 +321,7 @@ remoteLauncher = defaultGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 10
|
, _itUseRate = 10
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = hammerCheck fireRemoteLauncher
|
, _itUse = \_ -> hammerCheck fireRemoteLauncher
|
||||||
, _wpSpread = 0.02
|
, _wpSpread = 0.02
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itFloorPict = onLayer FlItLayer $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||||
@@ -340,7 +340,7 @@ hvAutoGun = defaultAutoGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 25
|
, _itUseRate = 25
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = rateIncAB 24 10 (torqueBeforeForced 0.1 mkHvBul) $ torqueAfter 0.2 mkHvBul
|
, _itUse = \_ -> rateIncAB 24 10 (torqueBeforeForced 0.1 mkHvBul) $ torqueAfter 0.2 mkHvBul
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ color orange $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itFloorPict = onLayer FlItLayer $ color orange $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||||
, _itAimingSpeed = 0.2
|
, _itAimingSpeed = 0.2
|
||||||
@@ -363,7 +363,7 @@ ltAutoGun = defaultAutoGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 4
|
, _itUseRate = 4
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shootWithSound 0 . withRandomDir 0.3 . withSidePush 50
|
, _itUse = \_ -> shootWithSound 0 . withRandomDir 0.3 . withSidePush 50
|
||||||
. withMuzFlare $ withVelWthHiteff (30,0) 2 basicBulletEffect
|
. withMuzFlare $ withVelWthHiteff (30,0) 2 basicBulletEffect
|
||||||
, _wpSpread = 0.5
|
, _wpSpread = 0.5
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
@@ -387,7 +387,7 @@ miniGun = defaultAutoGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 2
|
, _itUseRate = 2
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = withWarmUp 50 . torqueBefore 0.03 . withSidePush 50 . withRecoil 15
|
, _itUse = \_ -> withWarmUp 50 . torqueBefore 0.03 . withSidePush 50 . withRecoil 15
|
||||||
. withRandomDir 0.1
|
. withRandomDir 0.1
|
||||||
. withRandomOffset 9
|
. withRandomOffset 9
|
||||||
. withMuzFlare
|
. withMuzFlare
|
||||||
@@ -409,7 +409,7 @@ spreadGun = defaultGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 20
|
, _itUseRate = 20
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shootWithSound (fromIntegral shotgunSound)
|
, _itUse = \_ -> shootWithSound (fromIntegral shotgunSound)
|
||||||
. withRecoil 100
|
. withRecoil 100
|
||||||
. withMuzFlare
|
. withMuzFlare
|
||||||
$ spreadNumVelWthHiteff spreadGunSpread 9 (30,0) 2 basicBulletEffect
|
$ spreadNumVelWthHiteff spreadGunSpread 9 (30,0) 2 basicBulletEffect
|
||||||
@@ -430,7 +430,7 @@ multGun = defaultGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 20
|
, _itUseRate = 20
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shootWithSound (fromIntegral shotgunSound)
|
, _itUse = \_ -> shootWithSound (fromIntegral shotgunSound)
|
||||||
. withRecoil 200
|
. withRecoil 200
|
||||||
. withMuzFlare
|
. withMuzFlare
|
||||||
$ numVelWthHitEff 5 (50,0) 5 basicBulletEffect
|
$ numVelWthHitEff 5 (50,0) 5 basicBulletEffect
|
||||||
@@ -461,7 +461,7 @@ longGun = defaultGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 100
|
, _itUseRate = 100
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shootWithSound (fromIntegral longGunSound)
|
, _itUse = \_ -> shootWithSound (fromIntegral longGunSound)
|
||||||
. withThickSmoke
|
. withThickSmoke
|
||||||
. torqueAfter 0.05
|
. torqueAfter 0.05
|
||||||
. withMuzFlare
|
. withMuzFlare
|
||||||
@@ -496,7 +496,7 @@ poisonSprayer = defaultAutoGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shoot aGasCloud
|
, _itUse = \_ -> shoot aGasCloud
|
||||||
, _wpSpread = 0.3
|
, _wpSpread = 0.3
|
||||||
, _wpRange = 8
|
, _wpRange = 8
|
||||||
, _itFloorPict = onLayer FlItLayer $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
, _itFloorPict = onLayer FlItLayer $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
||||||
@@ -515,7 +515,7 @@ flamer = defaultAutoGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shoot $ withSidePush 5 $ withSidePushAfter 10 $ randWalkAngle 0.2 0.01 aFlame
|
, _itUse = \_ -> shoot $ withSidePush 5 $ withSidePushAfter 10 $ randWalkAngle 0.2 0.01 aFlame
|
||||||
, _wpSpread = 0
|
, _wpSpread = 0
|
||||||
, _wpRange = 8
|
, _wpRange = 8
|
||||||
, _itFloorPict = onLayer FlItLayer $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
, _itFloorPict = onLayer FlItLayer $ color yellow $ polygon $ rectNESW 4 4 (-4) (-4)
|
||||||
@@ -535,7 +535,7 @@ blinkGun = defaultGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = hammerCheck $ shoot aSelf
|
, _itUse = \_ -> hammerCheck $ shoot aSelf
|
||||||
, _itLeftClickUse = Just $ hammerCheckL $ shootL aSelfL
|
, _itLeftClickUse = Just $ hammerCheckL $ shootL aSelfL
|
||||||
, _wpSpread = 0.05
|
, _wpSpread = 0.05
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
@@ -553,7 +553,7 @@ boosterGun = defaultGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = boostSelf 10
|
, _itUse = \_ -> boostSelf 10
|
||||||
, _itLeftClickUse = Just $ boostSelfL 10
|
, _itLeftClickUse = Just $ boostSelfL 10
|
||||||
, _wpSpread = 0.05
|
, _wpSpread = 0.05
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
@@ -632,7 +632,7 @@ pointToItem (OnFloor flid) = floorItems . ix flid . flIt
|
|||||||
retireRemoteRocket :: Int -> Int -> Int -> World -> World
|
retireRemoteRocket :: Int -> Int -> Int -> World -> World
|
||||||
retireRemoteRocket itid 0 pjid w =
|
retireRemoteRocket itid 0 pjid w =
|
||||||
set (pointToItem (_itemPositions w IM.! itid) . itAttachment . _Just . scopePos) (0,0)
|
set (pointToItem (_itemPositions w IM.! itid) . itAttachment . _Just . scopePos) (0,0)
|
||||||
$ set (pointToItem (_itemPositions w IM.! itid) . itUse) (hammerCheck fireRemoteLauncher)
|
$ set (pointToItem (_itemPositions w IM.! itid) . itUse) (\_ -> hammerCheck fireRemoteLauncher)
|
||||||
(w & projectiles %~ IM.delete pjid)
|
(w & projectiles %~ IM.delete pjid)
|
||||||
retireRemoteRocket itid t pjid w = setScope w
|
retireRemoteRocket itid t pjid w = setScope w
|
||||||
& projectiles . ix pjid . pjUpdate .~ (\_ -> retireRemoteRocket itid (t-1) pjid)
|
& projectiles . ix pjid . pjUpdate .~ (\_ -> retireRemoteRocket itid (t-1) pjid)
|
||||||
@@ -649,7 +649,7 @@ retireRemoteBomb itid 0 pjid w = w
|
|||||||
& pointToItem (_itemPositions w IM.! itid) %~
|
& pointToItem (_itemPositions w IM.! itid) %~
|
||||||
( (itAttachment . _Just . scopePos .~ (0,0))
|
( (itAttachment . _Just . scopePos .~ (0,0))
|
||||||
. (itZoom .~ defaultItZoom)
|
. (itZoom .~ defaultItZoom)
|
||||||
. (itUse .~ hammerCheck throwRemoteBomb)
|
. (itUse .~ (\_ -> hammerCheck throwRemoteBomb))
|
||||||
)
|
)
|
||||||
& projectiles %~ IM.delete pjid
|
& projectiles %~ IM.delete pjid
|
||||||
retireRemoteBomb itid t pjid w = setScope w
|
retireRemoteBomb itid t pjid w = setScope w
|
||||||
@@ -721,7 +721,7 @@ grenade = Throwable
|
|||||||
, _itFloorPict = onLayer FlItLayer $ polygon [(-3,-3),(-3,3),(3,3),(3,-3)]
|
, _itFloorPict = onLayer FlItLayer $ polygon [(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||||
, _twMaxRange = 150
|
, _twMaxRange = 150
|
||||||
, _twAccuracy = 30
|
, _twAccuracy = 30
|
||||||
, _itUse = useTimeCheck $ throwGrenade makeExplosionAt
|
, _itUse = \_ -> useTimeCheck $ throwGrenade makeExplosionAt
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = defaultItZoom {_itAimZoomMax = f fuseTime, _itAimZoomMin = f fuseTime}
|
, _itZoom = defaultItZoom {_itAimZoomMax = f fuseTime, _itAimZoomMin = f fuseTime}
|
||||||
@@ -744,7 +744,7 @@ grenade = Throwable
|
|||||||
flameGrenade :: Item
|
flameGrenade :: Item
|
||||||
flameGrenade = grenade {
|
flameGrenade = grenade {
|
||||||
_itName = "FLMGREN " ++ show fuseTime
|
_itName = "FLMGREN " ++ show fuseTime
|
||||||
, _itUse = throwGrenade makeFlameExplosionAt
|
, _itUse = \_ -> throwGrenade makeFlameExplosionAt
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
fuseTime = 50 :: Int
|
fuseTime = 50 :: Int
|
||||||
@@ -753,7 +753,7 @@ flameGrenade = grenade {
|
|||||||
teslaGrenade :: Item
|
teslaGrenade :: Item
|
||||||
teslaGrenade = grenade {
|
teslaGrenade = grenade {
|
||||||
_itName = "TLSGREN " ++ show fuseTime
|
_itName = "TLSGREN " ++ show fuseTime
|
||||||
, _itUse = throwGrenade makeTeslaExplosionAt
|
, _itUse = \_ -> throwGrenade makeTeslaExplosionAt
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
fuseTime = 50 :: Int
|
fuseTime = 50 :: Int
|
||||||
@@ -770,7 +770,7 @@ remoteBomb = defaultThrowable
|
|||||||
, _itFloorPict = onLayer FlItLayer $ polygon [(-3,-3),(-3,3),(3,3),(3,-3)]
|
, _itFloorPict = onLayer FlItLayer $ polygon [(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||||
, _twMaxRange = 150
|
, _twMaxRange = 150
|
||||||
, _twAccuracy = 30
|
, _twAccuracy = 30
|
||||||
, _itUse = hammerCheck throwRemoteBomb
|
, _itUse = \_ -> hammerCheck throwRemoteBomb
|
||||||
, _itAttachment = Just $ ItScope (0,0) 0 1 True
|
, _itAttachment = Just $ ItScope (0,0) 0 1 True
|
||||||
, _itEquipPict = pictureWeaponOnAim remoteBombUnarmedPic
|
, _itEquipPict = pictureWeaponOnAim remoteBombUnarmedPic
|
||||||
}
|
}
|
||||||
@@ -798,7 +798,7 @@ fireRemoteLauncher cr w = setLocation
|
|||||||
newitid = IM.newKey $ _itemPositions w
|
newitid = IM.newKey $ _itemPositions w
|
||||||
maybeitid = cr ^? crInv . ix j . itID . _Just
|
maybeitid = cr ^? crInv . ix j . itID . _Just
|
||||||
resetFire = set (creatures . ix cid . crInv . ix j . itUse)
|
resetFire = set (creatures . ix cid . crInv . ix j . itUse)
|
||||||
$ hammerCheck $ \_ -> explodeRemoteRocket itid i
|
$ \_ -> hammerCheck $ \_ -> explodeRemoteRocket itid i
|
||||||
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTEROCKET"
|
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTEROCKET"
|
||||||
setLocation :: World -> World
|
setLocation :: World -> World
|
||||||
setLocation w' = case maybeitid of
|
setLocation w' = case maybeitid of
|
||||||
@@ -891,7 +891,7 @@ explodeRemoteRocket
|
|||||||
explodeRemoteRocket itid pjid w
|
explodeRemoteRocket itid pjid w
|
||||||
= set (projectiles . ix pjid . pjUpdate) (\_ -> retireRemoteRocket itid 30 pjid)
|
= set (projectiles . ix pjid . pjUpdate) (\_ -> retireRemoteRocket itid 30 pjid)
|
||||||
$ set (projectiles . ix pjid . pjDraw) (\_ -> blank)
|
$ set (projectiles . ix pjid . pjDraw) (\_ -> blank)
|
||||||
$ set (itPoint . itUse) (const id)
|
$ set (itPoint . itUse) (\_ _ -> id)
|
||||||
$ resetName
|
$ resetName
|
||||||
$ makeExplosionAt (_pjPos (_projectiles w IM.! pjid)) w
|
$ makeExplosionAt (_pjPos (_projectiles w IM.! pjid)) w
|
||||||
where
|
where
|
||||||
@@ -922,7 +922,7 @@ throwRemoteBomb cr w = setLocation
|
|||||||
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTE"
|
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTE"
|
||||||
removePict = set (creatures . ix cid . crInv . ix j . itEquipPict) $ \ _ _ -> blank
|
removePict = set (creatures . ix cid . crInv . ix j . itEquipPict) $ \ _ _ -> blank
|
||||||
resetFire = set (creatures . ix cid . crInv . ix j . itUse)
|
resetFire = set (creatures . ix cid . crInv . ix j . itUse)
|
||||||
$ hammerCheck $ explodeRemoteBomb itid i
|
$ \_ -> hammerCheck $ explodeRemoteBomb itid i
|
||||||
p' = _crPos cr +.+ rotateV (_crDir cr) (_crRad cr,0)
|
p' = _crPos cr +.+ rotateV (_crDir cr) (_crRad cr,0)
|
||||||
p | circOnSomeWall p' 4 w = _crPos cr +.+ rotateV (_crDir cr) (_crRad cr-4,0)
|
p | circOnSomeWall p' 4 w = _crPos cr +.+ rotateV (_crDir cr) (_crRad cr-4,0)
|
||||||
| otherwise = p'
|
| otherwise = p'
|
||||||
@@ -939,7 +939,7 @@ explodeRemoteBomb :: Int -> Int -> Creature -> World -> World
|
|||||||
explodeRemoteBomb itid pjid cr w
|
explodeRemoteBomb itid pjid cr w
|
||||||
= set (projectiles . ix pjid . pjUpdate) (\_ -> retireRemoteBomb itid 30 pjid)
|
= set (projectiles . ix pjid . pjUpdate) (\_ -> retireRemoteBomb itid 30 pjid)
|
||||||
$ set (projectiles . ix pjid . pjDraw) (\_ -> blank)
|
$ set (projectiles . ix pjid . pjDraw) (\_ -> blank)
|
||||||
$ set (creatures . ix cid . crInv . ix j . itUse) (const id)
|
$ set (creatures . ix cid . crInv . ix j . itUse) (\_ -> const id)
|
||||||
$ resetName
|
$ resetName
|
||||||
$ resetPict
|
$ resetPict
|
||||||
-- $ resetScope
|
-- $ resetScope
|
||||||
@@ -989,7 +989,7 @@ radar = defaultGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 120
|
, _itUseRate = 120
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shoot aRadarPulse
|
, _itUse = \_ -> shoot aRadarPulse
|
||||||
, _wpSpread = autogunSpread
|
, _wpSpread = autogunSpread
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itHammer = HammerUp
|
, _itHammer = HammerUp
|
||||||
@@ -1012,7 +1012,7 @@ sonar = defaultGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 120
|
, _itUseRate = 120
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shoot aSonarPulse
|
, _itUse = \_ -> shoot aSonarPulse
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itHammer = HammerUp
|
, _itHammer = HammerUp
|
||||||
, _itFloorPict = onLayer FlItLayer $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itFloorPict = onLayer FlItLayer $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||||
@@ -1064,7 +1064,7 @@ spawnGun cr = defaultGun
|
|||||||
, _wpReloadTime = 80
|
, _wpReloadTime = 80
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 100
|
, _itUseRate = 100
|
||||||
, _itUse = spawnCrNextTo cr
|
, _itUse = \_ -> spawnCrNextTo cr
|
||||||
}
|
}
|
||||||
spawnCrNextTo
|
spawnCrNextTo
|
||||||
:: Creature -- ^ Creature to spawn
|
:: Creature -- ^ Creature to spawn
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ launcher = defaultGun
|
|||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 20
|
, _itUseRate = 20
|
||||||
, _itUseTime = 0
|
, _itUseTime = 0
|
||||||
, _itUse = shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeExplosionAt
|
, _itUse = \_ -> shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeExplosionAt
|
||||||
, _wpSpread = 0.02
|
, _wpSpread = 0.02
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = onLayer FlItLayer $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itFloorPict = onLayer FlItLayer $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||||
@@ -42,23 +42,27 @@ launcher = defaultGun
|
|||||||
, _itEquipPict = pictureWeaponOnAim $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itEquipPict = pictureWeaponOnAim $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
||||||
, _itHammer = NoHammer
|
, _itHammer = NoHammer
|
||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
|
, _wpAmmo = ShellAmmo
|
||||||
|
{ _amPayload = makeExplosionAt
|
||||||
|
, _amString = ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
flameLauncher :: Item
|
flameLauncher :: Item
|
||||||
flameLauncher = launcher
|
flameLauncher = launcher
|
||||||
{ _itName = "FLROCKO"
|
{ _itName = "FLROCKO"
|
||||||
, _itUse = shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeFlameExplosionAt
|
, _itUse = \_ -> shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeFlameExplosionAt
|
||||||
}
|
}
|
||||||
|
|
||||||
poisonLauncher :: Item
|
poisonLauncher :: Item
|
||||||
poisonLauncher = launcher
|
poisonLauncher = launcher
|
||||||
{ _itName = "POISROCK"
|
{ _itName = "POISROCK"
|
||||||
, _itUse = shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makePoisonExplosionAt
|
, _itUse = \_ -> shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makePoisonExplosionAt
|
||||||
}
|
}
|
||||||
|
|
||||||
teslaLauncher :: Item
|
teslaLauncher :: Item
|
||||||
teslaLauncher = launcher
|
teslaLauncher = launcher
|
||||||
{ _itName = "TESLROCK"
|
{ _itName = "TESLROCK"
|
||||||
, _itUse = shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeTeslaExplosionAt
|
, _itUse = \_ -> shootWithSound (fromIntegral launcherSound) $ aRocketWithPayload makeTeslaExplosionAt
|
||||||
}
|
}
|
||||||
|
|
||||||
aRocketWithPayload
|
aRocketWithPayload
|
||||||
|
|||||||
@@ -91,14 +91,14 @@ withWarmUp t f cr w
|
|||||||
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
||||||
| _wpReloadState item /= 0 = w
|
| _wpReloadState item /= 0 = w
|
||||||
| fState == 0 = w
|
| fState == 0 = w
|
||||||
& pointerToItem %~ ( (itUse .~ withWarmUp 100 f) . (itUseTime .~ 2) )
|
& pointerToItem %~ ( (itUse .~ (\_ -> withWarmUp 100 f)) . (itUseTime .~ 2) )
|
||||||
| t > 2 = w
|
| t > 2 = w
|
||||||
& pointerToItem %~ ( (itUse .~ withWarmUp (t-1) f) . (itUseTime .~ 2) )
|
& pointerToItem %~ ( (itUse .~ (\_ -> withWarmUp (t-1) f)) . (itUseTime .~ 2) )
|
||||||
& soundFrom (CrWeaponSound cid) 26 2 0
|
& soundFrom (CrWeaponSound cid) 26 2 0
|
||||||
| t > 0 = w
|
| t > 0 = w
|
||||||
& pointerToItem %~ ( (itUse .~ withWarmUp (t-1) f) . (itUseTime .~ 2) )
|
& pointerToItem %~ ( (itUse .~ (\_ -> withWarmUp (t-1) f)) . (itUseTime .~ 2) )
|
||||||
| otherwise = w
|
| otherwise = w
|
||||||
& pointerToItem %~ ( (itUse .~ withWarmUp 1 f) . (wpLoadedAmmo -~ 1) . (itUseTime .~ 2) )
|
& pointerToItem %~ ( (itUse .~ (\_ -> withWarmUp 1 f)) . (wpLoadedAmmo -~ 1) . (itUseTime .~ 2) )
|
||||||
& f cr
|
& f cr
|
||||||
& soundFrom (CrWeaponSound cid) 28 2 0
|
& soundFrom (CrWeaponSound cid) 28 2 0
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ aTractorBeam
|
|||||||
-> World
|
-> World
|
||||||
aTractorBeam col cr w
|
aTractorBeam col cr w
|
||||||
= set (creatures . ix cid . crInv . ix itRef . itUse)
|
= set (creatures . ix cid . crInv . ix itRef . itUse)
|
||||||
(shoot $ aTractorBeam ((col + 1) `mod` 10))
|
(\_ -> shoot $ aTractorBeam ((col + 1) `mod` 10))
|
||||||
$ over projectiles (IM.insert i (tractorBeamAt col i pos dir)) w
|
$ over projectiles (IM.insert i (tractorBeamAt col i pos dir)) w
|
||||||
where
|
where
|
||||||
i = newProjectileKey w
|
i = newProjectileKey w
|
||||||
|
|||||||
Reference in New Issue
Block a user