Hlinting
This commit is contained in:
@@ -19,7 +19,7 @@ import Dodge.Creature
|
||||
import Dodge.Default
|
||||
import Geometry
|
||||
|
||||
import Data.List (nub,nubBy,sortBy)
|
||||
import Data.List (nub,nubBy,sortBy,minimumBy)
|
||||
import Data.Function (on)
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
@@ -39,7 +39,7 @@ roomRect x y xn yn = Room
|
||||
{ _rmPolys = [rectNSWE y 0 0 x ]
|
||||
, _rmLinks = lnks
|
||||
, _rmPath = concatMap doublePair pth
|
||||
, _rmPS = [PS (x/2,y/2) 0 $ putLamp]
|
||||
, _rmPS = [PS (x/2,y/2) 0 putLamp]
|
||||
, _rmBound = rectNSWE (y+5) (-5) (-5) (x+5)
|
||||
}
|
||||
where
|
||||
@@ -76,7 +76,8 @@ makeRect x y = [((0,0),(x,0))
|
||||
|
||||
linksAndPath :: [(Point2,Float)] -> [(Point2,Point2)] -> [(Point2,Point2)]
|
||||
linksAndPath lnks subpth = subpth ++ concatMap linkClosest lnks
|
||||
where linkClosest (p,_) = doublePair (p, head $ sortBy (compare `on` dist p) $ map fst subpth)
|
||||
where
|
||||
linkClosest (p,_) = doublePair (p, minimumBy (compare `on` dist p) $ map fst subpth)
|
||||
|
||||
{- Combines two rooms into one room.
|
||||
Combines into one big bound, concatenates the rest.
|
||||
@@ -174,7 +175,7 @@ fourthCornerWall w = do
|
||||
, PS (0,10) 0 putLamp
|
||||
, PS (0,2*w-20) pi PutNothing
|
||||
, blockLine (w/2,w/2) (0,w)
|
||||
, blockLine (negate $ w,w) (0,w)
|
||||
, blockLine (negate w,w) (0,w)
|
||||
]
|
||||
, [ PS (10-w,w) 0 putLamp
|
||||
, PS (w-10,w) 0 putLamp
|
||||
@@ -211,20 +212,16 @@ shufflePlacements r = do
|
||||
newPSs <- shuffle $ _rmPS r
|
||||
return $ r & rmPS .~ newPSs
|
||||
|
||||
putDefaultFlIt :: Item -> PSType
|
||||
putDefaultFlIt itm = PutFlIt itm
|
||||
|
||||
testRoom :: RandomGen g => State g Room
|
||||
testRoom = do
|
||||
corners <- replicateM 4 . join $ takeOne [fourthWall 100, fourthCornerWall 100]
|
||||
nItms <- state $ randomR (1,2)
|
||||
itms <- takeN nItms $ fmap putDefaultFlIt $ [autoRadar,autoSonar,remoteLauncher,jetPack,blinkGun] ++ replicate 5 (medkit 500)
|
||||
itms <- takeN nItms $ fmap PutFlIt $ [autoRadar,autoSonar,remoteLauncher,jetPack,blinkGun] ++ replicate 5 (medkit 500)
|
||||
nCrits <- state $ randomR (1,3)
|
||||
crits <- takeN nCrits $ fmap PutCrit $ [spreadGunCrit,pistolCrit,autoCrit,armourChaseCrit]
|
||||
++ replicate 20 chaseCrit
|
||||
randomiseAllLinks =<<
|
||||
( fmap (fillNothingPlacements $ crits ++ itms)
|
||||
. shufflePlacements
|
||||
randomiseAllLinks . (fillNothingPlacements $ crits ++ itms) =<<
|
||||
( shufflePlacements
|
||||
. foldr1 combineRooms
|
||||
$ zipWith (\r a -> shiftRoomBy ((0,0),a) r) corners [0,pi/2,pi,3*pi/2]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user