Cleanup, work towards allowing for placements to interact across rooms
This commit is contained in:
@@ -14,6 +14,7 @@ import System.Random
|
||||
import Data.Maybe
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
--import Data.Bifunctor
|
||||
|
||||
data PSType = PutCrit {_unPutCrit :: Creature}
|
||||
| PutMachine Color [Point2] Machine
|
||||
| PutLS LightSource
|
||||
@@ -32,6 +33,7 @@ data PSType = PutCrit {_unPutCrit :: Creature}
|
||||
| RandPS (State StdGen PSType)
|
||||
| PutForeground Shape
|
||||
| PutWorldUpdate (PlacementSpot -> World -> World)
|
||||
| AddToPList Int PSType
|
||||
| PutNothing
|
||||
| PutID { _putID :: Int}
|
||||
-- maybe there is a monadic implementation of this?
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
module Dodge.Placement.Instance.Tank where
|
||||
import Dodge.Data
|
||||
import Dodge.Placement.PlaceSpot
|
||||
--import Dodge.Placement.PlaceSpot
|
||||
import Dodge.Placement.Shift
|
||||
import Dodge.LevelGen.Data
|
||||
import Dodge.Room.Foreground
|
||||
import Dodge.Default.Wall
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
-- | deals with placement of objects within the world
|
||||
-- after they have had their coordinates set by the layout
|
||||
module Dodge.Placement.PlaceSpot
|
||||
( shiftPlacement
|
||||
, shiftPointBy
|
||||
, invShiftPointBy
|
||||
, placeSpot
|
||||
( placeSpot
|
||||
) where
|
||||
import Dodge.LevelGen.LevelStructure
|
||||
import Dodge.Placement.Shift
|
||||
import Dodge.Data
|
||||
import Dodge.Path
|
||||
import Dodge.Placement.PlaceSpot.Block
|
||||
@@ -73,18 +72,7 @@ placeSpotRoomRand rm i f plmnt w =
|
||||
let (ps,g) = runState (_rmRandPSs rm !! i) $_randGen w
|
||||
in placeSpot (w & randGen .~ g,rm) (plmnt & plSpot .~ f ps)
|
||||
|
||||
shiftPlacement :: (Point2,Float) -> Placement -> Placement
|
||||
shiftPlacement shift plmnt = case plmnt of
|
||||
Placement {} -> plmnt & plSpot %~ shiftPSBy shift
|
||||
& plIDCont %~ fmap (fmap $ shiftPlacement shift)
|
||||
PlacementUsingPos p f -> PlacementUsingPos (shiftPoint3By shift p)
|
||||
(fmap (shiftPlacement shift) f)
|
||||
RandomPlacement rpl -> RandomPlacement $ fmap (shiftPlacement shift) rpl
|
||||
|
||||
shiftPSBy :: (Point2,Float) -> PlacementSpot -> PlacementSpot
|
||||
shiftPSBy (pos,rot) ps = ps
|
||||
& psPos %~ shiftPointBy (pos,rot)
|
||||
& psRot %~ (+ rot)
|
||||
|
||||
-- the Int here is some id that is assigned when the placement is placed
|
||||
placeSpotID :: PlacementSpot -> PSType -> World -> (Int, World)
|
||||
|
||||
@@ -19,6 +19,7 @@ module Dodge.Room.Link
|
||||
, chooseOneInLink
|
||||
, restrictRMInLinksPD
|
||||
) where
|
||||
import Dodge.ShiftPoint
|
||||
import Dodge.Placement.PlaceSpot
|
||||
import Dodge.LevelGen.Data
|
||||
import Dodge.RandomHelp
|
||||
|
||||
@@ -10,6 +10,7 @@ module Dodge.Room.Procedural
|
||||
, makeGrid
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Placement.Shift
|
||||
import Dodge.Default.Wall
|
||||
import Dodge.PlacementSpot
|
||||
import Dodge.Placement.Instance
|
||||
@@ -23,7 +24,6 @@ import Dodge.Item.Equipment
|
||||
import Dodge.Room.Foreground
|
||||
import Dodge.Item.Weapon
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.Placement.PlaceSpot
|
||||
import Dodge.LevelGen.Data
|
||||
import Dodge.LevelGen.Switch
|
||||
import Dodge.Creature
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
module Dodge.Room.RezBox where
|
||||
import Dodge.LevelGen.Data
|
||||
--import Dodge.PlacementSpot
|
||||
import Dodge.Room.RunPast
|
||||
--import Dodge.Room.RunPast
|
||||
import Dodge.RoomLink
|
||||
import Dodge.Room.LasTurret
|
||||
--import Dodge.Room.LasTurret
|
||||
import Dodge.Data
|
||||
import Dodge.Default
|
||||
--import Dodge.RoomLink
|
||||
@@ -11,21 +11,21 @@ import Dodge.Tree
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.Room.Door
|
||||
import Dodge.Room.Corridor
|
||||
import Dodge.Room.Room
|
||||
--import Dodge.Room.Room
|
||||
import Dodge.Room.Link
|
||||
import Dodge.Room.Procedural
|
||||
import Dodge.Room.Foreground
|
||||
--import Dodge.Room.Foreground
|
||||
import Dodge.Room.RoadBlock
|
||||
import Dodge.Placement.Instance
|
||||
import Dodge.Item.Random
|
||||
import Dodge.Item.Weapon.BulletGuns
|
||||
import Dodge.Item.Weapon.Utility
|
||||
--import Dodge.Item.Weapon.BulletGuns
|
||||
--import Dodge.Item.Weapon.Utility
|
||||
--import Dodge.LevelGen.Data
|
||||
--import Geometry.Data
|
||||
import Geometry
|
||||
import Padding
|
||||
import Color
|
||||
import Shape
|
||||
--import Color
|
||||
--import Shape
|
||||
|
||||
import qualified Data.Set as S
|
||||
--import Data.Maybe
|
||||
@@ -69,7 +69,7 @@ rezBoxesWpCrit = do
|
||||
h <- state $ randomR (40,40)
|
||||
thecol <- rezColor
|
||||
theweapon <- randBlockBreakWeapon
|
||||
horedge <- takeOne [OnEdge North,OnEdge South]
|
||||
--horedge <- takeOne [OnEdge North,OnEdge South]
|
||||
let centralRoom = (roomRectAutoLinks w h) {_rmPmnts = []}
|
||||
onwardpassage <- fmap
|
||||
(applyToCompRoot (rmConnectsTo .~ S.singleton (OnEdge West))) $ maybeBlockedPassage
|
||||
@@ -78,7 +78,6 @@ rezBoxesWpCrit = do
|
||||
let n = length $ filter bottomEdgeTest $ map lnkPosDir $ _rmLinks centralRoom
|
||||
i <- state $ randomR (0,n-3)
|
||||
j <- state $ randomR (i,n-2)
|
||||
blcor <- blockedCorridorCloseBlocks
|
||||
let rezrooms = map adddoor
|
||||
$ insertAt i (wpAdd theweapon aroom)
|
||||
$ insertAt j (crAdd aroom)
|
||||
|
||||
@@ -2,10 +2,10 @@ module Dodge.Room.Start where
|
||||
import Dodge.LevelGen.Data
|
||||
--import Dodge.PlacementSpot
|
||||
import Dodge.Room.RunPast
|
||||
import Dodge.RoomLink
|
||||
--import Dodge.RoomLink
|
||||
import Dodge.Room.LasTurret
|
||||
import Dodge.Data
|
||||
import Dodge.Default
|
||||
--import Dodge.Data
|
||||
--import Dodge.Default
|
||||
--import Dodge.RoomLink
|
||||
import Dodge.Tree
|
||||
import Dodge.RandomHelp
|
||||
@@ -16,20 +16,20 @@ import Dodge.Room.Room
|
||||
import Dodge.Room.Link
|
||||
import Dodge.Room.Procedural
|
||||
import Dodge.Room.Foreground
|
||||
import Dodge.Room.RoadBlock
|
||||
--import Dodge.Room.RoadBlock
|
||||
import Dodge.Placement.Instance
|
||||
import Dodge.Item.Random
|
||||
--import Dodge.Item.Random
|
||||
import Dodge.Item.Weapon.BulletGuns
|
||||
import Dodge.Item.Weapon.Utility
|
||||
--import Dodge.LevelGen.Data
|
||||
--import Geometry.Data
|
||||
import Geometry
|
||||
import Padding
|
||||
--import Padding
|
||||
import Color
|
||||
import Shape
|
||||
|
||||
--import Data.Maybe
|
||||
import Data.Tree
|
||||
--import Data.Tree
|
||||
import Control.Monad.State
|
||||
import Control.Lens
|
||||
import System.Random
|
||||
@@ -65,7 +65,8 @@ room2 :: RandomGen g => Int -> State g (SubCompTree Room)
|
||||
room2 = lasCenSensEdge
|
||||
|
||||
startRoom :: RandomGen g => Int -> State g (SubCompTree Room)
|
||||
startRoom i = join $ takeOne
|
||||
--startRoom i = join $ takeOne
|
||||
startRoom _ = join $ takeOne
|
||||
[-- roomMiniIntro
|
||||
--minigunfakeout
|
||||
-- rezBoxesWp
|
||||
|
||||
Reference in New Issue
Block a user