Move shells to external magazines
This commit is contained in:
+16
-5
@@ -402,16 +402,24 @@ useHeld hu = case hu of
|
||||
HeldExplodeRemoteShell itid pjid -> const $ const $ explodeRemoteRocket itid pjid
|
||||
|
||||
usePjCreation :: Item -> Creature -> World -> World
|
||||
usePjCreation it = createProjectile (_amPjCreation (_laAmmoType (_heldConsumption (_itUse it)))) it
|
||||
usePjCreation itm cr = createProjectile apm itm cr
|
||||
where
|
||||
apm = fromMaybe (error "cannot find shell ammo projectile") $ do
|
||||
invid <- itm ^? itLocation . ipInvID
|
||||
cr ^? crInv . ix (invid + 1) . itUse . amagParams
|
||||
|
||||
|
||||
usePjCreationX :: Int -> Item -> Creature -> World -> World
|
||||
usePjCreationX i it cr =
|
||||
usePjCreationX i itm cr =
|
||||
foldr
|
||||
f
|
||||
(createProjectile (_amPjCreation (_laAmmoType (_heldConsumption (_itUse it)))) it cr)
|
||||
(createProjectile apm itm cr)
|
||||
[1 .. i -1]
|
||||
where
|
||||
f n = (. createProjectile (_amPjCreation (_laAmmoType (_heldConsumption (_itUse it)))) it (cr & crDir +~ (2 * pi * fromIntegral n / fromIntegral i)))
|
||||
apm = fromMaybe (error "cannot find shell ammo projectile") $ do
|
||||
invid <- itm ^? itLocation . ipInvID
|
||||
cr ^? crInv . ix (invid + 1) . itUse . amagParams
|
||||
f n = (. createProjectile apm itm (cr & crDir +~ (2 * pi * fromIntegral n / fromIntegral i)))
|
||||
|
||||
overNozzles ::
|
||||
(Nozzle -> Item -> Creature -> World -> World) ->
|
||||
@@ -473,8 +481,11 @@ fireRemoteShell it cr w =
|
||||
itid = _itID it
|
||||
i = IM.newKey $ w ^. cWorld . lWorld . props
|
||||
cid = _crID cr
|
||||
apm = fromMaybe (error "cannot find shell ammo projectile") $ do
|
||||
invid <- it ^? itLocation . ipInvID
|
||||
cr ^? crInv . ix (invid + 1) . itUse . amagParams
|
||||
addRemRocket =
|
||||
makeShell
|
||||
makeShell apm
|
||||
it
|
||||
cr
|
||||
[ PJRemoteShellCollisionCheck
|
||||
|
||||
Reference in New Issue
Block a user