(Re)Implement nozzle walking

This commit is contained in:
2024-09-21 19:42:28 +01:00
parent 241f6fdf10
commit 86d8e3a98a
7 changed files with 329 additions and 362 deletions
-22
View File
@@ -9,28 +9,6 @@ import qualified IntMapHelp as IM
import LensHelp
import qualified SDL
createProjectile :: Item -> Muzzle -> Item -> Creature -> World -> World
createProjectile ammoitem muz itm cr = fromMaybe failsound $ do
x <- ammoitem ^? itUse . amagLoadStatus . iaLoaded
guard $ x > 0
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'
createProjectile' :: Maybe Int -> Muzzle -> Item -> Creature -> World -> World
createProjectile' mmagid muz itm cr = fromMaybe failsound $ do