Implement (broken) push away from walls according to muzzle pos

This commit is contained in:
2026-01-01 11:10:00 +00:00
parent 5b5a12be6e
commit 0a8725f68d
7 changed files with 411 additions and 348 deletions
+25
View File
@@ -1,6 +1,12 @@
--{-# LANGUAGE LambdaCase #-}
module Dodge.Render.ShapePicture (worldSPic) where
import Dodge.DoubleTree
import Dodge.Data.DoubleTree
import Dodge.HeldUse
import NewInt
import Dodge.Item.Grammar
import Dodge.Render.Label
import Dodge.Debug
import Control.Lens
import Data.Foldable
@@ -40,6 +46,7 @@ worldSPic cfig u =
<> foldup (mcSPic (w ^. cWorld)) (filtOn _mcPos _machines)
<> foldMap' drawChasm (w ^. cWorld . chasms)
<> w ^. cWorld . lWorld . tempSPic
<> testSPic cfig u
where
w = u ^. uvWorld
lw = w ^. cWorld . lWorld
@@ -48,6 +55,24 @@ worldSPic cfig u =
filtOn' f g = filter (pointIsClose . f) (g lw)
pointIsClose = cullPoint cfig w
testSPic :: Config -> Universe -> SPic
testSPic cfig u = noShape $ testPic cfig u
testPic :: Config -> Universe -> Picture
testPic _ u = fold $ do
cr <- u ^? uvWorld . cWorld . lWorld . creatures . ix 0
-- return mempty
invid <- cr ^? crManipulation . manObject . imRootSelectedItem . unNInt
loc <- invIndents ((\k -> u ^?! uvWorld . cWorld . lWorld . items . ix k) <$> _crInv cr)
^? ix invid . _2
return . color red $ setLayer DebugLayer $ reduceLocDT (f cr) loc
where
f cr loc = foldMap g $ map (muzzlePos loc cr) (itemMuzzles $ loc ^. locDT . dtValue . _1)
where
g :: Point3Q -> Picture
g pq = translate3 (pq ^. _1) $ crossPic 5
drawBlock :: Block -> SPic
drawBlock = noPic . _blDraw