Separate out concrete part of world

This commit is contained in:
2022-07-25 12:10:50 +01:00
parent 3354d108be
commit b2efbd2b3e
134 changed files with 933 additions and 930 deletions
+3 -3
View File
@@ -9,7 +9,7 @@ import Data.Maybe
import qualified IntMapHelp as IM
destroyMachine :: Machine -> World -> World
destroyMachine mc = (machines %~ IM.delete (_mcID mc))
destroyMachine mc = (cWorld . machines %~ IM.delete (_mcID mc))
. deleteWallIDs (_mcWallIDs mc)
. makeExplosionAt (_mcPos mc)
. mcKillTerm mc
@@ -18,11 +18,11 @@ destroyMachine mc = (machines %~ IM.delete (_mcID mc))
mcKillTerm :: Machine -> World -> World
mcKillTerm mc w = fromMaybe w $ do
tmid <- mc ^? mcMounts . ix ObTerminal
tm <- w ^? terminals . ix tmid
tm <- w ^? cWorld . terminals . ix tmid
return $ w
& doTmWdWd (_tmDeathEffect tm) tm
mcKillBut :: Machine -> World -> World
mcKillBut mc w = fromMaybe w $ do
btid <- mc ^? mcMounts . ix ObButton
return $ w & buttons . at btid .~ Nothing
return $ w & cWorld . buttons . at btid .~ Nothing