Defunction-ify item modules, requires more cleanup

This commit is contained in:
2022-06-08 12:28:11 +01:00
parent d91a53f76c
commit bcbfd7d2fa
48 changed files with 762 additions and 740 deletions
+12 -72
View File
@@ -4,8 +4,14 @@ Description : Instances of data structures
This module contains prototypical data structures.
-}
module Dodge.Default where
module Dodge.Default
( module Dodge.Default
, module Dodge.Default.Item
, module Dodge.Default.LightSource
) where
import Dodge.Default.Weapon
import Dodge.Default.LightSource
import Dodge.Default.Item
import Dodge.Data
import Dodge.SoundLogic
import Dodge.Wall.Delete
@@ -149,57 +155,21 @@ defaultState = CrSt
, _crSpState = GenCr
, _crDropsOnDeath = DropAll
}
defaultEquipment :: Item
defaultEquipment = Item
{ _itCurseStatus = Uncursed
, _itType = NOTDEFINED
, _itName = "genericEquipment"
-- ,_itIdentity = Generic
, _itEquipPict = \_ _ -> (,) emptySH blank
, _itEffect = NoItEffect
, _itID = Nothing
, _itIsHeld = False
, _itInvColor = yellow
, _itInvDisplay = \it -> [_itName it]
, _itInvSize = 1
, _itInvPos = Nothing
defaultEquipment = defaultItem
{ _itInvColor = yellow
, _itDimension = defItDimCol yellow
, _itConsumption = NoConsumption
, _itUse = EquipUse defaultEquip
, _itAttachment = NoItAttachment
, _itParams = NoParams
, _itTweaks = NoTweaks
, _itModules = M.empty
, _itScope = NoScope
, _itTargeting = NoTargeting
, _itValue = defaultItemValue
}
defaultItZoom :: ItZoom
defaultItZoom = ItZoom 20 0.2 1
defaultConsumable :: Item
defaultConsumable = Item
{ _itUse = NoUse
-- , _itIdentity = Generic
, _itInvSize = 1
, _itCurseStatus = Uncursed
, _itName = "genericConsumable"
, _itConsumption = ItemItselfConsumable {_itAmount = 1}
, _itEquipPict = \_ _ -> mempty
, _itID = Nothing
, _itInvPos = Nothing
, _itIsHeld = False
defaultConsumable = defaultItem
{ _itConsumption = ItemItselfConsumable {_itAmount = 1}
, _itInvColor = blue
, _itInvDisplay = \it -> [_itName it ++ " x" ++ show (_itAmount $ _itConsumption it)]
, _itEffect = NoItEffect
, _itAttachment = NoItAttachment
, _itType = NoCombineType
, _itParams = NoParams
, _itDimension = defItDimCol blue
, _itTweaks = NoTweaks
, _itModules = M.empty
, _itScope = NoScope
, _itTargeting = NoTargeting
, _itValue = defaultItemValue
}
defaultFlIt :: FloorItem
@@ -299,36 +269,6 @@ defaultPP = PressPlate
, _ppID = -1
, _ppText = "Pressure plate"
}
defaultLS :: LightSource
defaultLS = LS
{ _lsID = 0
, _lsParam = LSParam
{ _lsPos = V3 0 0 50
, _lsRad = 700
, _lsCol = 0.6
}
, _lsDir = 0
, _lsPict = defLSPic
}
defLSPic :: LightSource -> Picture
defLSPic ls = setLayer BloomNoZWrite . translate3 (_lsPos $ _lsParam ls) . color col $ circleSolid 4
where
col = V4 r g b 2
V3 r g b = _lsCol $ _lsParam ls
defaultTLS :: TempLightSource
defaultTLS = TLS
{ _tlsParam = LSParam
{ _lsPos = 0
, _lsRad = 0
, _lsCol = 0.5
}
, _tlsUpdate = f
, _tlsTime = 1
}
where
f _ t
| _tlsTime t <= 0 = Nothing
| otherwise = Just $ t & tlsTime -~ 1
upHammer :: HammerType
upHammer = HasHammer HammerUp