Allow for lights to be stored in a one-frame list
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
module Dodge.Data.WorldEffect where
|
||||
|
||||
import Dodge.Data.LightSource
|
||||
import Dodge.Data.ComposedItem
|
||||
import Dodge.Data.DoubleTree
|
||||
import Data.Aeson
|
||||
@@ -33,6 +34,7 @@ data WdWd
|
||||
| WdWdNegateTrig Int
|
||||
| WdWdFromItixCrixWdWd Int Int ItCrWdWd
|
||||
| WdWdFromItCrixWdWd (LabelDoubleTree ComposeLinkType Item) Int ItCrWdWd
|
||||
| MakeTempLight LSParam Int
|
||||
--deriving (Eq, Show, Read) --, Generic)
|
||||
--h--deriving (Eq, Show, Read) --Generic, Flat)
|
||||
|
||||
|
||||
@@ -37,12 +37,14 @@ terminalScreenGlow mc w = fromMaybe w $ do
|
||||
term <- w ^? cWorld . lWorld . terminals . ix tid
|
||||
V4 x y z _ <- termScreenColor term
|
||||
return $
|
||||
w & cWorld . lWorld . tempLightSources
|
||||
.:~ TLS
|
||||
{ _tlsParam = LSParam (_mcPos mc `v2z` 20) 30 (V3 x y z)
|
||||
, _tlsUpdate = TimerTLS
|
||||
, _tlsTime = 1
|
||||
}
|
||||
w & cWorld . lWorld . lights
|
||||
.:~ LSParam (_mcPos mc `v2z` 20) 30 (V3 x y z)
|
||||
-- w & cWorld . lWorld . tempLightSources
|
||||
-- .:~ TLS
|
||||
-- { _tlsParam = LSParam (_mcPos mc `v2z` 20) 30 (V3 x y z)
|
||||
-- , _tlsUpdate = TimerTLS
|
||||
-- , _tlsTime = 1
|
||||
-- }
|
||||
|
||||
updateTurret :: Float -> Machine -> World -> World
|
||||
updateTurret rotSpeed mc w =
|
||||
|
||||
@@ -17,6 +17,7 @@ lightsToRender cfig campos w = take (fromEnum $ cfig ^. graphics_num_shadow_cas
|
||||
sortOn (\(_,x,_) -> negate x) $
|
||||
mapMaybe getLS (IM.elems $ w ^. lightSources)
|
||||
++ mapMaybe getTLS (w ^. tempLightSources)
|
||||
++ mapMaybe getlsparam (w ^. lights)
|
||||
where
|
||||
getLS = getlsparam . _lsParam
|
||||
getTLS = getlsparam . _tlsParam
|
||||
|
||||
+17
-17
@@ -24,23 +24,23 @@ import Dodge.Data.Universe
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
testStringInit :: Universe -> [String]
|
||||
testStringInit u =
|
||||
[ show $ u ^? uvWorld . input . mouseContext . mcoSelEnd
|
||||
, show $ u ^? uvWorld . hud . hudElement . diSelection
|
||||
, show $ u ^? uvWorld . input . mouseContext
|
||||
, show $ u ^? uvWorld . input . mouseContext . mcoDragSection
|
||||
, show $ u ^? uvWorld . input . mouseContext . mcoMaybeSelect
|
||||
, show $ u ^? uvWorld . input . mouseContext . mcoAboveSelect
|
||||
, show $ u ^? uvWorld . input . mouseContext . mcoBelowSelect
|
||||
, show mpos
|
||||
, show yint
|
||||
, show $ u ^? uvWorld . hud . hudElement . diSections >>= inverseSelSecYint yint
|
||||
]
|
||||
where
|
||||
idp = invDisplayParams $ u ^. uvWorld
|
||||
cfig = u ^. uvConfig
|
||||
yint = posSelSecYint cfig idp y
|
||||
mpos@(V2 _ y) = u ^. uvWorld . input . mousePos
|
||||
testStringInit u = [show $ length <$> u ^.. uvWorld . cWorld . lWorld . lights]
|
||||
-- [ show $ u ^? uvWorld . input . mouseContext . mcoSelEnd
|
||||
-- , show $ u ^? uvWorld . hud . hudElement . diSelection
|
||||
-- , show $ u ^? uvWorld . input . mouseContext
|
||||
-- , show $ u ^? uvWorld . input . mouseContext . mcoDragSection
|
||||
-- , show $ u ^? uvWorld . input . mouseContext . mcoMaybeSelect
|
||||
-- , show $ u ^? uvWorld . input . mouseContext . mcoAboveSelect
|
||||
-- , show $ u ^? uvWorld . input . mouseContext . mcoBelowSelect
|
||||
-- , show mpos
|
||||
-- , show yint
|
||||
-- , show $ u ^? uvWorld . hud . hudElement . diSections >>= inverseSelSecYint yint
|
||||
-- ]
|
||||
-- where
|
||||
-- idp = invDisplayParams $ u ^. uvWorld
|
||||
-- cfig = u ^. uvConfig
|
||||
-- yint = posSelSecYint cfig idp y
|
||||
-- mpos@(V2 _ y) = u ^. uvWorld . input . mousePos
|
||||
-- , show . fmap (fmap _siPictures) $ u ^? uvWorld . hud . hudElement . diSections . ix (-1) . ssItems
|
||||
-- <> [[toEnum (i+j * 32) | i <- [0..31]] | j <- [0..7]]
|
||||
-- <> map show (IM.elems (L.postscan (L.premap _siHeight L.sum)
|
||||
|
||||
@@ -164,6 +164,7 @@ updateUniverseMid u = case _uvScreenLayers u of
|
||||
(cWorld . lWorld . radarBlips .~ [])
|
||||
-- . updateIMl _props _pjUpdate
|
||||
. updateLightSources
|
||||
. (cWorld . lWorld . lights .~ [])
|
||||
. updateClouds
|
||||
)
|
||||
(sl : _) -> u & updateUseInputOnScreen sl
|
||||
@@ -297,6 +298,7 @@ functionalUpdate u =
|
||||
. over uvWorld zoneCreatures
|
||||
-- . over uvWorld updateInventorySelectionList
|
||||
. set (uvWorld . cWorld . lWorld . flares) []
|
||||
. set (uvWorld . cWorld . lWorld . lights) []
|
||||
$ over uvWorld updatePastWorlds u
|
||||
|
||||
checkTermDist :: World -> World
|
||||
|
||||
@@ -45,6 +45,9 @@ doWdWd we = case we of
|
||||
WdWdFromItCrixWdWd it crid f -> \w -> fromMaybe w $ do
|
||||
cr <- w ^? cWorld . lWorld . creatures . ix crid
|
||||
return $ doItCrWdWd f it cr w
|
||||
MakeTempLight _ 0 -> id
|
||||
MakeTempLight x t -> (cWorld . lWorld . lights .:~ x)
|
||||
. (cWorld . lWorld . worldEvents .:~ MakeTempLight x (t-1))
|
||||
|
||||
doItCrWdWd :: ItCrWdWd -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
|
||||
doItCrWdWd icww = case icww of
|
||||
|
||||
Reference in New Issue
Block a user