diff --git a/ghcidOutput b/ghcidOutput index e4d68fdf8..6800bccdc 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1 +1 @@ -All good (620 modules, at 21:50:15) +All good (620 modules, at 22:05:15) diff --git a/src/Dodge/Data/Item/HeldUse.hs b/src/Dodge/Data/Item/HeldUse.hs index a394941fb..094b4d4f5 100644 --- a/src/Dodge/Data/Item/HeldUse.hs +++ b/src/Dodge/Data/Item/HeldUse.hs @@ -25,7 +25,7 @@ data Huse -- | HeldLaser -- | HeldCircleLaser -- | HeldDualLaser - | HeldTractor +-- | HeldTractor | HeldForceField | HeldShatter deriving (Eq, Ord, Show, Read) --Generic, Flat) diff --git a/src/Dodge/HeldUse.hs b/src/Dodge/HeldUse.hs index a02652b4e..7399e9cb6 100644 --- a/src/Dodge/HeldUse.hs +++ b/src/Dodge/HeldUse.hs @@ -62,6 +62,7 @@ bulGunEffect' t cr w = fromMaybe (error "error in bulGunEffect") $ do & doWeaponRepetitions upitm cr -- & cWorld . lWorld . lTestInt +~ 1 +-- need to be careful about inventory lock or item ids here doWeaponRepetitions :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World doWeaponRepetitions itm cr = case itm ^? ldtValue . itUse . heldParams . weaponRepeat of Just (x:xs) -> cWorld . lWorld . delayedEvents .++~ ((x:xs) <&> (,WdWdFromItCrixWdWd upitm (_crID cr) ItCrWdItemEffect)) @@ -218,18 +219,17 @@ walkNozzle mzid mz itm cr w = fromMaybe w $ do shootTractorBeam :: Item -> Creature -> World -> World -shootTractorBeam _ cr w = w & cWorld . lWorld . tractorBeams .:~ tractorBeamAt' spos outpos dir power +shootTractorBeam itm cr w = w & cWorld . lWorld . tractorBeams .:~ tractorBeamAt spos outpos dir power where cpos = _crPos cr spos = cpos +.+ (_crRad cr + 10) *.* unitVectorAtAngle dir xpos = cpos +.+ 400 *.* unitVectorAtAngle dir dir = _crDir cr outpos = fst $ collidePointWallsFilter (const True) cpos xpos w - power = _attractionPower . _itParams $ _crInv cr IM.! itRef - itRef = cr ^?! crManipulation . manObject . imRootItem -- unsafe!! TODO change + power = _attractionPower . _itParams $ itm -tractorBeamAt' :: Point2 -> Point2 -> Float -> Point2 -> TractorBeam -tractorBeamAt' pos outpos dir power = +tractorBeamAt :: Point2 -> Point2 -> Float -> Point2 -> TractorBeam +tractorBeamAt pos outpos dir power = TractorBeam { _tbPos = pos , _tbStartPos = outpos @@ -316,7 +316,7 @@ useHeld hu = case hu of -- HeldLaser -> shootLaser . _ldtValue -- HeldCircleLaser -> circleLaser . _ldtValue -- HeldDualLaser -> shootDualLaser . _ldtValue - HeldTractor -> aTractorBeam . _ldtValue +-- HeldTractor -> aTractorBeam . _ldtValue -- HeldSonicWave -> aSonicWave HeldForceField -> useForceFieldGun . _ldtValue HeldShatter -> shootShatter . _ldtValue diff --git a/src/Dodge/Item/Weapon/BatteryGuns.hs b/src/Dodge/Item/Weapon/BatteryGuns.hs index 73abdf932..ebe9976fc 100644 --- a/src/Dodge/Item/Weapon/BatteryGuns.hs +++ b/src/Dodge/Item/Weapon/BatteryGuns.hs @@ -7,15 +7,15 @@ module Dodge.Item.Weapon.BatteryGuns ( shootLaser, --circleLaser, --shootDualLaser, - aTractorBeam, +-- aTractorBeam, ) where -import Dodge.Base +--import Dodge.Base import Dodge.Beam --import Dodge.Creature.HandPos import Dodge.Data.World --import Dodge.Item.Weapon.LaserPath -import Geometry +--import Geometry --import qualified IntMapHelp as IM import LensHelp --import Picture @@ -146,23 +146,23 @@ shootLaser it cr = -- basicBeamAt itid w col dam phasev pos dir -- & bmType .~ bt -aTractorBeam :: Item -> Creature -> World -> World -aTractorBeam itm cr w = w & cWorld . lWorld . tractorBeams .:~ tractorBeamAt spos outpos dir power - where - cpos = _crPos cr - spos = cpos +.+ (_crRad cr + 10) *.* unitVectorAtAngle dir - xpos = cpos +.+ 400 *.* unitVectorAtAngle dir - dir = _crDir cr - outpos = fst $ collidePointWallsFilter (const True) cpos xpos w - power = _attractionPower . _itParams $ itm - -tractorBeamAt :: Point2 -> Point2 -> Float -> Point2 -> TractorBeam -tractorBeamAt pos outpos dir power = - TractorBeam - { _tbPos = pos - , _tbStartPos = outpos - , _tbVel = d - , _tbTime = 10 - } - where - d = unitVectorAtAngle dir * power +--aTractorBeam :: Item -> Creature -> World -> World +--aTractorBeam itm cr w = w & cWorld . lWorld . tractorBeams .:~ tractorBeamAt spos outpos dir power +-- where +-- cpos = _crPos cr +-- spos = cpos +.+ (_crRad cr + 10) *.* unitVectorAtAngle dir +-- xpos = cpos +.+ 400 *.* unitVectorAtAngle dir +-- dir = _crDir cr +-- outpos = fst $ collidePointWallsFilter (const True) cpos xpos w +-- power = _attractionPower . _itParams $ itm +-- +--tractorBeamAt :: Point2 -> Point2 -> Float -> Point2 -> TractorBeam +--tractorBeamAt pos outpos dir power = +-- TractorBeam +-- { _tbPos = pos +-- , _tbStartPos = outpos +-- , _tbVel = d +-- , _tbTime = 10 +-- } +-- where +-- d = unitVectorAtAngle dir * power diff --git a/src/Dodge/Item/Weapon/TriggerType.hs b/src/Dodge/Item/Weapon/TriggerType.hs index b73a9d183..da6e384a3 100644 --- a/src/Dodge/Item/Weapon/TriggerType.hs +++ b/src/Dodge/Item/Weapon/TriggerType.hs @@ -24,7 +24,7 @@ module Dodge.Item.Weapon.TriggerType ( withPositionOffset, withPositionWallCheck, withPosDirWallCheck, - withWarmUp, + --withWarmUp, hammerCheckL, hammerCheck, shootL, @@ -173,31 +173,6 @@ itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x) -- repeatFire = crWeaponReady cr && _rateTime (_heldDelay (_itUse item')) == 1 -- firstFire = crWeaponReady cr && _rateTime (_heldDelay (_itUse item')) == 0 --- | Apply effect after a warm up. - --- note this is quite unsafe, requires the item to have the correct delay type -withWarmUp :: - -- | warm up sound id - SoundID -> - ChainEffect -withWarmUp soundID f item cr w --- | curWarmUp < maxWarmUp && crWeaponReady cr = - | curWarmUp < maxWarmUp = - w - & pointertoitem . itUse . heldDelay . warmTime +~ 2 - & soundContinue (CrWeaponSound cid 0) (_crPos cr) soundID (Just 2) - | otherwise = - w - & pointertoitem . itUse . heldDelay . warmTime .~ (maxWarmUp + 1) - & f item cr - where - item' = _ldtValue item - cid = _crID cr - itRef = cr ^?! crManipulation . manObject . imRootItem -- unsafe!! TODO change - pointertoitem = cWorld . lWorld . creatures . ix cid . crInv . ix itRef - curWarmUp = _warmTime . _heldDelay $ _itUse item' - maxWarmUp = _warmMax . _heldDelay $ _itUse item' - withSoundItemChoiceStart :: (Item -> SoundID) -> ChainEffect @@ -284,8 +259,9 @@ useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of cid = _crID cr setUseRate = cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itUse . heldDelay . rateTime +~ userate - -- this should use the ITEMS invid location! - itRef = cr ^?! crManipulation . manObject . imRootItem -- unsafe!! TODO change + -- the following is unsafe, but if ilInvID isn't correctly set we probably + -- will have problems elsewhere also + itRef = item ^?! ldtValue . itLocation . ilInvID userate = fromMaybe 0 $ item ^? ldtValue . itUse . heldDelay . rateMax -- | Applies a world effect after a hammer position check.