Push item use delay inside datatype, currently broken

This commit is contained in:
2021-11-27 16:37:30 +00:00
parent 224db733f6
commit 8639b2d428
21 changed files with 162 additions and 177 deletions
+7 -13
View File
@@ -3,6 +3,7 @@ module Dodge.Item.Weapon.Launcher
, remoteLauncher
) where
import Dodge.Data
import Dodge.Default
import Dodge.Default.Weapon
import Dodge.Default.Shell
import Dodge.SoundLogic.LoadSound
@@ -48,10 +49,7 @@ launcher = defaultGun
, _wpLoadedAmmo = 30
, _wpReloadTime = 80
}
, _itUseRate = 20
, _itUseTime = 0
, _itUse = RightUse aRocketWithItemParams
, _itUseModifiers =
, _itUse = ruseRate 20 aRocketWithItemParams upHammer
[ ammoCheckI
, useTimeCheckI
, withSoundStart tap4S
@@ -62,7 +60,6 @@ launcher = defaultGun
, _itFloorPict = launcherPic
, _itAimingSpeed = 0.2
, _itAimingRange = 0.5
, _itHammer = NoHammer
, _itEffect = NoItEffect
, _itAimStance = TwoHandTwist
}
@@ -250,10 +247,7 @@ remoteLauncher = defaultGun
, _wpLoadedAmmo = 30
, _wpReloadTime = 80
}
, _itUseRate = 10
, _itUseTime = 0
, _itUse = RightUse $ const fireRemoteLauncher
, _itUseModifiers =
, _itUse = ruseRate 10 (const fireRemoteLauncher) upHammer
[ ammoCheckI
, hammerCheckI
]
@@ -294,8 +288,8 @@ fireRemoteLauncher cr w = setLocation
j = _crInvSel cr
newitid = IM.newKey $ _itemPositions w
maybeitid = cr ^? crInv . ix j . itID . _Just
resetFire = set (creatures . ix cid . crInv . ix j . itUse)
$ RightUse $ \_ _ -> explodeRemoteRocket itid i
resetFire = set (creatures . ix cid . crInv . ix j . itUse . rUse)
$ \_ _ -> explodeRemoteRocket itid i
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTEROCKET"
setLocation :: World -> World
setLocation w' = case maybeitid of
@@ -355,7 +349,7 @@ explodeRemoteRocket
explodeRemoteRocket itid pjid w
= set (props . ix pjid . pjUpdate) (\_ -> retireRemoteRocket itid 30 pjid)
$ set (props . ix pjid . prDraw) (const mempty)
$ set (itPoint . itUse) (RightUse $ \_ _ -> id)
$ set (itPoint . itUse . rUse) (\_ _ -> id)
$ resetName
$ makeExplosionAt (_pjPos (_props w IM.! pjid)) w
where
@@ -387,7 +381,7 @@ remoteShellPic t
retireRemoteRocket :: Int -> Int -> Int -> World -> World
retireRemoteRocket itid 0 pjid w =
set (pointToItem (_itemPositions w IM.! itid) . itAttachment . scopePos) (V2 0 0)
$ set (pointToItem (_itemPositions w IM.! itid) . itUse) (RightUse $ const fireRemoteLauncher)
$ set (pointToItem (_itemPositions w IM.! itid) . itUse . rUse) (const fireRemoteLauncher)
(w & props %~ IM.delete pjid)
retireRemoteRocket itid t pjid w = setScope w
& props . ix pjid . pjUpdate .~ (\_ -> retireRemoteRocket itid (t-1) pjid)