Continue refactor of reloading
This commit is contained in:
@@ -34,18 +34,18 @@ import Control.Lens
|
||||
import Control.Applicative
|
||||
|
||||
launcher :: Item
|
||||
launcher = defaultGun
|
||||
{ _itConsumption = defaultAmmo
|
||||
{ _laType = ProjectileAmmo
|
||||
launcher = defaultWeapon
|
||||
{ _itConsumption = defaultLoadable
|
||||
& laAmmoType .~ ProjectileAmmo
|
||||
{ _amPayload = makeExplosionAt
|
||||
, _amString = "EXPLOSIVE SHELL"
|
||||
, _amPjDraw = drawShell
|
||||
, _amPjCreation = fireShell
|
||||
}
|
||||
, _laMax = 1
|
||||
, _laLoaded = 1
|
||||
, _laReloadTime = 80
|
||||
}
|
||||
& laMax .~ 1
|
||||
& laLoaded .~ 1
|
||||
& laLoadType . ejectTime .~ 40
|
||||
& laLoadType . insertTime .~ 40
|
||||
, _itUse = ruseRate 20 usePjCreation upHammer
|
||||
[ hammerCheckI
|
||||
, ammoCheckI
|
||||
@@ -94,14 +94,14 @@ launcherX i = launcher
|
||||
]
|
||||
|
||||
usePjCreation :: Item -> Creature -> World -> World
|
||||
usePjCreation it = _amPjCreation (_laType (_itConsumption it)) it
|
||||
usePjCreation it = _amPjCreation (_laAmmoType (_itConsumption it)) it
|
||||
|
||||
usePjCreationX :: Int -> Item -> Creature -> World -> World
|
||||
usePjCreationX i it cr = foldr f
|
||||
(_amPjCreation (_laType (_itConsumption it)) it cr)
|
||||
(_amPjCreation (_laAmmoType (_itConsumption it)) it cr)
|
||||
[1..i-1]
|
||||
where
|
||||
f n = (. _amPjCreation (_laType (_itConsumption it)) it (cr & crDir +~ (2*pi*fromIntegral n / fromIntegral i)))
|
||||
f n = (. _amPjCreation (_laAmmoType (_itConsumption it)) it (cr & crDir +~ (2*pi*fromIntegral n / fromIntegral i)))
|
||||
|
||||
launcherPic :: Item -> SPic
|
||||
launcherPic _ =
|
||||
@@ -280,7 +280,7 @@ remoteLauncher = launcher
|
||||
& itType . iyBase .~ REMOTELAUNCHER
|
||||
& itUse . rUse .~ fireRemoteShell
|
||||
& itScope .~ RemoteScope (V2 0 0) 1 True
|
||||
& itConsumption . laType . amPjDraw .~ drawRemoteShell
|
||||
& itConsumption . laAmmoType . amPjDraw .~ drawRemoteShell
|
||||
-- TODO consider allowing tweaking rocket speed
|
||||
|
||||
fireRemoteShell :: Item -> Creature -> World -> World
|
||||
@@ -374,13 +374,13 @@ makeShell it cr theupdate w = w & props %~ IM.insert i Shell
|
||||
, _pjZ = 20
|
||||
, _pjStartPos = pos
|
||||
, _pjVel = rotateV dir (V2 1 0)
|
||||
, _prDraw = _amPjDraw $ _laType am
|
||||
, _prDraw = _amPjDraw $ _laAmmoType am
|
||||
, _pjID = i
|
||||
, _pjUpdate = theupdate
|
||||
, _pjAcc = rotateV dir (V2 3 0)
|
||||
, _pjDir = dir
|
||||
, _pjSpin = 0
|
||||
, _pjPayload = _amPayload $ _laType am
|
||||
, _pjPayload = _amPayload $ _laAmmoType am
|
||||
, _pjTimer = 50
|
||||
}
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user