Implement first weapon into tree structure
This commit is contained in:
+16
-2
@@ -1,3 +1,10 @@
|
||||
{-
|
||||
Concerns link pairs of rooms.
|
||||
Link pairs determine where rooms can attach to each other; each pair consists
|
||||
of a position and a rotation.
|
||||
The last link in the list is considered the incoming link, the other links are
|
||||
the outgoing links.
|
||||
-}
|
||||
module Dodge.Room.Link
|
||||
where
|
||||
import Dodge.LevelGen
|
||||
@@ -11,11 +18,18 @@ import Control.Monad.State
|
||||
import Control.Lens
|
||||
import Data.List (delete)
|
||||
|
||||
randLinks :: RandomGen g => Room -> State g Room
|
||||
randLinks r = do
|
||||
{- Shuffle the initial links of a room randomly. -}
|
||||
randomiseOutLinks :: RandomGen g => Room -> State g Room
|
||||
randomiseOutLinks r = do
|
||||
newLinks <- shuffle $ init $ _rmLinks r
|
||||
return $ r {_rmLinks = newLinks ++ [last $ _rmLinks r]}
|
||||
|
||||
{- Shuffle all links of a room randomly. -}
|
||||
randomiseAllLinks :: RandomGen g => Room -> State g Room
|
||||
randomiseAllLinks r = do
|
||||
newLinks <- shuffle $ _rmLinks r
|
||||
return $ r {_rmLinks = newLinks}
|
||||
|
||||
filterLinks :: RandomGen g => ((Point2,Float) -> Bool) -> Room -> State g Room
|
||||
filterLinks cond r = do
|
||||
newLinks <- shuffle $ filter cond $ init $ _rmLinks r
|
||||
|
||||
Reference in New Issue
Block a user