Broken: refactor terminals

This commit is contained in:
2022-07-25 00:45:15 +01:00
parent d1bf49319a
commit d219d8d889
25 changed files with 505 additions and 364 deletions
+4 -62
View File
@@ -86,7 +86,9 @@ module Dodge.Data
, module Dodge.Data.MountedObject
, module Dodge.Data.Machine
, module Dodge.Data.GenParams
, module Dodge.Data.Terminal
) where
import Dodge.Data.Terminal
import Dodge.Data.GenParams
import Dodge.Data.Machine
import Dodge.Data.MountedObject
@@ -255,8 +257,8 @@ data World = World
, _randGen :: StdGen
, _modifications :: IM.IntMap Modification
, _yourID :: Int
, _worldEvents :: [WorldEffect]
, _delayedEvents :: [(Int,WorldEffect)]
, _worldEvents :: [WdWd]
, _delayedEvents :: [(Int,WdWd)]
, _pressPlates :: IM.IntMap PressPlate
, _buttons :: IM.IntMap Button
, _toPlaySounds :: M.Map SoundOrigin Sound
@@ -355,19 +357,6 @@ data MenuOption
{ _moKey :: Scancode
, _moEff :: Universe -> IO (Maybe Universe)
}
data TerminalLine
= TerminalLineDisplay
{_tlPause :: Int
,_tlString :: World -> (String, Color)
}
| TerminalLineTerminalEffect
{_tlPause :: Int
,_tlTermEffect :: Terminal -> Terminal
}
| TerminalLineEffect
{_tlPause :: Int
,_tlEffect :: Terminal -> World -> World
}
data FloorItem = FlIt { _flIt :: Item , _flItPos :: Point2 , _flItRot :: Float, _flItID :: Int}
deriving (Eq,Ord,Show,Read)
@@ -402,49 +391,6 @@ type HitEffect' = Flame
-> (World,Maybe Flame)
data Either3 a b c = E3x1 a | E3x2 b | E3x3 c
data TerminalStatus = TerminalOff | TerminalBusy | TerminalReady
deriving (Eq,Ord,Show)
data TerminalInput = TerminalInput
{ _tiText :: T.Text
, _tiFocus :: Bool
, _tiSel :: (Int,Int)
}
data Terminal = Terminal
{ _tmID :: Int
, _tmBootProgram :: Terminal -> World -> [TerminalLine]
, _tmButtonID :: Int
, _tmMachineID :: Int
, _tmName :: String
, _tmDisplayedLines :: [(String,Color)]
, _tmFutureLines :: [TerminalLine]
, _tmMaxLines :: Int
, _tmTitle :: String
, _tmInput :: TerminalInput
, _tmScrollCommands :: [TerminalCommand]
, _tmWriteCommands :: [TerminalCommand]
, _tmDeathEffect :: Terminal -> World -> World
, _tmStatus :: TerminalStatus
, _tmCommandHistory :: [String]
, _tmToggles :: M.Map String TerminalToggle
}
data TerminalToggle = TerminalToggle
{ _ttTriggerID :: Int
, _ttDeathEffect :: Bool -> Bool
}
data EffectArguments
= NoArguments {_cmdEffect :: [TerminalLine]}
| OneArgument
{_argType :: String
,_argList :: M.Map String [TerminalLine]
}
data TerminalCommand = TerminalCommand
{ _tcString :: String
, _tcAlias :: [String]
, _tcHelp :: String
, _tcEffect :: Terminal -> World -> EffectArguments
}
---- ROOM DATATYPES
data PSType = PutCrit {_unPutCrit :: Creature}
@@ -547,16 +493,12 @@ data InPlacement = InPlacement
makeLenses ''World
makeLenses ''FloorItem
--makeLenses ''Particle
makeLenses ''Terminal
makeLenses ''Universe
makeLenses ''GunBarrels
makeLenses ''Nozzle
makeLenses ''TerminalLine
makeLenses ''Equipment
makeLenses ''ScreenLayer
makeLenses ''WorldBeams
makeLenses ''TerminalCommand
makeLenses ''TerminalInput
----- ROOM LENSES
makeLenses ''Room