Commit before rethinking item positioning, broken item hammer

This commit is contained in:
2022-07-07 07:50:05 +01:00
parent 9159281f85
commit c2e7fcc897
21 changed files with 85 additions and 87 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ batteryGuns =
[ teslaGun
, sparkGun
, lasGun
, lasSway
-- , lasSway
, lasSwing
] ++
[ lasGunWide i | i <- [2..10]
+2 -2
View File
@@ -111,10 +111,10 @@ data ItemBaseType
| LASPULSE
| DUALBEAM
| LASGUNSWING
| LASGUNSWAY
-- | LASGUNSWAY
| LASGUNWIDEPULSE
| LASGUNWIDE {_xNum :: Int}
| LASGUNFOCUS Int
-- | LASGUNFOCUS Int
| SONICGUN
| TRACTORGUN
| LAUNCHER
+2 -1
View File
@@ -467,12 +467,13 @@ data FloorItem = FlIt { _flIt :: Item , _flItPos :: Point2 , _flItRot :: Float,
data ItemPos
= InInv { _ipCrId :: Int , _ipInvId :: Int }
| OnFloor { _ipFlID :: Int }
| VoidItm
data ItemUse
= RightUse
{ _rUse :: Item -> Creature -> World -> World
, _useDelay :: UseDelay
, _useMods :: [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
, _useHammer :: HammerType
, _useHammer' :: HammerPosition
, _useAim :: AimParams
, _heldScroll :: Float -> Creature -> Item -> Item
}
+5 -7
View File
@@ -34,31 +34,29 @@ defaultChargeable = ChargeableAmmo 100 100
ruseRate :: Int
-> (Item -> Creature -> World -> World)
-> HammerType
-> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
-> ItemUse
ruseRate i f ht usemods = RightUse
ruseRate i f usemods = RightUse
{ _rUse = f
, _useDelay = FixedRate
{ _rateMax = i
, _rateTime = 0
}
, _useMods = usemods
, _useHammer = ht
, _useHammer' = HammerUp
, _useAim = defaultAimParams
, _heldScroll = \_ _ -> id
}
ruseInstant
:: (Item -> Creature -> World -> World)
-> HammerType
-> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
-> ItemUse
ruseInstant f ht usemods = RightUse
ruseInstant f usemods = RightUse
{ _rUse = f
, _useDelay = NoDelay
, _useMods = usemods
, _useHammer = ht
, _useHammer' = HammerUp
, _useAim = defaultAimParams
, _heldScroll = \_ _ -> id
}
@@ -68,7 +66,7 @@ defaultrUse = RightUse
{ _rUse = \_ _ -> id
, _useDelay = FixedRate {_rateMax = 8, _rateTime = 0}
, _useMods = []
, _useHammer = HasHammer HammerUp
, _useHammer' = HammerUp
, _useAim = defaultAimParams
, _heldScroll = \_ _ -> id
}
+4 -4
View File
@@ -62,10 +62,10 @@ itemFromBase ibt = case ibt of
LASPULSE -> lasPulse
DUALBEAM -> dualBeam
LASGUNSWING -> lasSwing
LASGUNSWAY -> lasSway
--LASGUNSWAY -> lasSway
LASGUNWIDEPULSE -> lasWidePulse
LASGUNWIDE i -> lasGunWide i
LASGUNFOCUS i -> lasFocus i
--LASGUNFOCUS i -> lasFocus i
SONICGUN -> sonicGun
TRACTORGUN -> tractorGun
LAUNCHER -> launcher
@@ -203,10 +203,10 @@ baseToFamily ibt = case ibt of
LASPULSE -> HeldFamily
DUALBEAM -> HeldFamily
LASGUNSWING -> HeldFamily
LASGUNSWAY -> HeldFamily
-- LASGUNSWAY -> HeldFamily
LASGUNWIDEPULSE -> HeldFamily
LASGUNWIDE _ -> HeldFamily
LASGUNFOCUS _ -> HeldFamily
--LASGUNFOCUS _ -> HeldFamily
SONICGUN -> HeldFamily
TRACTORGUN -> HeldFamily
LAUNCHER -> HeldFamily
+1 -1
View File
@@ -129,7 +129,7 @@ flatShield = defaultEquipment
{ _rUse = \_ _ -> id
, _useDelay = NoDelay
, _useMods = []
, _useHammer = NoHammer
, _useHammer' = HammerUp
, _useAim = AimParams
{ _aimWeight = 5
, _aimRange = 0
+1
View File
@@ -34,3 +34,4 @@ pointToItem :: Applicative f =>
pointToItem (InInv cid invid) = creatures . ix cid . crInv . ix invid
pointToItem (OnFloor flid) = floorItems . ix flid . flIt
--itToPointer :: Item ->
+2 -3
View File
@@ -16,14 +16,13 @@ import Data.Maybe
--import Control.Lens
ruseAmmoParamsRate :: Int
-> HammerType
-> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
-> ItemUse
ruseAmmoParamsRate rate ht usemods = RightUse
ruseAmmoParamsRate rate usemods = RightUse
{ _rUse = useAmmoParams Nothing
, _useDelay = FixedRate {_rateMax = rate,_rateTime = 0}
, _useMods = usemods
, _useHammer = ht
, _useHammer' = HammerUp
, _useAim = defaultAimParams
, _heldScroll = \_ _ -> id
}
+45 -45
View File
@@ -3,9 +3,9 @@ module Dodge.Item.Weapon.BatteryGuns
, dualBeam
, lasGunWide
, lasWidePulse
, lasSway
--, lasSway
, lasSwing
, lasFocus
--, lasFocus
, lasPulse
, sparkGun
, teslaGun
@@ -76,7 +76,7 @@ teslaGun = defaultBatteryGun
{ _itConsumption = defaultLoadable
& laMax .~ 200
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
, _itUse = ruseInstant shootTeslaArc NoHammer
, _itUse = ruseInstant shootTeslaArc
[ ammoCheckI
, withTempLight 1 100 (V3 0 0 1)
, withSoundForI elecCrackleS 1
@@ -127,7 +127,7 @@ lasGunWide n = lasGun
& itType . iyBase .~ LASGUNWIDE n
& itParams . lasColor .~ orange
& itParams . lasDamage .~ 2
& itUse .~ ( ruseInstant shootLaser NoHammer
& itUse .~ ( ruseInstant shootLaser
[ ammoCheckI
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
@@ -147,7 +147,7 @@ lasWidePulse = lasGun
& itType . iyBase .~ LASGUNWIDEPULSE
& itParams . lasColor .~ orange
& itParams . lasDamage .~ 2
& itUse .~ ( ruseInstant shootLaser NoHammer
& itUse .~ ( ruseInstant shootLaser
[ ammoCheckI
, withItem $ \it -> withTempLight 1 (100 * frac it) (xyzV4 (_lasColor $ _itParams it))
, withItem $ \it -> withSoundForVol (frac it) tone440sawtoothquietS 2
@@ -169,43 +169,43 @@ lasWidePulse = lasGun
xs it = [ 0.25 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
where
n' = (ceiling $ (150 :: Float) * frac it) :: Int
lasSway :: Item
lasSway = lasGun
& itType . iyBase .~ LASGUNSWAY
& itParams . lasColor .~ orange
& itParams . lasDamage .~ 11
& itUse .~ ( ruseInstant shootLaser NoHammer
[ ammoCheckI
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withSoundForI tone440sawtoothquietS 2
, useAmmoAmount 1
, withItemUpdate itup $ \it -> duplicateOffsets (x it)
]
& useAim . aimWeight .~ 6
& useAim . aimRange .~ 1
& useAim . aimStance .~ TwoHandTwist
)
where
itup = itParams . lasCycle %~ (\i -> (i+1) `mod` 40)
x it = [ 15 * sin (pi * fromIntegral x' * 0.05) ]
where
x' = _lasCycle $ _itParams it
lasFocus :: Int -> Item
lasFocus n = lasGunWide n
& itType . iyBase .~ LASGUNFOCUS n
& itParams . lasColor .~ red
& itUse . useMods .~
[ ammoCheckI
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withSoundForI tone440sawtoothquietS 2
, useAmmoAmount 1
, duplicateOffsetsFocus xs
]
where
n' = 9 * n
xs = [ 0.25 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
--lasSway :: Item
--lasSway = lasGun
-- & itType . iyBase .~ LASGUNSWAY
-- & itParams . lasColor .~ orange
-- & itParams . lasDamage .~ 11
-- & itUse .~ ( ruseInstant shootLaser
-- [ ammoCheckI
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
-- , withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
-- , withSoundForI tone440sawtoothquietS 2
-- , useAmmoAmount 1
-- , withItemUpdate itup $ \it -> duplicateOffsets (x it)
-- ]
-- & useAim . aimWeight .~ 6
-- & useAim . aimRange .~ 1
-- & useAim . aimStance .~ TwoHandTwist
-- )
-- where
-- itup = itParams . lasCycle %~ (\i -> (i+1) `mod` 40)
-- x it = [ 15 * sin (pi * fromIntegral x' * 0.05) ]
-- where
-- x' = _lasCycle $ _itParams it
--lasFocus :: Int -> Item
--lasFocus n = lasGunWide n
-- & itType . iyBase .~ LASGUNFOCUS n
-- & itParams . lasColor .~ red
-- & itUse . useMods .~
-- [ ammoCheckI
-- , withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
-- , withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
-- , withSoundForI tone440sawtoothquietS 2
-- , useAmmoAmount 1
-- , duplicateOffsetsFocus xs
-- ]
-- where
-- n' = 9 * n
-- xs = [ 0.25 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
dualBeam :: Item
dualBeam = lasGun
@@ -222,7 +222,7 @@ dualBeam = lasGun
, _subParams = Nothing
, _dbGap = 20
}
& itUse .~ (ruseInstant shootDualLaser NoHammer
& itUse .~ (ruseInstant shootDualLaser
[ ammoCheckI
, withItem $ \it -> withMuzPosShift (V2 0 (thegap it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8
, withItem $ \it -> withMuzPosShift (V2 0 (-thegap it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8
@@ -259,7 +259,7 @@ lasGun = defaultAutoBatteryGun
{ _itConsumption = defaultLoadable
& laMax .~ 200
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
, _itUse = ruseInstant shootLaser NoHammer
, _itUse = ruseInstant shootLaser
[ ammoCheckI
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
, withSoundForI tone440sawtoothquietS 2
@@ -337,7 +337,7 @@ tractorGun = lasGun
{ _itConsumption = defaultLoadable
& laMax .~ 10000
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
, _itUse = ruseInstant aTractorBeam NoHammer
, _itUse = ruseInstant aTractorBeam
[ ammoCheckI
]
& useAim . aimWeight .~ 6
+3 -3
View File
@@ -43,7 +43,7 @@ defaultBangCane = defaultBulletWeapon
, _torqueAfter = 0.1
, _randomOffset = 0
}
, _itUse = ruseAmmoParamsRate 6 upHammer
, _itUse = ruseAmmoParamsRate 6
[ ammoHammerCheck
, useTimeCheck
, withSoundStart tap3S
@@ -70,7 +70,7 @@ defaultBangCane = defaultBulletWeapon
& itConsumption . laCycle .~ [loadPartialInsert 10 1]
volleyGun :: Int -> Item
volleyGun i = defaultBulletWeapon
& itUse .~ ruseAmmoParamsRate 6 upHammer
& itUse .~ ruseAmmoParamsRate 6
[ ammoHammerCheck
, useTimeCheck
, withSoundItemChoiceStart caneStickSoundChoice
@@ -224,7 +224,7 @@ burstRifle = repeater
-- , withRecoil
-- ]
miniGunUse :: Int -> ItemUse
miniGunUse i = ruseInstant (useAmmoParams $ Just 1) NoHammer $
miniGunUse i = ruseInstant (useAmmoParams $ Just 1) $
[ ammoCheckI
, withWarmUp crankSlowS
, withSoundForI mini1S 2
+2 -2
View File
@@ -48,7 +48,7 @@ bangRod = defaultBulletWeapon
, _torqueAfter = 0.3
, _randomOffset = 0
}
, _itUse = ruseAmmoParamsRate 12 upHammer
, _itUse = ruseAmmoParamsRate 12
[ ammoHammerCheck
, useTimeCheck
, withSoundStart bangEchoS
@@ -128,7 +128,7 @@ sniperRifle = elephantGun
machineGun :: Item
machineGun = bangRod
& itType . iyBase .~ MACHINEGUN
& itUse .~ (ruseAmmoParamsRate 25 NoHammer
& itUse .~ (ruseAmmoParamsRate 25
[ ammoCheckI
, rateIncAB (torqueBeforeAtLeast 0.1 0.1) withTorqueAfter
, withSoundStart bangEchoS
+4 -4
View File
@@ -13,7 +13,7 @@ import Dodge.Data
import Dodge.ChainEffect
import Dodge.Default.Weapon
--import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Default
--import Dodge.Default
--import Dodge.Item.Attachment
--import Dodge.Item.Weapon.ExtraEffect
--import Dodge.Item.Weapon.InventoryDisplay
@@ -41,7 +41,7 @@ bangStickSoundChoice it
bangStick :: Int -> Item
bangStick i = defaultBulletWeapon
{ _itUse = ruseAmmoParamsRate 8 upHammer
{ _itUse = ruseAmmoParamsRate 8
[ ammoHammerCheck
, useTimeCheck
, withSoundItemChoiceStart bangStickSoundChoice
@@ -159,7 +159,7 @@ pistol = bangStick 1
& itConsumption .~ ( defaultBulletLoadable
& laMax .~ 15
& laCycle .~ [loadEject 5, loadInsert 5 , loadPrime 5] )
& itUse .~ ruseAmmoParamsRate 6 upHammer (ammoHammerCheck : pistolAfterHamMods)
& itUse .~ ruseAmmoParamsRate 6 (ammoHammerCheck : pistolAfterHamMods)
& itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it)
& itParams %~
( ( muzVel .~ 0.8 )
@@ -193,7 +193,7 @@ smg = autoPistol -- & some parameter affecting stability
<> makeTinClipAt 0 (V3 7 (-2) 0) it)
revolverX :: Int -> Item
revolverX i = revolver
{ _itUse = ruseAmmoParamsRate 8 upHammer
{ _itUse = ruseAmmoParamsRate 8
[ ammoHammerCheck
, useTimeCheck
-- rather than locking the inventory, a better solution may be to check
+2 -2
View File
@@ -44,7 +44,7 @@ autoGun = defaultAutoGun
, _laLoaded = 30
}
& laCycle .~ [loadEject 30, loadInsert 30 , loadPrime 10]
, _itUse = ruseAmmoParamsRate 4 NoHammer
, _itUse = ruseAmmoParamsRate 4
[ ammoCheckI
, charFiringStratI
[('S', hammerCheckI)
@@ -93,7 +93,7 @@ autoGunPic it = noPic $
bangCone :: Item
bangCone = defaultBulletWeapon
{ _itUse = ruseAmmoParamsRate 20 upHammer
{ _itUse = ruseAmmoParamsRate 20
[ ammoCheckI
, hammerCheckI
, useTimeCheck
+2 -2
View File
@@ -1,7 +1,7 @@
module Dodge.Item.Weapon.Drone where
import Dodge.Data
import Dodge.Default.Weapon
import Dodge.Default
--import Dodge.Default
import Dodge.SoundLogic.LoadSound
import Dodge.Item.Weapon.TriggerType
import Geometry
@@ -20,7 +20,7 @@ import Control.Lens
droneLauncher :: Item
droneLauncher = defaultWeapon
{ _itUse = ruseRate 20 aDroneWithItemParams upHammer
{ _itUse = ruseRate 20 aDroneWithItemParams
[ ammoCheckI
, useTimeCheck
, withSoundStart tap4S
+2 -2
View File
@@ -6,7 +6,7 @@ module Dodge.Item.Weapon.Launcher
) where
import Dodge.Data
import Dodge.Reloading.Action
import Dodge.Default
--import Dodge.Default
import Dodge.Default.Weapon
import Dodge.Item.Location
import Dodge.SoundLogic.LoadSound
@@ -47,7 +47,7 @@ launcher = defaultWeapon
& laMax .~ 1
& laLoaded .~ 1
& laCycle .~ [loadEject 30, loadInsert 30, loadPrime 10]
, _itUse = ruseRate 20 usePjCreation upHammer
, _itUse = ruseRate 20 usePjCreation
[ hammerCheckI
, ammoCheckI
, useTimeCheck
+1 -1
View File
@@ -23,7 +23,7 @@ import Control.Lens
Sends out pulses that display walls. -}
clickDetector :: Detector -> Item
clickDetector dt = defaultWeapon
{ _itUse = ruseRate 20 (detectorEffect dt) upHammer
{ _itUse = ruseRate 20 (detectorEffect dt)
[ ammoUseCheck
]
& useAim . aimRange .~ 1
+2 -2
View File
@@ -10,7 +10,7 @@ import Dodge.Base.Collide
import Dodge.Creature.HandPos
--import Dodge.ChainEffect
import Dodge.Default.Weapon
import Dodge.Default
--import Dodge.Default
--import Dodge.Item.Attachment
--import Dodge.Item.Weapon.ExtraEffect
--import Dodge.Item.Weapon.InventoryDisplay
@@ -29,7 +29,7 @@ import LensHelp
shatterGun :: Item
shatterGun = defaultWeapon
& itType . iyBase .~ SHATTERGUN
& itUse .~ ruseRate 10 shootShatter upHammer
& itUse .~ ruseRate 10 shootShatter
[ ammoHammerCheck
, useTimeCheck
-- , withSoundStart tap3S
+1 -1
View File
@@ -34,7 +34,7 @@ sonicGun = defaultAutoGun
{ _itConsumption = defaultLoadable
& laMax .~ 10
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
, _itUse = ruseRate 8 aSonicWave (HasHammer HammerUp)
, _itUse = ruseRate 8 aSonicWave
[ ammoHammerCheck
, useTimeCheck
, useAmmoAmount 1
+1 -2
View File
@@ -3,7 +3,7 @@ import Dodge.Data
import Dodge.Item.Weapon.TriggerType
--import Dodge.Item.Weapon.Remote
import Dodge.Default.Weapon
import Dodge.Default
--import Dodge.Default
--import Dodge.Item.Weapon.Grenade
import Geometry
import qualified IntMapHelp as IM
@@ -19,7 +19,6 @@ spawnGun cr = defaultWeapon
{ _itConsumption = defaultLoadable
, _itUse = ruseRate 100
(\_ -> spawnCrNextTo cr)
upHammer
[ ammoCheckI
, hammerCheckI
]
+1 -1
View File
@@ -124,7 +124,7 @@ flameThrower = defaultAutoGun
,_amCreateGas = aFlame
}
& laCycle .~ [loadEject 5, loadInsert 10 , loadPrime 20]
, _itUse = ruseInstant (overNozzles useGasParams) NoHammer
, _itUse = ruseInstant (overNozzles useGasParams)
[ ammoCheckI
, useAmmoAmount 1
, withSidePushI 5
+1 -1
View File
@@ -119,7 +119,7 @@ autoEffectGun name eff = defaultWeapon
forceFieldGun :: Item
forceFieldGun = defaultWeapon
{ _itConsumption = defaultLoadable & laAmmoType .~ ForceFieldAmmo forceField
, _itUse = ruseInstant useForceFieldGun (HasHammer HammerUp)
, _itUse = ruseInstant useForceFieldGun
[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
-- , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-4,-4),(-4,4),(4,4),(4,0),(0,0),(0,-4)]
, _itTargeting = targetRBPress & tgDraw .~ targetDistanceDraw