Refactor crPos to be a V3

This commit is contained in:
2025-10-10 13:47:31 +01:00
parent 98ece551c7
commit 49fb982877
58 changed files with 375 additions and 307 deletions
+19 -12
View File
@@ -1,6 +1,4 @@
module Dodge.Euse (
equipBackgroundEffect,
) where
module Dodge.Euse (equipBackgroundEffect) where
import Dodge.Creature.HandPos
import Dodge.Creature.Test
@@ -11,14 +9,19 @@ import Dodge.Data.World
import Dodge.Wall.Move
import Geometry
import LensHelp
import Linear
equipBackgroundEffect :: LocationDT OItem -> Creature -> EquipSite
-> World -> World
equipBackgroundEffect ::
LocationDT OItem ->
Creature ->
EquipSite ->
World ->
World
equipBackgroundEffect loc cr = case eo of
EQUIP (MAGSHIELD mt) -> const $ useMagShield mt itm cr
EQUIP WRISTARMOUR -> setWristShieldPos itm cr
EQUIP HEADLAMP -> const $ createHeadLamp itm cr
_ -> const id
_ -> const id
where
itm = loc ^. locDT . dtValue . _1
eo = itm ^. itType
@@ -28,7 +31,7 @@ useMagShield :: MagnetBuBu -> Item -> Creature -> World -> World
useMagShield mt _ cr w =
w & cWorld . lWorld . magnets
.:~ Magnet
{ _mgPos = _crPos cr
{ _mgPos = cr ^. crPos . _xy
, _mgField = mt
}
@@ -43,7 +46,7 @@ setWristShieldPos itm cr x = moveWallIDUnsafe i wlline
g
| twists cr = (+.+.+ V3 (-5) 10 0)
| otherwise = id
f = (+.+ _crPos cr) . stripZ . rotate3 (_crDir cr) . handtrans cr
f = (+.+ cr ^. crPos . _xy) . stripZ . rotate3 (_crDir cr) . handtrans cr
-- TODO the reflection should be controled by the particle
--shieldWallDamage :: Damage -> Wall -> Int -> World -> World
@@ -53,10 +56,14 @@ setWristShieldPos itm cr x = moveWallIDUnsafe i wlline
-- _ -> w
createHeadLamp :: Item -> Creature -> World -> World
createHeadLamp _ cr w = w &
cWorld . lWorld . lights
createHeadLamp _ cr w =
w
& cWorld . lWorld . lights
.:~ LSParam
((_crPos cr `v2z` 0) +.+.+ rotate3 (_crDir cr)
(translateToES cr OnHead (V3 5 0 3)))
( _crPos cr
+.+.+ rotate3
(_crDir cr)
(translateToES cr OnHead (V3 5 0 3))
)
200
0.7