Commit before trying to add machine footprint

This commit is contained in:
2026-03-31 13:57:48 +01:00
parent 6bcf03b30d
commit dea4c0dffe
10 changed files with 44 additions and 44 deletions
+16 -1
View File
@@ -14,11 +14,26 @@ destroyMachine :: Machine -> World -> World
destroyMachine mc =
(cWorld . lWorld . machines %~ IM.delete (_mcID mc))
. deleteWallIDs (_mcWallIDs mc)
. makeExplosionAt (_mcPos mc `v2z` 20) 0
. makeMachineDebris mc
. makeSmallExplosionAt (_mcPos mc `v2z` 20) 0
. mcKillTerm mc
. mcKillBut mc
. destroyMcType (mc ^. mcType) mc
--explodeMachine :: Machine -> MachineType -> World -> World
--explodeMachine mc = \case
makeMachineDebris :: Machine -> World -> World
makeMachineDebris mc = id -- foldl' (flip $ makeDebris mt) w ps
-- where
-- dsize = debrisSize mt
-- ps = gridInPolygon dsize $ shrinkPolyOnEdges dsize $ reverse (_mcFootprint bl)
-- mt = fromMaybe Stone $ do
-- wlids <- w ^? cWorld . lWorld . blocks . ix (_blID bl) . blWallIDs
-- (wlid, _) <- IS.minView wlids
-- wl <- w ^? cWorld . lWorld . walls . ix wlid
-- return $ _wlMaterial wl
destroyMcType :: MachineType -> Machine -> World -> World
destroyMcType mt mc w = case mt of
McTurret tu _ -> fromMaybe w $ do
-2
View File
@@ -16,7 +16,6 @@ import ShapePicture
drawMachine :: CWorld -> Machine -> SPic
drawMachine cw mc = case _mcType mc of
McStatic -> mempty
McTerminal -> terminalSPic lw mc
McTurret tu _ -> drawBaseMachine 20 mc <> drawTurret lw tu mc
McDamSensor se -> drawBaseMachine 25 mc <> drawDamSensor gp se
@@ -82,7 +81,6 @@ drawBaseMachine h mc =
mcColor :: Machine -> Color
mcColor mc = case mc ^. mcType of
McStatic -> blue
McTerminal -> dark magenta
McDamSensor{} -> yellow
McProxSensor{} -> aquamarine
-2
View File
@@ -31,7 +31,6 @@ updateMachine mc = mcPlaySound mc . mcTypeUpdate mc (_mcType mc)
mcTypeUpdate :: Machine -> MachineType -> World -> World
mcTypeUpdate mc = \case
McStatic -> id
McTerminal -> terminalScreenGlow mc
McTurret tu _ -> updateTurret (_tuTurnSpeed tu) mc
McDamSensor se -> mcDamSensorTriggerUpdate se mc . mcDamSensorUpdate se mc
@@ -152,7 +151,6 @@ mcPlaySound mc w = fromMaybe w $ do
mcBackgroundSound :: Machine -> Maybe (SoundID,Float)
mcBackgroundSound mc = case mc ^. mcType of
McStatic -> Nothing
McTerminal -> Just (fridgeHumS,1)
McTurret{} -> Just (fridgeHumS,1)
McDamSensor{} -> Just (fridgeHumS,1)