Start allowing for more granular control of remote projectiles, cleanup

This commit is contained in:
2024-12-26 10:16:18 +00:00
parent ae557f3fd4
commit 53c981718c
14 changed files with 273 additions and 218 deletions
+15 -3
View File
@@ -2,6 +2,9 @@ module Dodge.Projectile.Create (
createShell,
) where
import NewInt
--import Dodge.Data.ComposedItem
--import Dodge.Data.DoubleTree
import Dodge.Item.Location
import Data.Maybe
import Dodge.Data.World
@@ -16,9 +19,13 @@ homingDrawType ht = case ht of
HomeUsingTargeting {} -> DrawRemoteShell
-- assumes the mscreen is in your inventory
createShell :: ProjectileHoming -> Payload -> Muzzle -> Creature -> World -> World
createShell homing payload muz cr w = w
createShell :: ProjectileHoming
-> Maybe (NewInt ItmInt)
-> Maybe (NewInt ItmInt)
-> Payload -> Muzzle -> Creature -> World -> World
createShell homing mdetonator mscreen payload muz cr w = w
& updatescreen
& updatedetonator
& cWorld . lWorld . projectiles . at i
?~ Shell
{ _prjPos = pos
@@ -33,7 +40,7 @@ createShell homing payload muz cr w = w
, _prjPayload = payload
, _prjTimer = 350
, _prjUpdates =
[ CollisionEffectPU (homing ^? phRemoteID) --Just screenid)
[ CollisionEffectPU (homing ^? phRemoteID) mdetonator mscreen
, TimePU
, StartSpinPU 335 (_crID cr) spinamount
, RemoteDirectionPU (350 - thrustdelay) 0 homing
@@ -45,6 +52,11 @@ createShell homing payload muz cr w = w
spindrag = 1
spinamount = 2
thrustdelay = 20
updatedetonator = fromMaybe id $ do
screenid <- mdetonator
return $ pointerToItemID screenid . itUse . uaParams
. apLinkedProjectile
?~ i
updatescreen = fromMaybe id $ do
screenid <- homing ^? phRemoteID
return $ pointerToItemID screenid . itUse . uaParams