Correct room link position numbering
This commit is contained in:
@@ -14,18 +14,19 @@ import Data.Either
|
||||
|
||||
damageSensor
|
||||
:: (DamageType -> Either Int Int) -- Left gets sensed, Right does damage
|
||||
-> Float
|
||||
-> (Machine -> World -> World)
|
||||
-> PlacementSpot -> Placement
|
||||
damageSensor damF upf ps = pContID ps ( PutLS theLS)
|
||||
damageSensor damF wdth upf ps = pContID ps ( PutLS theLS)
|
||||
$ \lsid -> Just $ spNoID ps $ PutMachine yellow (reverse $ square wdth) defaultMachine
|
||||
{ _mcDraw = sensorSPic
|
||||
{ _mcDraw = sensorSPic wdth
|
||||
, _mcUpdate = \mc w -> upf mc $ sensorUpdate damF mc w
|
||||
, _mcLSs = [lsid]
|
||||
}
|
||||
where
|
||||
theLS = defaultLS { _lsPos = V3 0 0 30 , _lsIntensity = 0.1 }
|
||||
|
||||
lightSensor :: (Machine -> World -> World) -> PlacementSpot -> Placement
|
||||
lightSensor :: Float -> (Machine -> World -> World) -> PlacementSpot -> Placement
|
||||
lightSensor = damageSensor senseLasering
|
||||
|
||||
senseLasering :: DamageType -> Either Int Int
|
||||
@@ -47,9 +48,6 @@ sensorUpdate damF mc w = w & machines . ix mcid %~ upmc
|
||||
ni = fromIntegral x / 1000
|
||||
upls = lsIntensity .~ V3 ni ni ni
|
||||
|
||||
sensorSPic :: Machine -> SPic
|
||||
sensorSPic _ = ( colorSH yellow $ upperPrismPoly 25 (square wdth)
|
||||
sensorSPic :: Float -> Machine -> SPic
|
||||
sensorSPic wdth _ = ( colorSH yellow $ upperPrismPoly 25 (square wdth)
|
||||
, mempty )
|
||||
|
||||
wdth :: Float
|
||||
wdth = 10
|
||||
|
||||
@@ -10,6 +10,17 @@ import Color
|
||||
import Data.List
|
||||
import Control.Lens
|
||||
|
||||
heightWallPS :: PlacementSpot -> Float -> [Point2] -> Placement
|
||||
heightWallPS spot h ps = psj spot (PutForeground . colorSH col $ upperPrismPoly h ps)
|
||||
$ sps spot $ PutWall ps theWall
|
||||
where
|
||||
col = _wlColor defaultWall
|
||||
theWall = defaultWall
|
||||
{ _wlOpacity = SeeAbove
|
||||
, _wlDraw = False
|
||||
, _wlHeight = h
|
||||
}
|
||||
|
||||
heightWall :: Float -> [Point2] -> Placement
|
||||
heightWall h ps = ps0j (PutForeground . colorSH col $ upperPrismPoly h ps)
|
||||
$ sps0 $ PutWall ps theWall
|
||||
|
||||
@@ -62,7 +62,7 @@ placeSpotUsingLink w rm plmnt extract eff fallback = case searchedPoss (_rmPos r
|
||||
Nothing -> ((w,rm),[plmnt])
|
||||
Just plmnt' -> placeSpot (w,rm) plmnt'
|
||||
where
|
||||
searchedPoss [] = error "no correct pos type for lnk placement"
|
||||
searchedPoss [] = Nothing
|
||||
searchedPoss (pos:poss) = case extract pos of
|
||||
Nothing -> second (pos:) <$> searchedPoss poss
|
||||
Just (ps,rmpos) -> Just ( ps,rmpos:poss)
|
||||
|
||||
Reference in New Issue
Block a user