Add possible cosmetic pipes to tanks

This commit is contained in:
2022-06-19 10:17:03 +01:00
parent bae0f7dcad
commit 55d2fcc8d0
13 changed files with 70 additions and 16 deletions
+2 -1
View File
@@ -119,7 +119,8 @@ lnkBothAnd rlt ltcon ltcon2 i (j,(p,a)) = RoomLink
roomRectAutoLinks :: Float -> Float -> Room
roomRectAutoLinks x y = roomRect x y (f x) (f y)
& rmName .~ "autoRect"
& rmPmnts .~ [mntLightLnkCond $ resetPLUse $ rprBool $ \rp _ -> isInLnk rp]
& rmPmnts .~ [mntLightLnkCond $ resetPLUse $ rprBool $ \rp _ -> isInLnk rp
,mntLightLnkCond $ resetPLUse $ rprBool $ \rp _ -> isOutLnk rp]
where
f z = max 1 $ (ceiling z - 40) `div` 60
{- Combines two rooms into one room.
+22 -5
View File
@@ -1,5 +1,6 @@
module Dodge.Room.Tanks where
import Dodge.Data
import Dodge.Placement.Instance.Pipe
import Dodge.LevelGen.Data
import RandomHelp
import Dodge.Room.Procedural
@@ -9,11 +10,13 @@ import Dodge.Room.Modify.Girder
import Dodge.Placement.Instance
import Dodge.Placement.TopDecoration
import Dodge.PlacementSpot
import Dodge.Base.CardinalPoint
--import Padding
import Color
--import Shape
import Shape
import ShapePicture
import LensHelp
--import Geometry
import Geometry
--import Data.Maybe
--import Data.Tree
@@ -29,11 +32,25 @@ randomTank = takeOne $ map (\f -> f (dim orange) orange)
, tankSquareDec plusDecoration
]
randEdgeTank :: RandomGen g => State g Placement
randEdgeTank = do
edge <- takeOne cardList
basetank <- randomTank
return $ basetank
& plType . putBlock . blDraw
%~ fmap (<> noPic ( colorSH orange (verticalPipe 80
<> horPipe 80 0 (70 *.* cardVec edge))))
-- 70 is a guess, the true value depends on the distance to the wall
& plSpot .~ rprBool (\rp _ -> _rpPlacementUse rp == 0
&& rpOffPathEdge (PathFromEdge edge 0) rp)
tanksPipesRoom :: RandomGen g => State g Room
tanksPipesRoom = do
thetank <- randomTank
let rm = roomRectAutoLinks 200 400 & rmPmnts .:~ thetank
return rm
w <- state $ randomR (200,400)
h <- state $ randomR (200,400)
i <- state $ randomR (1,5)
tanks <- replicateM i randEdgeTank
return $ roomRectAutoLinks w h & rmPmnts .++~ tanks
tanksRoom :: RandomGen g => [Creature] -> [Item] -> State g Room
tanksRoom crs its = do