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