Add more weapons to attachment chain effects

This commit is contained in:
2024-09-18 19:06:57 +01:00
parent 2c96a514ea
commit 765e08117a
11 changed files with 263 additions and 183 deletions
+23
View File
@@ -32,6 +32,29 @@ createProjectile ammoitem muz itm cr = fromMaybe failsound $ do
Just 0 -> soundStart (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing w'
_ -> soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing w'
createProjectile' :: Maybe Int -> Muzzle -> Item -> Creature -> World -> World
createProjectile' mmagid muz itm cr = fromMaybe failsound $ do
magid <- mmagid
ammoitem <- cr ^? crInv . ix magid
matype <- ammoitem ^? itUse . amagType
guard $ matype == ProjectileAmmo
j <- ammoitem ^? itLocation . ipInvID
pt <- ammoitem ^? itUse . amagParams . ampPjCreation
return $ case pt of
CreateShell -> fireShell ammoitem muz itm cr . extrafuncs j
CreateTrackingShell -> fireTrackingShell ammoitem muz itm cr . extrafuncs j
where
--extrafuncs j = cancelanyreloading . startthesound . useammo j
extrafuncs j = startthesound . useammo j
useammo j = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix j . itUse . amagLoadStatus . iaLoaded -~ 1
--cancelanyreloading = cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
-- the sound should be moved to the projectile firing
startthesound = soundMultiFrom [CrWeaponSound (_crID cr) j | j <- [0..3]] (_crPos cr) tap4S Nothing
failsound w' = case w' ^? input . mouseButtons . ix SDL.ButtonLeft of
Just 0 -> soundStart (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing w'
_ -> soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing w'
fireShell :: Item -> Muzzle -> Item -> Creature -> World -> World
fireShell ammoitem muz it cr =
makeShell