Cleanup triggertype
This commit is contained in:
+1
-2
@@ -1,2 +1 @@
|
||||
<no location info>: error:
|
||||
module ‘Dodge.ChainEffect’ cannot be found locally
|
||||
All good (601 modules, at 11:42:53)
|
||||
|
||||
@@ -5,7 +5,6 @@ module Dodge.HeldUse (
|
||||
mcUseHeld,
|
||||
) where
|
||||
|
||||
import Dodge.ChainEffect
|
||||
import Color
|
||||
import Data.Maybe
|
||||
import Dodge.Base.Collide
|
||||
|
||||
@@ -34,19 +34,11 @@ module Dodge.Item.Weapon.TriggerType (
|
||||
|
||||
import Dodge.Data.ComposedItem
|
||||
import Dodge.Data.DoubleTree
|
||||
import Dodge.Creature.HandPos
|
||||
import Data.Maybe
|
||||
import Dodge.Base
|
||||
--import Dodge.Creature.Test
|
||||
import Dodge.Data.World
|
||||
import Dodge.Inventory.Lock
|
||||
import Dodge.LightSource
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.WorldEvent
|
||||
import Geometry
|
||||
--import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
import qualified SDL
|
||||
|
||||
type ChainEffect =
|
||||
(LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World) ->
|
||||
@@ -209,104 +201,3 @@ shootL f item cr w
|
||||
fireCondition =
|
||||
_rateTime (_leftDelay (_itUse item)) == 0
|
||||
&& _arLoaded (_leftConsumption (_itUse item)) > 0
|
||||
|
||||
-- reloadCondition = _laLoaded (_itConsumption item) == 0
|
||||
withItem :: (Item -> ChainEffect) -> ChainEffect
|
||||
withItem g f it = g (_ldtValue it) f it
|
||||
|
||||
---- not ideal
|
||||
--withItemUpdateFirst :: (Item -> Item) -> ChainEffect
|
||||
--withItemUpdateFirst up f it cr = f (over ldtValue up it) cr . (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itRef %~ up)
|
||||
-- where
|
||||
-- itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||
--
|
||||
--withItemUpdate :: (Item -> Item) -> (Item -> ChainEffect) -> ChainEffect
|
||||
--withItemUpdate up g f it cr = g (_ldtValue it) f it cr . (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix itRef %~ up)
|
||||
-- where
|
||||
-- itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||
|
||||
withTempLight :: Int -> Float -> V3 Float -> ChainEffect
|
||||
withTempLight time rad col eff item cr =
|
||||
eff item cr
|
||||
. over (cWorld . lWorld . tempLightSources) (theTLS :)
|
||||
where
|
||||
theTLS = tlsTimeRadColPos time rad col (V3 x y 10)
|
||||
V2 x y = _crPos cr +.+ 15 *.* unitVectorAtAngle (_crDir cr)
|
||||
|
||||
modClock :: Int -> ChainEffect -> ChainEffect
|
||||
modClock n chainEff eff it cr w
|
||||
| (w ^. cWorld . lWorld . lClock) `mod` n == 0 = chainEff eff it cr w
|
||||
| otherwise = eff it cr w
|
||||
|
||||
withFlare :: ChainEffect
|
||||
withFlare f it cr =
|
||||
makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) (cpos `v2z` 20)
|
||||
-- . muzFlareAt (V4 5 5 0 2) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
|
||||
. f it cr
|
||||
where
|
||||
cdir = _crDir cr
|
||||
cpos = _crPos cr
|
||||
|
||||
withMuzFlare :: ChainEffect
|
||||
withMuzFlare f itm cr =
|
||||
makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) (cpos `v2z` 20)
|
||||
-- . muzFlareAt (V4 5 5 0 2) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
|
||||
. f itm cr
|
||||
where
|
||||
cdir = _crDir cr
|
||||
cpos = _crPos cr + rotateV (_crDir cr) (_mzPos brl + aimingWeaponZeroPos cr (_ldtValue itm))
|
||||
brl = itm ^?! ldtValue . itUse . heldAim . aimMuzzles . ix 0
|
||||
|
||||
--muzzleOffset :: Creature -> Item -> Point3
|
||||
--muzzleOffset cr it = V3 (holdOffset + 5 + _aimMuzPos dimPort - _aimHandlePos dimPort) 0 0
|
||||
-- where
|
||||
-- dimPort = _heldAim $ _itUse it
|
||||
-- holdOffset
|
||||
-- | crInAimStance OneHand cr = 10
|
||||
-- | otherwise = 0
|
||||
|
||||
withCrPos :: (Point3 -> World -> World) -> ChainEffect
|
||||
withCrPos = withCrPosShift (V2 0 0)
|
||||
|
||||
withCrPosShift :: Point2 -> (Point3 -> World -> World) -> ChainEffect
|
||||
withCrPosShift p g f it cr = g thepos . f it cr
|
||||
where
|
||||
thepos = (_crPos cr +.+ rotateV (_crDir cr) p) `v2z` 20
|
||||
|
||||
withOldDir ::
|
||||
-- | The fraction of the old direction
|
||||
Float ->
|
||||
ChainEffect
|
||||
withOldDir aFrac eff item cr =
|
||||
eff item (cr & crDir %~ tweenAngles aFrac (_crOldDir cr))
|
||||
|
||||
withPositionOffset ::
|
||||
(Item -> Creature -> World -> (Point2, Float)) ->
|
||||
ChainEffect
|
||||
withPositionOffset h f it cr w = f it (cr & crPos .+.+~ p & crDir +~ a) w
|
||||
where
|
||||
(p, a) = h (_ldtValue it) cr w
|
||||
|
||||
withPositionWallCheck ::
|
||||
(Item -> Creature -> World -> Point2) ->
|
||||
ChainEffect
|
||||
withPositionWallCheck h f it cr w
|
||||
| hasLOS p (_crPos cr) w = f it (cr & crPos .~ p) w
|
||||
| otherwise = w
|
||||
where
|
||||
p = h (_ldtValue it) cr w
|
||||
|
||||
withPosDirWallCheck ::
|
||||
(Item -> Creature -> World -> (Point2, Float)) ->
|
||||
ChainEffect
|
||||
withPosDirWallCheck h f it cr w
|
||||
| hasLOS p (_crPos cr) w = f it (cr & crPos .~ p & crDir .~ a) w
|
||||
| otherwise = w
|
||||
where
|
||||
(p, a) = h (_ldtValue it) cr w
|
||||
|
||||
Reference in New Issue
Block a user