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
+3 -3
View File
@@ -87,8 +87,8 @@ updateInGameCamera cfig w =
moveZoomCamera :: Config -> Input -> Creature -> World -> Camera -> Camera
moveZoomCamera cfig theinput cr w campos =
campos
& camCenter .~ fromMaybe (_crPos cr +.+ offset) mremotepos
& camViewFrom .~ fromMaybe (_crPos cr) mremotepos
& camCenter .~ fromMaybe (cr ^. crPos . _xy +.+ offset) mremotepos
& camViewFrom .~ fromMaybe (cr ^. crPos . _xy) mremotepos
& camZoom .~ newzoom
& camDefaultZoom .~ newDefaultZoom
& camItemZoom .~ newItemZoom
@@ -215,7 +215,7 @@ rotateToOverlappingWall w =
w
where
cr = you w
p = _crPos (you w)
p = (you w) ^. crPos . _xy
doWallRotate :: Wall -> World -> World
doWallRotate wl w
+2 -1
View File
@@ -6,11 +6,12 @@ import Dodge.Data.World
import Dodge.Zoning.Creature
import Geometry.Vector3D
import LensHelp
import Linear
cloudPoisonDamage :: Cloud -> World -> World
cloudPoisonDamage c w = foldl' (flip doDam) w (filter f $ crsNearPoint clpos w)
where
doDam cr =
cWorld . lWorld . creatures . ix (_crID cr) . crDamage .:~ Poison 1
f cr = dist3 (addZ 20 $ _crPos cr) (_clPos c) < crRad (cr ^. crType) + 20
f cr = dist3 (_crPos cr & _z +~ 20) (_clPos c) < crRad (cr ^. crType) + 20
clpos = stripZ $ _clPos c
+2 -2
View File
@@ -383,7 +383,7 @@ updateKeysInTerminal :: Int -> Universe -> Universe
updateKeysInTerminal tmid u = fromMaybe deactivate $ do
tm <- u ^? uvWorld . cWorld . lWorld . terminals . ix tmid
x <- u ^? uvWorld . cWorld . lWorld . buttons . ix (tm ^. tmButtonID) . btPos
y <- u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crPos
y <- u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crPos . _xy
case tm ^. tmStatus of
_ | dist x y > 40 || not (hasButtonLOS x y (u ^. uvWorld)) -> Nothing
TerminalDeactivated -> Nothing
@@ -553,7 +553,7 @@ tryCombine (i, j) w = fromMaybe w $ do
. ix j
. siPayload
. _Just
p <- w ^? cWorld . lWorld . creatures . ix 0 . crPos
p <- w ^? cWorld . lWorld . creatures . ix 0 . crPos . _xy
return $
createItemYou it (foldr (destroyInvItem 0 . NInt) w (sort is))
& soundStart InventorySound p wrench1S Nothing