Cleanup terminal display
This commit is contained in:
@@ -31,7 +31,7 @@ damageSensor dt wdth upf ps = pContID ps (PutLS $ lsPosCol (V3 0 0 30) 0.1)
|
||||
}
|
||||
|
||||
lightSensor :: Float -> (Machine -> World -> World) -> PlacementSpot -> Placement
|
||||
lightSensor = damageSensor Lasering
|
||||
lightSensor = damageSensor LASERING
|
||||
|
||||
sensorUpdate :: DamageType -> Machine -> World -> World
|
||||
sensorUpdate damF mc w = w & machines . ix mcid %~ upmc
|
||||
|
||||
@@ -11,13 +11,14 @@ import Dodge.LevelGen.Data
|
||||
import Dodge.Default
|
||||
import Dodge.Machine
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.Terminal
|
||||
import Dodge.WorldEvent.Explosion
|
||||
import Color
|
||||
import Geometry
|
||||
import ShapePicture
|
||||
import LensHelp
|
||||
import Shape
|
||||
import Sound.Data
|
||||
--import Sound.Data
|
||||
|
||||
import Data.Maybe
|
||||
|
||||
@@ -34,10 +35,9 @@ putTerminal' col mcf = ps0PushPS (PutButton termButton)
|
||||
})
|
||||
$ const Nothing
|
||||
|
||||
putTerminal :: (GenParams -> World -> TerminalParams) -> Placement
|
||||
putTerminal f = ps0PushPSw PutNothing $ \w _ -> Just $
|
||||
--plGenUpdate ?~ g $ ps0PushPS (PutButton $ termButton & btTerminalParams .~ f (_genParams w))
|
||||
ps0PushPS (PutButton $ termButton & btTerminalParams .~ f (_genParams w))
|
||||
putTerminal :: (World -> TerminalParams) -> Placement
|
||||
putTerminal f = ps0PushPSw PutNothing $ \_ _ -> Just $
|
||||
ps0PushPS (PutButton $ termButton & btTerminalParams .~ f)
|
||||
$ \pl -> Just $ pt0 (PutMachine terminalColor (reverse $ square 10) defaultMachine
|
||||
{ _mcDraw = noPic . terminalShape terminalColor
|
||||
, _mcHP = 100
|
||||
@@ -82,7 +82,7 @@ displayTerminalMessage btid w = w & hud . hudElement .~ DisplayInventory Display
|
||||
, _termParams = fromMaybe NoTerminalParams $ (w ^? buttons . ix btid . btTerminalParams) <&> ($ w)
|
||||
}
|
||||
|
||||
simpleTermMessage :: [String] -> (GenParams -> World -> TerminalParams)
|
||||
simpleTermMessage :: [String] -> World -> TerminalParams
|
||||
simpleTermMessage = genTermMessage . const
|
||||
--simpleTermMessage ss = const $ TerminalParams
|
||||
-- {_termDisplayedLines = []
|
||||
@@ -105,25 +105,5 @@ topFlushStrings = topFlush . maximum . map length
|
||||
topFlush :: Int -> [String]
|
||||
topFlush twidth = [replicate i ' ' ++ "*" | i <- [0, max 1 $ twidth `div` 5 .. twidth]]
|
||||
|
||||
genTermMessage :: (GenParams -> [String]) -> (GenParams -> World -> TerminalParams)
|
||||
genTermMessage f = \gp _ -> TerminalParams
|
||||
{_termDisplayedLines = []
|
||||
,_termFutureLines = termSoundLine computerBeepingS
|
||||
: map totermline (topFlushStrings (f gp) ++ f gp)
|
||||
,_termMaxLines = 7
|
||||
,_termTitle = "TERMINAL"
|
||||
,_termSel = Nothing
|
||||
-- ,_termOptions = []
|
||||
,_termInput = Nothing
|
||||
,_termScrollCommands = []
|
||||
,_termWriteCommands = []
|
||||
}
|
||||
where
|
||||
totermline s = TerminalLineDisplay 0 (const (s,white))
|
||||
|
||||
termSoundLine :: SoundID -> TerminalLine
|
||||
termSoundLine sid = TerminalLineEffect 0 termsound
|
||||
where
|
||||
termsound subinv w = soundStart TerminalSound tpos sid Nothing w
|
||||
where
|
||||
tpos = fromMaybe 0 $ w ^? buttons . ix (_termID subinv) . btPos
|
||||
genTermMessage :: (World -> [String]) -> World -> TerminalParams
|
||||
genTermMessage f w = defaultTermParams & termFutureLines ++.~ map makeTermLine (f w)
|
||||
|
||||
@@ -83,7 +83,7 @@ updateTurret rotSpeed mc w
|
||||
& creatures . ix cid . crPos .~ mcpos
|
||||
& creatures . ix cid . crDir .~ mcdir
|
||||
dodamage = machines . ix mcid %~
|
||||
( (mcDamage .~ [Damage Electrical (min 2500 $ max 0 (elecDam - 10)) 0 0 0 NoDamageEffect])
|
||||
( (mcDamage .~ [Damage ELECTRICAL (min 2500 $ max 0 (elecDam - 10)) 0 0 0 NoDamageEffect])
|
||||
. (mcHP -~ dam)
|
||||
)
|
||||
elecDamBranch
|
||||
|
||||
Reference in New Issue
Block a user