Start unifying heldUse and heldMods

This commit is contained in:
2024-09-15 10:54:24 +01:00
parent cde7bc9aef
commit 6f372109d9
33 changed files with 585 additions and 270 deletions
+1 -1
View File
@@ -187,7 +187,7 @@ heldItemSPic ht it = case ht of
SPARKGUN -> teslaGunPic
TESLAGUN -> teslaGunPic
LASGUN -> lasGunPic it
LASCIRCLE -> lasGunPic it
-- LASCIRCLE -> lasGunPic it
DUALBEAM -> dualBeamPic it
LASWIDE _ -> lasGunPic it
--SONICGUN -> noPic baseSonicShape
+1 -1
View File
@@ -56,7 +56,7 @@ itemFromHeldType ht = case ht of
SPARKGUN -> sparkGun
TESLAGUN -> teslaGun
LASGUN -> lasGun
LASCIRCLE -> lasCircle
-- LASCIRCLE -> lasCircle
DUALBEAM -> dualBeam
LASWIDE i -> lasWide i
TRACTORGUN -> tractorGun
+22 -22
View File
@@ -24,13 +24,13 @@ teslaGun =
& itDimension . dimRad .~ 9
& itDimension . dimCenter .~ V3 4 0 0
& itParams .~ teslaParams
& itUse . heldUse .~ HeldTeslaArc --shootTeslaArc
-- & itUse . heldUse .~ HeldTeslaArc --shootTeslaArc
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ TeslaMod
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimStance .~ TwoHandFlat
-- & itUse . heldAim . aimMuzPos .~ 4
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 4 0) 0 0]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 4 0) 0 0 0]
& itType . iyBase .~ HELD TESLAGUN
lasGun :: Item
@@ -51,7 +51,7 @@ lasGun =
}
& itDimension . dimRad .~ 10
& itDimension . dimCenter .~ V3 15 0 0
& itUse . heldUse .~ HeldLaser --shootLaser
-- & itUse . heldUse .~ HeldLaser --shootLaser
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ LasMod
& itUse . heldAim . aimWeight .~ 6
@@ -59,7 +59,7 @@ lasGun =
& itUse . heldAim . aimStance .~ TwoHandUnder
-- & itUse . heldAim . aimHandlePos .~ 5
-- & itUse . heldAim . aimMuzPos .~ 30
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0]
& itType . iyBase .~ HELD LASGUN
lasGunTweak :: TweakParam
@@ -78,12 +78,13 @@ tractorGun =
.~ Tweakable
{ _tweakParams = IM.fromList [(0, tractorGunTweak)]
}
& itUse . heldUse .~ HeldTractor --aTractorBeam
-- & itUse . heldUse .~ HeldTractor --aTractorBeam
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ AmmoCheckMod
-- & itUse . heldMods .~ AmmoCheckMod
& itUse . heldMods .~ TractorMod
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0]
& itType . iyBase .~ HELD TRACTORGUN
tractorGunTweak :: TweakParam
@@ -101,7 +102,7 @@ lasWide n =
& itParams . lasColor .~ yellow
& itParams . lasDamage .~ 2
& itUse . heldMods .~ LasWideMod n
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 y) 0 0 | y <- spreadFromCenter n 1]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 y) 0 0 0 | y <- spreadFromCenter n 1]
defaultBatteryGun :: Item
defaultBatteryGun =
@@ -120,24 +121,23 @@ defaultAutoBatteryGun =
defaultHeldItem
& itType . iyModules .~ batteryModules
lasCircle :: Item
lasCircle =
lasGun
& itType . iyBase .~ HELD LASCIRCLE
& itParams . lasColor .~ orange
& itParams . lasDamage .~ 2
& itUse . heldUse .~ HeldLaser --shootLaser
& itUse . heldDelay .~ NoDelay
& itUse . heldUse .~ HeldCircleLaser --circleLaser
& itUse . heldMods .~ CircleLaserMod
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
--lasCircle :: Item
--lasCircle =
-- lasGun
-- & itType . iyBase .~ HELD LASCIRCLE
-- & itParams . lasColor .~ orange
-- & itParams . lasDamage .~ 2
-- & itUse . heldDelay .~ NoDelay
---- & itUse . heldUse .~ HeldCircleLaser --circleLaser
-- & itUse . heldMods .~ CircleLaserMod
-- & itUse . heldAim . aimWeight .~ 6
-- & itUse . heldAim . aimRange .~ 1
dualBeam :: Item
dualBeam =
lasGun
& itType . iyBase .~ HELD DUALBEAM
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0]
& itParams
.~ DualBeam
{ _phaseV = 1
@@ -149,7 +149,7 @@ dualBeam =
, _subParams = Nothing
, _dbGap = 20
}
& itUse . heldUse .~ HeldDualLaser --shootDualLaser
-- & itUse . heldUse .~ HeldDualLaser --shootDualLaser
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ DualBeamMod
& itUse . heldAim . aimWeight .~ 6
+8 -6
View File
@@ -32,7 +32,7 @@ defaultBangCane =
& itUse . heldMods .~ BangCaneMod
& itUse . heldAim . aimStance .~ OneHand
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01 0]
volleyGun :: Int -> Item
volleyGun i =
@@ -42,7 +42,8 @@ volleyGun i =
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandFlat
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 3]
& itUse . heldAim . aimMuzzles .~
([Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 3] <*> [0..])
& itUse . heldParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
& itType . iyBase .~ HELD (VOLLEYGUN i)
@@ -54,7 +55,8 @@ multiGun i =
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandFlat
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 3]
& itUse . heldAim . aimMuzzles .~
([Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 3] <*> [0..])
& itUse . heldParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
& itType . iyBase .~ HELD (MULTIGUN i)
@@ -66,7 +68,7 @@ rifle =
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 25 0) 0 0.01]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 25 0) 0 0.01 0]
& itType . iyModules . at ModHeldAttach ?~ EMPTYMODULE
repeater :: Item
@@ -94,7 +96,7 @@ burstRifle =
miniGunUse :: Int -> ItemUse
miniGunUse i =
defaultHeldUse
& heldUse .~ HeldUseAmmoParams
-- & heldUse .~ HeldUseAmmoParams
& heldMods .~ MiniGunMod i
& heldDelay .~ WarmUpNoDelay{_warmTime = 0, _warmMax = 100}
& heldAim . aimWeight .~ 6
@@ -108,7 +110,7 @@ miniGunX i =
autoRifle
& itUse .~ miniGunUse i
& itUse . heldAim . aimTurnSpeed .~ 0.5
& itUse . heldAim . aimMuzzles .~ replicate i (Muzzle (V2 30 0) 0 0.05)
& itUse . heldAim . aimMuzzles .~ replicate i (Muzzle (V2 30 0) 0 0.05 0)
& itUse . heldParams . recoil .~ 10
& itUse . heldParams . torqueAfter .~ 0.01
& itUse . heldParams . randomOffset .~ 10
+1 -1
View File
@@ -15,7 +15,7 @@ bangCone =
& itUse . heldDelay . rateMax .~ 20
& itUse . heldMods .~ BangConeMod
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.5]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.5 0]
& itUse . heldParams .~ BulletShooterParams
{ _muzVel = 0.7
, _rifling = 0.8
+6 -5
View File
@@ -24,14 +24,14 @@ launcher =
& itDimension . dimRad .~ 9
& itDimension . dimCenter .~ V3 10 0 0
& itUse . heldDelay . rateMax .~ 20
& itUse . heldUse .~ HeldPJCreation --usePjCreation
-- & itUse . heldUse .~ HeldPJCreation --usePjCreation
& itUse . heldMods .~ LauncherMod
& itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 0.5
& itUse . heldAim . aimStance .~ TwoHandOver
-- & itUse . heldAim . aimHandlePos .~ V2 3 0
-- & itUse . heldAim . aimMuzPos .~ 20
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0 0]
& itUse . heldAmmoTypes .~ [ProjectileAmmo]
& itType . iyBase .~ HELD LAUNCHER
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
@@ -40,9 +40,9 @@ launcherX :: Int -> Item
launcherX i =
launcher
& itType . iyBase .~ HELD (LAUNCHERX i)
& itUse . heldUse .~ HeldPJCreationX i
-- & itUse . heldUse .~ HeldPJCreationX i
& itUse . heldMods .~ LauncherXMod i
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) a 0 | a <- angles]
& itUse . heldAim . aimMuzzles .~ ([Muzzle (V2 20 0) a 0 | a <- angles] <*> [0..])
where
angles = take i [0,2*pi/ fromIntegral i ..]
--angles = take i [1,2 ..]
@@ -51,7 +51,8 @@ remoteLauncher :: Item
remoteLauncher =
launcher
& itType . iyBase .~ HELD REMOTELAUNCHER
& itUse . heldUse .~ HeldFireRemoteShell --fireRemoteShell
-- & itUse . heldUse .~ HeldFireRemoteShell --fireRemoteShell
& itUse . heldMods .~ FireRemoteShellMod
& itScope .~ RemoteScope (V2 0 0) 1
-- & itUse . heldConsumption . laAmmoType . amPjDraw .~ DrawRemoteShell
+1 -1
View File
@@ -35,7 +35,7 @@ bangRod =
& itUse . heldAim . aimStance .~ OneHand
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0.1]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0.1 0]
-- & itUse . heldConsumption . laAmmoType .~ hvBulletAmmo
elephantGun :: Item
+2 -2
View File
@@ -81,14 +81,14 @@ flameThrower =
}
& itDimension . dimRad .~ 7
& itDimension . dimCenter .~ V3 9 0 0
& itUse . heldUse .~ HeldOverNozzlesUseGasParams -- overNozzles useGasParams
-- & itUse . heldUse .~ HeldOverNozzlesUseGasParams -- overNozzles useGasParams
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ FlameThrowerMod
& itUse . heldAim . aimWeight .~ 5
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 5, _izMin = 1.5}
& itUse . heldAim . aimStance .~ TwoHandUnder
-- & itUse . heldAim . aimHandlePos .~ 0
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0 0]
& itUse . heldAmmoTypes .~ [GasAmmo]
& itType . iyBase .~ HELD FLAMETHROWER
& itUse . heldParams .~ GasSprayParams CreateFlame --aGasCloud
+3 -3
View File
@@ -30,7 +30,7 @@ bangStick i =
& itDimension . dimCenter .~ V3 5 0 0
& itUse . heldDelay . rateMax .~ 8
& itUse . heldMods .~ BangStickMod
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 10 0) a 0.01 | a <- spreadAroundCenter i baseStickSpread]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 10 0) a 0.01 0 | a <- spreadAroundCenter i baseStickSpread]
baseStickSpread :: Float
baseStickSpread = 0.2
@@ -41,7 +41,7 @@ pistol =
& itUse . heldAmmoTypes .~ [BulletAmmo]
& itUse . heldDelay . rateMax .~ 6
& itUse . heldMods .~ PistolMod
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 10 0) 0 0.05]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 10 0) 0 0.05 0]
& itUse . heldParams
%~ ( (muzVel .~ 0.8)
. (rifling .~ 0.8)
@@ -72,6 +72,6 @@ smg =
& itUse . heldMods .~ SmgMod --(ammoCheckI : smgAfterHamMods)
& itType . iyBase .~ HELD SMG
& itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0]
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0 0]
-- & itUse . heldAim . aimHandlePos .~ 2
& itUse . heldParams . torqueAfter .~ 0.05
+6 -4
View File
@@ -37,9 +37,10 @@ forceFieldGun =
-- & itUse . useTargeting ?~ TargetRBLine
& itType . iyModules . at ModTarget ?~ TARGET TargetRBLine
& itParams .~ ParamMID Nothing
& itUse . heldUse .~ HeldForceField --useForceFieldGun
-- & itUse . heldUse .~ HeldForceField --useForceFieldGun
& itUse . heldDelay .~ NoDelay
& itUse . heldMods .~ AmmoHammerTimeUseOneMod -- this is slightly different
-- & itUse . heldMods .~ AmmoHammerTimeUseOneMod -- this is slightly different
& itUse . heldMods .~ ForceFieldMod -- this is slightly different
-- than the list below
--[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
& itType . iyBase .~ HELD FORCEFIELDGUN
@@ -52,8 +53,9 @@ clickDetector :: Detector -> Item
clickDetector dt =
defaultWeapon
& itUse . heldDelay . rateMax .~ 20
& itUse . heldUse .~ HeldDetectorEffect dt --detectorEffect dt
& itUse . heldMods .~ AmmoUseCheckMod
-- & itUse . heldUse .~ HeldDetectorEffect dt --detectorEffect dt
-- & itUse . heldMods .~ AmmoUseCheckMod
& itUse . heldMods .~ DetectorMod dt --detectorEffect dt
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1}
& itType . iyBase .~ HELD (HELDDETECTOR dt)
+1 -1
View File
@@ -9,6 +9,6 @@ shatterGun =
defaultHeldItem
& itType . iyBase .~ HELD SHATTERGUN
& itUse . heldDelay . rateMax .~ 10
& itUse . heldUse .~ HeldShatter --shootShatter
-- & itUse . heldUse .~ HeldShatter --shootShatter
& itUse . heldMods .~ ShatterMod
& itUse . heldAim . aimStance .~ TwoHandFlat
+1 -1
View File
@@ -91,7 +91,7 @@ heldInfo hit = case hit of
SPARKGUN -> "A weapon that produces an arc of electricity. The arc will attempt to discharge at a nearby object."
TESLAGUN -> "A weapon that discharges a sustained arc of electricity. The arc will attempt to discharge at a nearby object."
LASGUN -> "A weapon that continuously emits photons in a narrow beam."
LASCIRCLE -> "A extensive configuration of prisms and mirrors that produces multiple laser beams around its user."
-- LASCIRCLE -> "A extensive configuration of prisms and mirrors that produces multiple laser beams around its user."
DUALBEAM -> "A weapon that emits two beams that converge at a selectable point in front of the user."
LASWIDE _ -> "A weapon that continuously emits photons in a narrow beam. The beam expands as the weapon heats up."
TRACTORGUN -> "An item that produces a beam of gravitons."
+1 -1
View File
@@ -55,7 +55,7 @@ heldBounds hit = case hit of
SPARKGUN -> ts
TESLAGUN -> ts
LASGUN -> ls
LASCIRCLE -> ls
-- LASCIRCLE -> ls
DUALBEAM -> ls
LASWIDE _ -> ls
TRACTORGUN -> ls
+1 -1
View File
@@ -12,7 +12,7 @@ droneLauncher :: Item
droneLauncher =
defaultHeldItem
& itUse . heldDelay . rateMax .~ 20
& itUse . heldMods .~ AmmoUseCheckMod
-- & itUse . heldMods .~ AmmoUseCheckMod
& itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 0.5
& itUse . heldAim . aimStance .~ TwoHandOver
+2 -1
View File
@@ -18,7 +18,8 @@ explodeRemoteRocket itid pjid w =
w
& cWorld . lWorld . projectiles . ix pjid . prjUpdates .~ [PJRetireRemote itid 30 pjid]
& cWorld . lWorld . projectiles . ix pjid . prjDraw .~ DrawBlankProjectile
& itPoint . itUse . heldUse .~ HeldDoNothing
-- & itPoint . itUse . heldUse .~ HeldDoNothing
& itPoint . itUse . heldMods .~ DoNothingMod
& usePayload (_prjPayload thepj) (_prjPos thepj)
where
itPoint = pointerToItemLocation $ w ^?! cWorld . lWorld . itemLocations . ix itid-- _itemLocations (_cWorld w) IM.! itid
+2 -2
View File
@@ -13,8 +13,8 @@ spawnGun :: Creature -> Item
spawnGun _ =
defaultHeldItem
& itUse . heldDelay . rateMax .~ 100
& itUse . heldUse .~ HeldDoNothing --(\_ -> spawnCrNextTo cr)
& itUse . heldMods .~ HeldModNothing
-- & itUse . heldUse .~ HeldDoNothing --(\_ -> spawnCrNextTo cr)
-- & itUse . heldMods .~ DoNothingMod
& itType . iyBase .~ LEFT SPAWNER
spawnCrNextTo ::
+4 -4
View File
@@ -342,7 +342,7 @@ withSidePushAfterI maxSide eff item cr w =
(pushAmount, g) = randomR (- maxSide, maxSide) $ _randGen w
useAllAmmo :: ChainEffect
useAllAmmo eff item cr w = error "use all ammo"
useAllAmmo = error "use all ammo"
--useAllAmmo eff ams item cr w = fromMaybe w $ do
-- let invids = ams ^.. traverse . itLocation . ipInvID
-- return . eff ams item cr $ foldl' f w invids
@@ -668,7 +668,7 @@ repeatOnFrames is hm f it cr w =
-- return $ f it cr' w'
duplicateLoaded :: ChainEffect
duplicateLoaded eff it cr w = error "duplicateLoaded"
duplicateLoaded = error "duplicateLoaded"
--duplicateLoaded :: ChainEffect
--duplicateLoaded eff ams it cr w = foldr f w (take numbul [1::Int .. ])
-- where
@@ -678,7 +678,7 @@ duplicateLoaded eff it cr w = error "duplicateLoaded"
-- cr ^? crInv . ix i . itUse . amagLoadStatus . iaLoaded
duplicateNumBarrels :: Int -> ChainEffect
duplicateNumBarrels n eff itm cr w = error "duplicateNumBarrels"
duplicateNumBarrels = error "duplicateNumBarrels"
--duplicateNumBarrels :: Int -> ChainEffect
--duplicateNumBarrels n eff ams itm cr w = foldr f w (take n $ itm ^?! itUse . heldAim . aimMuzzles)
-- where
@@ -694,7 +694,7 @@ duplicateNumBarrels n eff itm cr w = error "duplicateNumBarrels"
-- (a,g) = randomR (-inacc,inacc) $ _randGen w'
duplicateLoadedBarrels :: ChainEffect
duplicateLoadedBarrels eff itm cr = error "duplicateLoadedBarrels"
duplicateLoadedBarrels eff itm cr = eff itm cr
-- = duplicateNumBarrels numbul eff ams itm cr
-- where
-- numbul :: Int