Start to add mountable objects
This commit is contained in:
@@ -61,12 +61,21 @@ destroyDoor dr w = w
|
||||
& doors %~ IM.delete (_drID dr)
|
||||
& flip (foldr (wlDustAt awl)) (map (pos +.+) ps)
|
||||
& stopPushing (_drPushes dr)
|
||||
& destroyMounts (_drMounts dr)
|
||||
where
|
||||
wlids = _drWallIDs dr
|
||||
awl = _walls w IM.! IS.findMin wlids
|
||||
pos = fst . _wlLine $ _walls w IM.! IS.findMin wlids
|
||||
ps = replicateM 25 (randInCirc 20) & evalState $ _randGen w
|
||||
|
||||
destroyMounts :: [MountedObject] -> World -> World
|
||||
destroyMounts mos w = foldr destroyMount w mos
|
||||
|
||||
destroyMount :: MountedObject -> World -> World
|
||||
destroyMount mo = case mo of
|
||||
MountedLS lsid -> lightSources . at lsid .~ Nothing
|
||||
MountedProp prid -> props . at prid .~ Nothing
|
||||
|
||||
stopPushing :: Maybe Int -> World -> World
|
||||
stopPushing mdrid w = fromMaybe w $ do
|
||||
drid <- mdrid
|
||||
|
||||
Reference in New Issue
Block a user