This commit is contained in:
2025-08-02 22:53:39 +01:00
parent ae24720762
commit 5f158cc87a
3 changed files with 29 additions and 78 deletions
+15 -73
View File
@@ -1,6 +1,6 @@
module Dodge.Block.Debris (
cubeShape,
dirtColor,
-- dirtColor,
makeDoorDebris,
makeBlockDebris,
makeDebris,
@@ -85,78 +85,20 @@ debrisSize mt = case mt of
Electronics -> 10
Flesh -> 10
baseDebris :: Material -> State StdGen Prop
baseDebris mt = case mt of
Stone -> return stoneDebris
Glass -> return glassDebris
Crystal -> return crystalDebris
Dirt -> return dirtDebris
Wood -> return stoneDebris
Metal -> do
sh <- jaggedShape
return $
metalDebris
& prDraw .~ PropDrawMovingShapeCol sh
Electronics -> baseDebris Metal
Flesh -> baseDebris Dirt <&> prColor .~ red
stoneDebris :: Prop
stoneDebris =
PropZ
{ _prPos = 0
, _prStartPos = 0
, _prVel = 0
, _prDraw = PropDrawMovingShapeCol (cubeShape 4)
, _prID = 0
, _prUpdate = PropFallSmallBounceDamage
, _prPosZ = 10
, _prVelZ = 5
, _prQuat = Q.axisAngle (V3 1 0 0) 0
, _prQuatSpin = Q.axisAngle (V3 1 1 0) 0.1
, _prColor = greyN 0.5
}
dirtDebris :: Prop
dirtDebris =
stoneDebris
& prColor .~ dirtColor
& prUpdate .~ PropFallSmallBounce
dirtColor :: Color
dirtColor = V4 (150 / 256) (75 / 256) 0 (250 / 256)
metalDebris :: Prop
metalDebris =
stoneDebris
& prDraw .~ PropDrawMovingShapeCol (shardShape 4)
& prUpdate .~ PropFallSmallBounceDamage
glassDebris :: Prop
glassDebris =
stoneDebris
& prDraw .~ PropDrawMovingShapeCol (shardShape 4)
& prUpdate .~ PropFallSmallBounce
& prColor .~ withAlpha 0.5 cyan
crystalDebris :: Prop
crystalDebris =
glassDebris
& prColor .~ withAlpha 0.5 aquamarine
shardShape :: Float -> Shape
shardShape size =
translateSHz (- size) $
upperPrismPolySU
size
[ V2 size 0
, V2 (- size) 1
, V2 (- size) (-1)
]
jaggedShape :: State StdGen Shape
jaggedShape = do
s <- randomR (4, 10) & state
return $ shardShape s
--shardShape :: Float -> Shape
--shardShape size =
-- translateSHz (- size) $
-- upperPrismPolySU
-- size
-- [ V2 size 0
-- , V2 (- size) 1
-- , V2 (- size) (-1)
-- ]
--
--jaggedShape :: State StdGen Shape
--jaggedShape = do
-- s <- randomR (4, 10) & state
-- return $ shardShape s
cubeShape :: Float -> Shape
cubeShape size = translateSHz (- size) $ upperPrismPolySU (2 * size) $ square size