Cleanup launcher code

This commit is contained in:
2024-10-01 01:43:51 +01:00
parent 5a4f2711c8
commit 5091709f70
5 changed files with 11 additions and 27 deletions
+1 -1
View File
@@ -1 +1 @@
All good (605 modules, at 01:05:43) All good (605 modules, at 01:43:48)
-6
View File
@@ -21,11 +21,6 @@ data ItemParams
{_shrinkGunStatus :: ShrinkGunStatus} {_shrinkGunStatus :: ShrinkGunStatus}
| FlatShieldParams | FlatShieldParams
{_flatShieldWlMIX :: Maybe Int} {_flatShieldWlMIX :: Maybe Int}
| ShellLauncher
{ _shellSpinDrag :: Int
, _shellSpinAmount :: Int
, _shellThrustDelay :: Int
}
| Refracting | Refracting
{ _phaseV :: Float { _phaseV :: Float
, _lasColor :: Color , _lasColor :: Color
@@ -53,7 +48,6 @@ data ItemParams
} }
| ParamMID {_paramMID :: Maybe Int} | ParamMID {_paramMID :: Maybe Int}
| BoostPropIX {_boostPropIX :: Maybe Int} | BoostPropIX {_boostPropIX :: Maybe Int}
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
data ShrinkGunStatus = FullSize | Shrunk data ShrinkGunStatus = FullSize | Shrunk
--deriving (Eq, Ord, Show, Read) --Generic, Flat) --deriving (Eq, Ord, Show, Read) --Generic, Flat)
+2 -7
View File
@@ -457,15 +457,10 @@ createProjectile magtree muz itmtree cr = fromMaybe failsound $ do
magid <- magtree ^? ldtValue . itLocation . ilInvID magid <- magtree ^? ldtValue . itLocation . ilInvID
ammoitem <- cr ^? crInv . ix magid ammoitem <- cr ^? crInv . ix magid
let homing = determineProjectileTracking magtree itmtree let homing = determineProjectileTracking magtree itmtree
j <- ammoitem ^? itLocation . ilInvID aparams <- ammoitem ^? itUse . amagParams . ampPayload
aparams <- ammoitem ^? itUse . amagParams return $ createShell homing aparams muz cr
return $ createShell homing aparams muz itm cr
. startthesound . startthesound
. useammo j
where where
itm = itmtree ^. ldtValue
useammo j = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix j . itUse . amagLoadStatus . iaLoaded -~ 1
-- the sound should be moved to the projectile firing -- the sound should be moved to the projectile firing
startthesound = soundMultiFrom [CrWeaponSound (_crID cr) j | j <- [0..3]] (_crPos cr) tap4S Nothing startthesound = soundMultiFrom [CrWeaponSound (_crID cr) j | j <- [0..3]] (_crPos cr) tap4S Nothing
-- failsound = soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing -- failsound = soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing
-6
View File
@@ -12,12 +12,6 @@ import Geometry.Data
launcher :: Item launcher :: Item
launcher = launcher =
defaultHeldItem defaultHeldItem
& itParams
.~ ShellLauncher
{ _shellSpinDrag = 1
, _shellSpinAmount = 2
, _shellThrustDelay = 20
}
& itInvSize .~ 3 & itInvSize .~ 3
& itDimension . dimRad .~ 9 & itDimension . dimRad .~ 9
& itDimension . dimCenter .~ V3 10 0 0 & itDimension . dimCenter .~ V3 10 0 0
+8 -7
View File
@@ -16,8 +16,8 @@ homingDrawType ht = case ht of
HomeUsingTargeting {} -> DrawRemoteShell HomeUsingTargeting {} -> DrawRemoteShell
-- assumes the mscreen is in your inventory -- assumes the mscreen is in your inventory
createShell :: ProjectileHoming -> AmmoParams -> Muzzle -> Item -> Creature -> World -> World createShell :: ProjectileHoming -> Payload -> Muzzle -> Creature -> World -> World
createShell homing aparams muz it cr w = w createShell homing payload muz cr w = w
& updatescreen & updatescreen
& cWorld . lWorld . projectiles . at i & cWorld . lWorld . projectiles . at i
?~ Shell ?~ Shell
@@ -30,20 +30,21 @@ createShell homing aparams muz it cr w = w
, _prjAcc = rotateV dir (V2 3 0) , _prjAcc = rotateV dir (V2 3 0)
, _prjDir = dir , _prjDir = dir
, _prjSpin = 0 , _prjSpin = 0
, _prjPayload = _ampPayload aparams , _prjPayload = payload
, _prjTimer = 350 , _prjTimer = 350
, _prjUpdates = , _prjUpdates =
[ CollisionEffectPU (homing ^? phRemoteID) --Just screenid) [ CollisionEffectPU (homing ^? phRemoteID) --Just screenid)
, TimePU , TimePU
, StartSpinPU 335 (_crID cr) (_shellSpinAmount params) , StartSpinPU 335 (_crID cr) spinamount
, RemoteDirectionPU (350 - thrustdelay) 0 homing , RemoteDirectionPU (350 - thrustdelay) 0 homing
, ThrustPU (350 - thrustdelay) 0 , ThrustPU (350 - thrustdelay) 0
, ReduceSpinPU (1 - fromIntegral (_shellSpinDrag params) * 2 / 200) , ReduceSpinPU (1 - spindrag * 2 / 200)
] ]
} }
where where
thrustdelay = _shellThrustDelay params spindrag = 1
params = _itParams it spinamount = 2
thrustdelay = 20
updatescreen = fromMaybe id $ do updatescreen = fromMaybe id $ do
screenid <- homing ^? phRemoteID screenid <- homing ^? phRemoteID
return $ pointerToItemID screenid . itUse return $ pointerToItemID screenid . itUse