135 lines
3.5 KiB
Haskell
135 lines
3.5 KiB
Haskell
{- |
|
|
Module : Dodge.Default
|
|
Description : Instances of data structures
|
|
|
|
This module contains prototypical data structures.
|
|
-}
|
|
module Dodge.Default
|
|
( module Dodge.Default
|
|
, module Dodge.Default.Item
|
|
, module Dodge.Default.LightSource
|
|
, module Dodge.Default.Weapon
|
|
, module Dodge.Default.Wall
|
|
, module Dodge.Default.Creature
|
|
) where
|
|
import Dodge.Default.Wall
|
|
import Dodge.Default.Creature
|
|
import Dodge.Default.Weapon
|
|
import Dodge.Default.LightSource
|
|
import Dodge.Default.Item
|
|
import Dodge.Data
|
|
import Dodge.SoundLogic
|
|
import Geometry
|
|
import Picture
|
|
import ShapePicture
|
|
import Shape
|
|
|
|
import Control.Lens
|
|
import qualified Data.Text as T
|
|
import qualified Data.Map.Strict as M
|
|
|
|
defaultEquipment :: Item
|
|
defaultEquipment = defaultItem
|
|
{ _itInvColor = yellow
|
|
, _itUse = EquipUse defaultEquip
|
|
, _itAttachment = NoItAttachment
|
|
}
|
|
defaultItZoom :: ItZoom
|
|
defaultItZoom = ItZoom 20 0.2 1
|
|
defaultConsumable :: Item
|
|
defaultConsumable = defaultItem
|
|
{ _itConsumption = ItemItselfConsumable {_icAmount = 1}
|
|
, _itInvColor = blue
|
|
}
|
|
|
|
defaultFlIt :: FloorItem
|
|
defaultFlIt = FlIt {_flItRot=0,_flIt = defaultConsumable, _flItPos = V2 0 0, _flItID = 0}
|
|
defaultMachine :: Machine
|
|
defaultMachine = Machine
|
|
{ _mcID = 0
|
|
, _mcWallIDs = mempty
|
|
-- , _mcUpdate = defaultMachineUpdate
|
|
, _mcDraw = const mempty
|
|
, _mcColor = white
|
|
, _mcPos = V2 0 0
|
|
, _mcDir = 0
|
|
, _mcHP = 1000
|
|
, _mcSensor = NoSensor
|
|
, _mcDamage = []
|
|
, _mcLSs = []
|
|
, _mcType = StaticMachine
|
|
, _mcName = ""
|
|
, _mcMounts = mempty
|
|
, _mcCloseSound = Nothing
|
|
}
|
|
defaultDrawButton :: Color -> Button -> SPic
|
|
defaultDrawButton col bt =
|
|
( translateSHz 15 . colorSH col $ upperPrismPoly 5 buttonGeometry
|
|
, mempty
|
|
)
|
|
where
|
|
buttonGeometry
|
|
| _btState bt == BtOff = reverse $ rectNSWE 10 (-1) (-width) width
|
|
| otherwise = reverse $ rectNSWE 2 (-1) (-width) width
|
|
width = 8
|
|
defaultTerminal :: Terminal
|
|
defaultTerminal = Terminal
|
|
{ _tmID = 0
|
|
, _tmProgram = \_ _ -> []
|
|
, _tmButtonID = 0
|
|
, _tmMachineID = 0
|
|
, _tmName = "TESTTERMINAL"
|
|
, _tmDisplayedLines = []
|
|
, _tmFutureLines = []
|
|
, _tmMaxLines = 14
|
|
, _tmTitle = "TERMINAL IN LOCATION"
|
|
, _tmInput = defaultTerminalInput
|
|
, _tmScrollCommands = []
|
|
, _tmWriteCommands = []
|
|
, _tmDeathEffect = const id
|
|
, _tmStatus = TerminalOff
|
|
, _tmCommandHistory = []
|
|
, _tmToggles = M.empty
|
|
}
|
|
defaultTerminalInput :: TerminalInput
|
|
defaultTerminalInput = TerminalInput
|
|
{ _tiText = T.pack ""
|
|
, _tiFocus = True
|
|
, _tiSel = (0,0)
|
|
}
|
|
|
|
defaultButton :: Button
|
|
defaultButton = Button
|
|
{ _btPict = defaultDrawButton (dark red)
|
|
, _btPos = V2 0 0
|
|
, _btRot = 0
|
|
, _btEvent = \b w -> set (buttons . ix (_btID b) . btState) BtNoLabel
|
|
. soundStart (LeverSound 0) (_btPos b) click1S Nothing $ w
|
|
, _btID = 0
|
|
, _btText = "Button"
|
|
, _btState = BtOff
|
|
, _btTermMID = Nothing
|
|
, _btName = ""
|
|
, _btColor = red
|
|
}
|
|
defaultPP :: PressPlate
|
|
defaultPP = PressPlate
|
|
{ _ppPict = setDepth 1 . color (dim . dim $ bright blue) $ circleSolid 5
|
|
, _ppPos = V2 0 0
|
|
, _ppRot = 0
|
|
, _ppEvent = const id
|
|
, _ppID = -1
|
|
, _ppText = "Pressure plate"
|
|
}
|
|
|
|
upHammer :: HammerType
|
|
upHammer = HasHammer HammerUp
|
|
|
|
defaultProximitySensor :: Sensor
|
|
defaultProximitySensor = ProximitySensor
|
|
{ _proxStatus = NotClose
|
|
, _proxDist = 40
|
|
, _proxRequirement = RequireImpossible
|
|
, _sensToggle = False
|
|
}
|