Add blurring of lightmap (and refactoring)

This commit is contained in:
2021-05-01 02:28:04 +02:00
parent 9c0e4425da
commit 7711738b3b
33 changed files with 485 additions and 249 deletions
+30
View File
@@ -2,6 +2,7 @@ module Dodge.Item.Attachment
where
import Dodge.Data
import Dodge.Item.Attachment.Data
import Dodge.Default
import Control.Lens hiding ((|>),(<|))
import Data.Sequence
@@ -40,3 +41,32 @@ charFiringStrat strats cid w =
. ix (_crInvSel $ _creatures w IM.! cid) . itAttachment
. _Just . itCharMode
in fromJust (Prelude.lookup c strats) cid w
increaseFuse
:: Int -- ^ Old fuse time
-> Int -- ^ Inventory item reference (I believe)
-> World
-> World
increaseFuse fuse itID w = w
& creatures . ix 0 . crInv . ix itID . itScrollUp .~ decreaseFuse newTime
& creatures . ix 0 . crInv . ix itID . itScrollDown .~ increaseFuse newTime
& creatures . ix 0 . crInv . ix itID . itAttachment ?~ ItFuse newTime
& creatures . ix 0 . crInv . ix itID . itZoom
.~ (defaultItZoom {_itAimZoomMax = zm, _itAimZoomMin = zm})
where
newTime = min (fuse + 5) 90
zm = 50 / fromIntegral newTime
decreaseFuse
:: Int -- ^ Old fuse time
-> Int -- ^ Inventory item reference (I believe)
-> World -> World
decreaseFuse fuse itID w = w
& creatures . ix 0 . crInv . ix itID . itScrollUp .~ decreaseFuse newTime
& creatures . ix 0 . crInv . ix itID . itScrollDown .~ increaseFuse newTime
& creatures . ix 0 . crInv . ix itID . itAttachment ?~ ItFuse newTime
& creatures . ix 0 . crInv . ix itID . itZoom
.~ (defaultItZoom {_itAimZoomMax = zm, _itAimZoomMin = zm})
where
newTime = max (fuse - 5) 20
zm = 50 / fromIntegral newTime