Cleanup, remove inventory display update code on dropping item

This commit is contained in:
2024-10-06 22:32:10 +01:00
parent 650854d13e
commit 507c8e9819
7 changed files with 64 additions and 77 deletions
+40 -38
View File
@@ -1,12 +1,14 @@
module Dodge.Luse
( useL
)
where
import Dodge.Base
--import Dodge.Base
import Dodge.Creature.Action
import Dodge.Data.World
import Dodge.Item.Weapon.TriggerType
import Geometry
import qualified IntMapHelp as IM
--import Geometry
--import qualified IntMapHelp as IM
import LensHelp
useL :: Luse -> Item -> Creature -> World -> World
@@ -82,40 +84,40 @@ boostSelfL = undefined
-- . (itAttachment .~ AttachInt pid)
-- )
-- | Move a creature towards the mouse position, with shockwave
boostPoint ::
-- | boost amount
Float ->
Creature ->
World ->
Either Point2 Point2
boostPoint x cr w = case mayp2 of
Nothing -> Right p1
Just p2 -> Left $ mvPointTowardAtSpeed r cpos $ fst p2
where
cpos = _crPos cr
r = 1.5 * _crRad cr
p1 = cpos +.+ x *.* squashNormalizeV (mouseWorldPos (w ^. input) (w ^. wCam) -.- cpos)
mayp2 = bouncePoint (const True) 1 cpos p1 w
---- | Move a creature towards the mouse position, with shockwave
--boostPoint ::
-- -- | boost amount
-- Float ->
-- Creature ->
-- World ->
-- Either Point2 Point2
--boostPoint x cr w = case mayp2 of
-- Nothing -> Right p1
-- Just p2 -> Left $ mvPointTowardAtSpeed r cpos $ fst p2
-- where
-- cpos = _crPos cr
-- r = 1.5 * _crRad cr
-- p1 = cpos +.+ x *.* squashNormalizeV (mouseWorldPos (w ^. input) (w ^. wCam) -.- cpos)
-- mayp2 = bouncePoint (const True) 1 cpos p1 w
addBoostShockwave ::
Int ->
Point2 ->
Point2 ->
World ->
World
addBoostShockwave pjid p v w =
w & cWorld . lWorld . linearShockwaves
%~ IM.insertWith f pjid thePJ
where
thePJ =
LinearShockwave
{ _lwPos = p
, _lwID = pjid
, _lwPoints = [(p, v)]
, _lwTimer = maxT
}
f newVal oldVal = newVal & lwPoints %~ (++ _lwPoints oldVal)
--addBoostShockwave ::
-- Int ->
-- Point2 ->
-- Point2 ->
-- World ->
-- World
--addBoostShockwave pjid p v w =
-- w & cWorld . lWorld . linearShockwaves
-- %~ IM.insertWith f pjid thePJ
-- where
-- thePJ =
-- LinearShockwave
-- { _lwPos = p
-- , _lwID = pjid
-- , _lwPoints = [(p, v)]
-- , _lwTimer = maxT
-- }
-- f newVal oldVal = newVal & lwPoints %~ (++ _lwPoints oldVal)
maxT :: Int
maxT = 20
--maxT :: Int
--maxT = 20