Commit before removing stackable items

This commit is contained in:
2024-09-08 15:17:59 +01:00
parent 1006bb5529
commit 86795f1a10
20 changed files with 73 additions and 39 deletions
+3
View File
@@ -264,8 +264,11 @@ stackedInventory :: [Item]
stackedInventory =
[ burstRifle
, tinMag
, drumMag
, launcher
, shellMag
, shellMag
, shellMag
, pipe
, scrollWatch
, rewindWatch
+1 -1
View File
@@ -32,7 +32,7 @@ data ItemUse
, _heldMods :: HeldMod
, _heldHammer :: HammerPosition
, _heldAim :: AimParams
, _heldConsumption :: [AmmoType]
, _heldAmmoTypes :: [AmmoType]
, _heldParams :: HeldParams
-- , _useTargeting :: Maybe TargetType
}
-1
View File
@@ -20,7 +20,6 @@ data SoundOrigin
| MachineAltSound Int
| TerminalSound
| WallSound Int
| CrReloadSound Int
| Flamer
| ShellSound Int
| FlameSound
+1 -1
View File
@@ -44,7 +44,7 @@ defaultCraftItem = defaultHeldItem & itUse .~ CraftUse 1
defaultBulletWeapon :: Item
defaultBulletWeapon =
defaultWeapon
& itUse . heldConsumption .~ [BulletAmmo]
& itUse . heldAmmoTypes .~ [BulletAmmo]
& itUse . heldUse .~ HeldUseAmmoParams -- useAmmoParams
& itType . iyModules . at ModBulletCollision ?~ EMPTYMODULE
-- & itType . iyModules . at ModBulletPayload ?~ EMPTYMODULE
+1 -1
View File
@@ -34,7 +34,7 @@ defaultHeldUse =
, _heldMods = HeldModNothing
, _heldHammer = HammerUp
, _heldAim = defaultAimParams
, _heldConsumption = []
, _heldAmmoTypes = []
, _heldParams = BulletShooterParams
{ _muzVel = 0.8
, _rifling = 0.8
+1 -1
View File
@@ -435,7 +435,7 @@ overNozzle eff ams it cr w nz =
getAmmoMagazine :: Item -> Creature -> Maybe ItemUse
getAmmoMagazine itm cr = do
invid <- itm ^? itLocation . ipInvID
amtype <- itm ^? itUse . heldConsumption . ix 0
amtype <- itm ^? itUse . heldAmmoTypes . ix 0
mag <- cr ^? crInv . ix (invid + 1) . itUse
magtype <- mag ^? amagType
guard $ amtype == magtype
+9
View File
@@ -14,6 +14,15 @@ import LensHelp
import Picture
import Shape
import ShapePicture
import Data.Maybe
itemHeldAmmoPic :: Item -> Item -> SPic
itemHeldAmmoPic itm amit = itemSPic itm <> addAmmoClip itm amit
addAmmoClip :: Item -> Item -> SPic
addAmmoClip itm amit = fromMaybe mempty $ do
hit <- itm ^? itType . iyBase . ibtHeld
return mempty
itemSPic :: Item -> SPic
itemSPic it =
+1 -1
View File
@@ -36,7 +36,7 @@ teslaGun =
lasGun :: Item
lasGun =
defaultAutoBatteryGun
& itUse . heldConsumption .~ [ElectricalAmmo]
& itUse . heldAmmoTypes .~ [ElectricalAmmo]
& itParams
.~ Refracting
{ _phaseV = 1
+1 -1
View File
@@ -101,7 +101,7 @@ miniGunUse i =
& heldAim . aimRange .~ 1
& heldAim . aimStance .~ TwoHandUnder
& heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& heldConsumption .~ [BulletAmmo]
& heldAmmoTypes .~ [BulletAmmo]
miniGunX :: Int -> Item
miniGunX i =
+1 -1
View File
@@ -32,7 +32,7 @@ launcher =
-- & itUse . heldAim . aimHandlePos .~ V2 3 0
-- & itUse . heldAim . aimMuzPos .~ 20
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0]
& itUse . heldConsumption .~ [ProjectileAmmo]
& itUse . heldAmmoTypes .~ [ProjectileAmmo]
& itType . iyBase .~ HELD LAUNCHER
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
+2 -2
View File
@@ -17,7 +17,7 @@ poisonSprayer :: Item
poisonSprayer =
flameThrower
& itType . iyBase .~ HELD POISONSPRAYER
& itUse . heldConsumption .~ [GasAmmo]
& itUse . heldAmmoTypes .~ [GasAmmo]
& itUse . heldParams .~ GasSprayParams CreatePoisonGas --aGasCloud
& itUse . heldMods .~ PoisonSprayerMod
@@ -89,6 +89,6 @@ flameThrower =
& itUse . heldAim . aimStance .~ TwoHandUnder
-- & itUse . heldAim . aimHandlePos .~ 0
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0]
& itUse . heldConsumption .~ [GasAmmo]
& itUse . heldAmmoTypes .~ [GasAmmo]
& itType . iyBase .~ HELD FLAMETHROWER
& itUse . heldParams .~ GasSprayParams CreateFlame --aGasCloud
+1 -1
View File
@@ -38,7 +38,7 @@ baseStickSpread = 0.2
pistol :: Item
pistol =
bangStick 1
& itUse . heldConsumption .~ [BulletAmmo]
& itUse . heldAmmoTypes .~ [BulletAmmo]
& itUse . heldDelay . rateMax .~ 6
& itUse . heldMods .~ PistolMod
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 10 0) 0 0.05]
+1 -1
View File
@@ -43,7 +43,7 @@ forceFieldGun =
-- than the list below
--[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
& itType . iyBase .~ HELD FORCEFIELDGUN
& itUse . heldConsumption .~ [ElectricalAmmo]
& itUse . heldAmmoTypes .~ [ElectricalAmmo]
{- |
Sends out pulses that display walls.
+1 -1
View File
@@ -16,7 +16,7 @@ droneLauncher =
& itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 0.5
& itUse . heldAim . aimStance .~ TwoHandOver
& itUse . heldConsumption .~ [DroneAmmo]
& itUse . heldAmmoTypes .~ [DroneAmmo]
& itType . iyBase .~ HELD DRONELAUNCHER
lasDronesPic :: Item -> SPic
+3 -3
View File
@@ -145,13 +145,13 @@ ammoCheckI eff ams itm cr w = fromMaybe (failsound w) $ do
x <- ams ^? ix 0 . itUse . amagLoadStatus . iaLoaded
guard $ x > 0
matype <- ams ^? ix 0 . itUse . amagType
iatype <- itm ^? itUse . heldConsumption . ix 0
iatype <- itm ^? itUse . heldAmmoTypes . ix 0
guard $ matype == iatype
return $ eff ams itm cr $ w -- & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
where
failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
Just 0 -> soundStart (CrReloadSound (_crID cr)) (_crPos cr) click1S Nothing
_ -> soundContinue (CrReloadSound (_crID cr)) (_crPos cr) click1S Nothing
Just 0 -> soundStart (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing
_ -> soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing
itUseCharge :: Int -> Item -> Item
itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
+2 -2
View File
@@ -29,8 +29,8 @@ createProjectile ammoitem muz itm cr = fromMaybe failsound $ do
-- 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 (CrReloadSound (_crID cr)) (_crPos cr) click1S Nothing w'
_ -> soundContinue (CrReloadSound (_crID cr)) (_crPos cr) click1S Nothing w'
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 =
+3 -3
View File
@@ -10,7 +10,7 @@ import Dodge.HeldScroll
import Dodge.InputFocus
import Dodge.Inventory
import Dodge.SelectionSections
import Dodge.SoundLogic
--import Dodge.SoundLogic
import Dodge.Terminal
import Dodge.Tweak
import qualified IntMapHelp as IM
@@ -32,10 +32,10 @@ updateWheelEvent yi w = case w ^. hud . hudElement of
(Just (invid,hs), _) -> doHeldScroll invid hs y w
| lbDown -> w & wCam . camZoom +~ y
| invKeyDown -> changeSwapSel yi w
| otherwise -> stopSoundFrom (CrReloadSound 0) $ scrollAugInvSel yi w
| otherwise -> scrollAugInvSel yi w
DisplayInventory{_subInventory = ExamineInventory mi}
| invKeyDown && rbDown -> w & moveTweakSel yi
| invKeyDown -> stopSoundFrom (CrReloadSound 0) $ scrollAugInvSel yi w
| invKeyDown -> scrollAugInvSel yi w
| rbDown -> w & changeTweakParam mi yi
| otherwise -> w & moveTweakSel yi
DisplayInventory{_subInventory = CombineInventory{}} -> w & moveCombineSel yi