Refactor floor items, removing ids (not fully checked)
This commit is contained in:
@@ -2,9 +2,7 @@
|
||||
{- | deals with placement of objects within the world
|
||||
after they have had their coordinates set by the layout
|
||||
-}
|
||||
module Dodge.Placement.PlaceSpot (
|
||||
placeSpot,
|
||||
) where
|
||||
module Dodge.Placement.PlaceSpot (placeSpot) where
|
||||
|
||||
import Color
|
||||
import LensHelp
|
||||
@@ -22,7 +20,6 @@ import Dodge.Placement.Shift
|
||||
import Dodge.ShiftPoint
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
import NewInt
|
||||
import System.Random
|
||||
|
||||
-- when placing a placement, we update the world and the room and assign an id
|
||||
@@ -111,12 +108,15 @@ placeSpotID' ps pt w = case pt of
|
||||
PutProp prp -> plNewUpID (cWorld . lWorld . props) prID (mvProp p rot prp) w
|
||||
PutButton bt -> plNewUpID (cWorld . lWorld . buttons) btID (mvButton p rot bt) w
|
||||
PutTerminal tm -> plNewUpID (cWorld . lWorld . terminals) tmID tm w
|
||||
PutFlIt itm ->
|
||||
plNewUpID
|
||||
(cWorld . lWorld . floorItems . unNIntMap)
|
||||
(flItID . unNInt)
|
||||
(createFlIt p rot itm)
|
||||
w
|
||||
PutFlIt itm -> let i = IM.newKey (w ^. cWorld . lWorld . itemLocations)
|
||||
in (i, w & cWorld . lWorld . itemLocations . at i ?~ OnFloor
|
||||
& cWorld . lWorld . floorItems . at i ?~ createFlIt p rot itm
|
||||
)
|
||||
-- plNewUpID
|
||||
-- (cWorld . lWorld . floorItems . unNIntMap)
|
||||
-- (flItID . unNInt)
|
||||
-- (createFlIt p rot itm)
|
||||
-- w
|
||||
PutCrit cr -> plNewUpID (cWorld . lWorld . creatures) crID (mvCr p rot cr) w
|
||||
PutForeground fs -> plNewUpID (cWorld . lWorld . foregroundShapes) fsID (mvFS p rot fs) w
|
||||
PutMachine pps mc wl -> plMachine (map doShift pps) mc wl p rot w
|
||||
@@ -180,7 +180,7 @@ mvButton p a = (btRot +~ a) . (btPos %~ ((p +.+) . rotateV a))
|
||||
|
||||
{- Creates a floor item at a given point.-}
|
||||
createFlIt :: Point2 -> Float -> Item -> FloorItem
|
||||
createFlIt p rot itm = FlIt{_flItPos = p, _flItRot = rot, _flItID = 0, _flIt = itm}
|
||||
createFlIt p rot itm = FlIt{_flItPos = p, _flItRot = rot, _flIt = itm}
|
||||
|
||||
mvPP :: Point2 -> Float -> PressPlate -> PressPlate
|
||||
mvPP p rot pp = pp{_ppPos = p, _ppRot = rot}
|
||||
|
||||
Reference in New Issue
Block a user