Cleanup, merge modules

This commit is contained in:
2025-09-18 08:28:09 +01:00
parent f12ae3533c
commit 1564b1c721
23 changed files with 166 additions and 540 deletions
+3 -3
View File
@@ -7,8 +7,8 @@ import Dodge.Placement.Instance
--import Dodge.Terminal
import LensHelp
analyser :: ProximityRequirement -> PlacementSpot -> PlacementSpot -> Placement
analyser proxreq pslight psmc = extTrigLitPos pslight $ \tp ->
analyser :: ProximitySensorType -> PlacementSpot -> PlacementSpot -> Placement
analyser pst pslight psmc = extTrigLitPos pslight $ \tp ->
Just $
plSpot .~ psmc $
putTerminal (dark magenta)
@@ -20,4 +20,4 @@ analyser proxreq pslight psmc = extTrigLitPos pslight $ \tp ->
defaultMachine & mcColor .~ aquamarine
& mcType .~ McTerminal
& mcHP .~ 100
& mcType .~ McProxSensor (defaultProximitySensor{_proxRequirement = proxreq})
& mcType .~ McProxSensor (ProxSensor pst False)
+2 -2
View File
@@ -76,8 +76,8 @@ divideDoorPane mid wl cond soff speed ppairs g = case ppairs of
& drPushedBy .~ maybe PushesItself PushedBy mid
putAutoDoor :: Point2 -> Point2 -> Placement
putAutoDoor a b = Placement 0 (PS 0 0) (PutCoord a) Nothing $ \_ apl ->
Just $ Placement 0 (PS 0 0) (PutCoord b) Nothing $ \w bpl ->
putAutoDoor a b = Placement (PS 0 0) (PutCoord a) Nothing $ \_ apl ->
Just $ Placement (PS 0 0) (PutCoord b) Nothing $ \w bpl ->
let x = w ^?! coordinates . ix (apl ^?! plMID . _Just)
y = w ^?! coordinates . ix (bpl ^?! plMID . _Just)
in Just $ putDoubleDoor
+1 -1
View File
@@ -174,7 +174,7 @@ spanLSLightI ls h a b =
spanLS :: LightSource -> Point2 -> Point2 -> Placement
spanLS ls a b =
Placement 10 (PS (V2 x y) 0) (PutLS ls) Nothing $
Placement (PS (V2 x y) 0) (PutLS ls) Nothing $
const $ const $ Just $ sps0 $ putShape $ thinHighBar h a b
where
V3 _ _ h = _lsPos (_lsParam ls) + 5
@@ -1,4 +1,4 @@
module Dodge.Placement.Instance.LightSource.Flicker where
module Dodge.Placement.Instance.LightSource.Flicker (flickerMod, flickerUpdate) where
import Control.Lens
import Data.Maybe
@@ -30,7 +30,7 @@ flickerUpdate md w
%~ ((mdTimer .~ newtime) . (mdPoint3 .~ lscol) . (mdBool %~ not))
where
mdcol = _mdPoint3 md
lscol = w ^?! cWorld . lWorld . lightSources . ix lsid . lsParam . lsCol -- _lsCol $ _lsParam $ _lightSources w IM.! lsid
lscol = w ^?! cWorld . lWorld . lightSources . ix lsid . lsParam . lsCol
lsid = _mdExternalID md
mdid = _mdID md
timerange
+7 -17
View File
@@ -36,12 +36,8 @@ placeSpot (w, rm) plmnt = case plmnt of
where
shift = _rmShift rm
placePlainPSSpot ::
GenWorld ->
Room ->
Placement ->
DPoint2 ->
((GenWorld, Room), [Placement])
placePlainPSSpot
:: GenWorld -> Room -> Placement -> DPoint2 -> ((GenWorld, Room), [Placement])
placePlainPSSpot w rm plmnt shift =
let (i, w') = placeSpotID (shiftPSBy shift (_plSpot plmnt)) (_plType plmnt) w
newplmnt = plmnt & plMID ?~ i
@@ -106,7 +102,8 @@ placeSpotID' ps pt w = case pt of
)
)
PutCrit cr -> plNewUpID (cWorld . lWorld . creatures) crID (mvCr p rot cr) w
PutForeground fs -> plNewUpID (cWorld . lWorld . foregroundShapes) fsID (mvFS p rot fs) w
PutForeground fs -> plNewUpID (cWorld . lWorld . foregroundShapes) fsID
(mvFS p rot fs) w
PutMachine pps mc wl mitm -> plMachine (map doShift pps) mc wl mitm p rot w
PutLS ls -> plNewUpID (cWorld . lWorld . lightSources) lsID (mvLS p' rot ls) w
PutPPlate pp -> plNewUpID (cWorld . lWorld . pressPlates) ppID (mvPP p rot pp) w
@@ -138,12 +135,6 @@ evaluateRandPS rgen ps w = placeSpotID' ps evaluatedType (set randGen g w)
where
(evaluatedType, g) = runState rgen (_randGen w)
--placeWallPoly :: [Point2] -> Wall -> World -> World
--placeWallPoly ps wl = -- rmCrossPaths .
-- over walls (placeWalls ps wl)
---- where
---- rmCrossPaths w = foldr (uncurry obstructPathsCrossing) w $ loopPairs ps
-- this function is the reason for the warning suppression
-- remove the warning suppression if it changes
placeWallPoly :: [Point2] -> Wall -> World -> World
@@ -212,11 +203,11 @@ plMachine' wallpoly mc wl p rot gw =
mcid = IM.newKey $ gw ^. cWorld . lWorld . machines
wlid = IM.newKey $ gw ^. cWorld . lWorld . walls
wlids = IS.fromList [wlid .. wlid + length wallpoly - 1]
--addMc = IM.insert mcid (mc {_mcPos = centroid wallpoly,_mcDir = rot,_mcID = mcid, _mcWallIDs = wlids})
addMc = IM.insert mcid (mc{_mcPos = p, _mcDir = rot, _mcID = mcid, _mcWallIDs = wlids})
-- TODO correctly remove/shift pathfinding lines (removePathsCrossing)
placeMachineWalls :: Wall -> Color -> [Point2] -> Int -> Int -> IM.IntMap Wall -> IM.IntMap Wall
placeMachineWalls
:: Wall -> Color -> [Point2] -> Int -> Int -> IM.IntMap Wall -> IM.IntMap Wall
placeMachineWalls wl col poly mcid wlid = flip (foldr f) $ zip [wlid ..] $ loopPairs poly
where
f (wid, l) = IM.insert wid baseWall{_wlID = wid, _wlLine = l}
@@ -227,7 +218,6 @@ placeMachineWalls wl col poly mcid wlid = flip (foldr f) $ zip [wlid ..] $ loopP
& wlTouchThrough .~ True
mvLS :: Point3 -> Float -> LightSource -> LightSource
mvLS (V3 x y z) rot ls =
ls & lsParam . lsPos .~ V3 x y z +.+.+ startPos
mvLS (V3 x y z) rot ls = ls & lsParam . lsPos .~ V3 x y z +.+.+ startPos
where
startPos = onXY (rotateV rot) $ _lsPos (_lsParam ls)
-1
View File
@@ -25,4 +25,3 @@ shiftPlacement shift plmnt = case plmnt of
Placement{} ->
plmnt & plSpot %~ shiftPSBy shift
& plIDCont %~ fmap (fmap (fmap $ shiftPlacement shift))
-- RandomPlacement rpl -> RandomPlacement $ fmap (shiftPlacement shift) rpl