Make many death events just leave corpses (no gore)

This commit is contained in:
2022-06-04 17:55:24 +01:00
parent 582881ca66
commit 62ccf8fad3
5 changed files with 84 additions and 8 deletions
+21
View File
@@ -82,6 +82,7 @@ addCrGibs cr w = case damageDirection $ _crDamage $ _crState cr of
Just d -> w
& addGibsAtDir d 3 7 (_skinLower skin) cpos
& addGibsAtDir d 13 20 (_skinUpper skin) cpos
& addGibAtDir d 25 (_skinHead skin) cpos
where
skin = _crSkin cr
cpos = _crPos cr
@@ -147,3 +148,23 @@ addGibAt h col p w = w
& pjQuat .~ q
& pjVelZ .~ zs
& pjPosZ .~ h
addGibAtDir :: Float -> Float -> Color -> Point2 -> World -> World
addGibAtDir dir h col p w = w
& plNew props pjID gib
& randGen .~ newg
where
(gib,newg) = runState f $ _randGen w
f = do
s <- state $ randomR (1,4)
zs <- state $ randomR (-8,8)
q <- Q.vToQuat (V3 0 0 1) <$> randOnUnitSphere
let v = s *.* unitVectorAtAngle dir
return $ aGib
& pjPos .~ p
& pjColor .~ col
& pjVel .~ v
& pjQuatSpin .~ Q.axisAngle (vNormal v `v2z` 0) (-0.1)
& pjQuat .~ q
& pjVelZ .~ zs
& pjPosZ .~ h