Fix bug in detecting which room you are in

This commit is contained in:
2021-09-03 01:22:46 +01:00
parent c69af7a5f4
commit 1bbeb926a5
14 changed files with 121 additions and 93 deletions
+12 -1
View File
@@ -11,11 +11,14 @@ import Dodge.WorldEvent.Cloud
import Dodge.SoundLogic
import Dodge.SoundLogic.Synonyms
import Geometry.Data
import Dodge.GameRoom
import Geometry
import System.Random
import qualified Data.Set as S
import qualified Data.IntMap.Strict as IM
import qualified Data.Map as M
import Data.List (sortOn)
firstWorld :: IO World
firstWorld = do
@@ -37,7 +40,7 @@ initialWorld = defaultWorld
, _floorItems = IM.empty
, _randGen = mkStdGen 2
, _mousePos = V2 0 0
, _testString = []
, _testString = testStringInit
, _yourID = 0
, _worldEvents = soundOncePos foamSprayFadeOutSound (V2 0 0) . foldr ((.) . makeStartCloudAt) id
[V3 x y 5 | x <- [-5,-3..5] , y <- [-5,-3..5]]
@@ -49,3 +52,11 @@ initialWorld = defaultWorld
, _menuLayers = [TerminalMessage 300 rezText']
, _worldState = M.empty
}
testStringInit :: World -> [String]
testStringInit w = (show . _crPos $ _creatures w IM.! 0)
: (map show . _grBound . last $ sortOn _grName grs)
++ closeRooms
where
closeRooms = map _grName $ filter (pointInOrOnPolygon p . _grBound) grs
grs = _gameRooms w
p = _cameraViewFrom w