Make autodoor placements use "ordinary" coordinate placements
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -129,7 +129,6 @@ data LWorld = LWorld
|
|||||||
, _oldMagnets :: [Magnet]
|
, _oldMagnets :: [Magnet]
|
||||||
, _magnets :: [Magnet]
|
, _magnets :: [Magnet]
|
||||||
, _blocks :: IM.IntMap Block
|
, _blocks :: IM.IntMap Block
|
||||||
, _coordinates :: IM.IntMap Point2
|
|
||||||
, _triggers :: IM.IntMap Bool
|
, _triggers :: IM.IntMap Bool
|
||||||
, _floorItems :: IM.IntMap FloorItem
|
, _floorItems :: IM.IntMap FloorItem
|
||||||
, _modifications :: IM.IntMap Modification
|
, _modifications :: IM.IntMap Modification
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ module Dodge.Data.World (
|
|||||||
module Dodge.Data.Input,
|
module Dodge.Data.Input,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import qualified Data.IntMap.Strict as IM
|
||||||
import NewInt
|
import NewInt
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Data.IntMap.Strict (IntMap)
|
import Data.IntMap.Strict (IntMap)
|
||||||
@@ -53,6 +54,7 @@ data World = World
|
|||||||
, _gsZoning :: IntMap (IntMap IntSet)
|
, _gsZoning :: IntMap (IntMap IntSet)
|
||||||
, _wCam :: Camera
|
, _wCam :: Camera
|
||||||
, _unpauseClock :: Int
|
, _unpauseClock :: Int
|
||||||
|
, _coordinates :: IM.IntMap Point2 -- temporary coordinates for world generation/placement
|
||||||
}
|
}
|
||||||
|
|
||||||
data TimeFlowStatus
|
data TimeFlowStatus
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ defaultWorld =
|
|||||||
, _peZoning = mempty
|
, _peZoning = mempty
|
||||||
, _gsZoning = mempty --Zoning IM.empty clZoneSize (zonePos _guPos)
|
, _gsZoning = mempty --Zoning IM.empty clZoneSize (zonePos _guPos)
|
||||||
, _unpauseClock = 0
|
, _unpauseClock = 0
|
||||||
|
, _coordinates = mempty
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultCWGen :: CWGen
|
defaultCWGen :: CWGen
|
||||||
@@ -128,7 +129,6 @@ defaultLWorld =
|
|||||||
, _machines = IM.empty
|
, _machines = IM.empty
|
||||||
, _terminals = IM.empty
|
, _terminals = IM.empty
|
||||||
, _doors = IM.empty
|
, _doors = IM.empty
|
||||||
, _coordinates = IM.empty
|
|
||||||
, _triggers = IM.empty
|
, _triggers = IM.empty
|
||||||
, _floorItems = mempty
|
, _floorItems = mempty
|
||||||
, _worldEvents = []
|
, _worldEvents = []
|
||||||
|
|||||||
@@ -76,18 +76,30 @@ divideDoorPane mid wl cond soff speed ppairs g = case ppairs of
|
|||||||
& drPushedBy .~ maybe PushesItself PushedBy mid
|
& drPushedBy .~ maybe PushesItself PushedBy mid
|
||||||
|
|
||||||
putAutoDoor :: Point2 -> Point2 -> Placement
|
putAutoDoor :: Point2 -> Point2 -> Placement
|
||||||
putAutoDoor a b = PlacementUsingPos (addZ 0 a) $
|
putAutoDoor a b = Placement 0 (PS 0 0) (PutCoord a) Nothing $ \_ apl ->
|
||||||
\az -> PlacementUsingPos (addZ 0 b) $
|
Just $ Placement 0 (PS 0 0) (PutCoord b) Nothing $ \w bpl ->
|
||||||
\bz ->
|
let x = w ^?! coordinates . ix (apl ^?! plMID . _Just)
|
||||||
putDoubleDoor
|
y = w ^?! coordinates . ix (bpl ^?! plMID . _Just)
|
||||||
|
in Just $ putDoubleDoor
|
||||||
AutoDoorObstacle
|
AutoDoorObstacle
|
||||||
defaultAutoWall
|
defaultAutoWall
|
||||||
(cond az bz)
|
(WdBlCrFilterNearPoint 40 (0.5 *.* (x + y)) CrIsAnimate)
|
||||||
a
|
a
|
||||||
b
|
b
|
||||||
3
|
3
|
||||||
where
|
--putAutoDoor :: Point2 -> Point2 -> Placement
|
||||||
cond az bz = WdBlCrFilterNearPoint 40 (0.5 *.* (stripZ az +.+ stripZ bz)) CrIsAnimate
|
--putAutoDoor a b = PlacementUsingPos (addZ 0 a) $
|
||||||
|
-- \az -> PlacementUsingPos (addZ 0 b) $
|
||||||
|
-- \bz ->
|
||||||
|
-- putDoubleDoor
|
||||||
|
-- AutoDoorObstacle
|
||||||
|
-- defaultAutoWall
|
||||||
|
-- (cond az bz)
|
||||||
|
-- a
|
||||||
|
-- b
|
||||||
|
-- 3
|
||||||
|
-- where
|
||||||
|
-- cond az bz = WdBlCrFilterNearPoint 40 (0.5 *.* (stripZ az +.+ stripZ bz)) CrIsAnimate
|
||||||
|
|
||||||
switchDoor :: Point2 -> Float -> Point2 -> Point2 -> Color -> Placement
|
switchDoor :: Point2 -> Float -> Point2 -> Point2 -> Color -> Placement
|
||||||
switchDoor btpos btrot dra drb col = pContID
|
switchDoor btpos btrot dra drb col = pContID
|
||||||
|
|||||||
@@ -121,11 +121,6 @@ placeSpotID' ps pt w = case pt of
|
|||||||
& itLocation .~ OnFloor
|
& itLocation .~ OnFloor
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
-- plNewUpID
|
|
||||||
-- (cWorld . lWorld . floorItems . unNIntMap)
|
|
||||||
-- (flItID . unNInt)
|
|
||||||
-- (createFlIt p rot itm)
|
|
||||||
-- w
|
|
||||||
PutCrit cr -> plNewUpID (cWorld . lWorld . creatures) crID (mvCr p rot cr) 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
|
PutForeground fs -> plNewUpID (cWorld . lWorld . foregroundShapes) fsID (mvFS p rot fs) w
|
||||||
PutMachine pps mc wl mitm -> plMachine (map doShift pps) mc wl mitm p rot w
|
PutMachine pps mc wl mitm -> plMachine (map doShift pps) mc wl mitm p rot w
|
||||||
@@ -133,7 +128,7 @@ placeSpotID' ps pt w = case pt of
|
|||||||
PutPPlate pp -> plNewUpID (cWorld . lWorld . pressPlates) ppID (mvPP p rot pp) w
|
PutPPlate pp -> plNewUpID (cWorld . lWorld . pressPlates) ppID (mvPP p rot pp) w
|
||||||
RandPS rgn -> evaluateRandPS rgn ps w
|
RandPS rgn -> evaluateRandPS rgn ps w
|
||||||
PutDoor col eo f pss -> plDoor col eo f (map (bimap doShift doShift) pss) w
|
PutDoor col eo f pss -> plDoor col eo f (map (bimap doShift doShift) pss) w
|
||||||
PutCoord cp -> plNewID (cWorld . lWorld . coordinates) (doShift cp) w
|
PutCoord cp -> plNewID coordinates (doShift cp) w
|
||||||
PutSlideDr wl dr eo off a b ->
|
PutSlideDr wl dr eo off a b ->
|
||||||
plSlideDoor wl dr eo off (doShift a) (doShift b) w
|
plSlideDoor wl dr eo off (doShift a) (doShift b) w
|
||||||
PutBlock bl wl ps' ->
|
PutBlock bl wl ps' ->
|
||||||
|
|||||||
Reference in New Issue
Block a user