Fix explosion damage

This commit is contained in:
2022-07-11 20:26:19 +01:00
parent 1506f5a83e
commit 791d065eff
10 changed files with 87 additions and 74 deletions
+8 -3
View File
@@ -17,6 +17,7 @@ import Dodge.Base.NewID
import Geometry
import qualified IntMapHelp as IM
import Color
import Picture
import Data.Foldable
import Data.Maybe
@@ -91,7 +92,8 @@ placeSpotID ps pt w = case pt of
PutTerminal tm -> plNewUpID terminals tmID tm w
PutFlIt itm -> plNewUpID floorItems flItID (createFlIt p rot itm) w
PutCrit cr -> plNewUpID creatures crID (mvCr p rot cr) w
PutForeground fs -> plNewUpID shapes fsID (mvFS p rot fs) w
PutForeground fs -> plNewUpID foregroundShapes fsID (mvFS p rot fs) w
PutDecoration pic -> plNewID decorations (shiftDec p rot pic) w
PutMachine pps mc -> plMachine (map doShift pps) mc p rot w
PutLS ls -> plNewUpID lightSources lsID (mvLS p' rot ls) w
PutPPlate pp -> plNewUpID pressPlates ppID (mvPP p rot pp) w
@@ -115,6 +117,9 @@ placeSpotID ps pt w = case pt of
rot = _psRot ps
doShift = shiftPointBy (p,rot)
shiftDec :: Point2 -> Float -> Picture -> Picture
shiftDec p r pic = uncurryV translate p $ rotate r pic
evaluateRandPS :: State StdGen PSType -> PlacementSpot -> World -> (Int,World)
evaluateRandPS rgen ps w = placeSpotID ps evaluatedType (set randGen g w)
where
@@ -167,10 +172,10 @@ mvFS p a = (fsDir +~ a) . (fsPos %~ ( (p +.+) . rotateV a ))
plMachine :: [Point2] -> Machine -> Point2 -> Float -> World -> (Int,World)
plMachine wallpoly mc p rot gw = (mcid
, gw & machines %~ addMc
& walls %~ placeMachineWalls color wallpoly mcid wlid
& walls %~ placeMachineWalls col wallpoly mcid wlid
)
where
color = _mcColor mc
col = _mcColor mc
w' = gw
mcid = IM.newKey $ _machines w'
wlid = IM.newKey $ _walls w'