Cleanup
This commit is contained in:
@@ -14,7 +14,6 @@ import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import qualified Data.Map.Strict as M
|
||||
import Dodge.Data.BlBl
|
||||
--import Dodge.Data.Machine.Sensor.Type
|
||||
import Dodge.Data.Terminal.Status
|
||||
import Dodge.Data.WorldEffect
|
||||
import Sound.Data
|
||||
@@ -63,8 +62,7 @@ data TmWdWd
|
||||
| TmWdWdDoDeathTriggers
|
||||
| TmTmClearDisplayedLines
|
||||
| TmTmSetStatus TerminalStatus
|
||||
-- | TmGetDamageCoding SensorType
|
||||
| TmGetSensor String
|
||||
-- | TmGetSensor String
|
||||
|
||||
makeLenses ''Terminal
|
||||
makeLenses ''TerminalLine
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
--{-# LANGUAGE TupleSections #-}
|
||||
module Dodge.Room.Warning (warningRooms) where
|
||||
|
||||
import Dodge.Default.Terminal
|
||||
import Dodge.Data.BlBl
|
||||
import Color
|
||||
import qualified Data.Map.Strict as M
|
||||
@@ -16,7 +17,6 @@ import Dodge.Room.Procedural
|
||||
import Dodge.Room.Tanks
|
||||
import Dodge.Terminal
|
||||
import Dodge.Tree
|
||||
import Dodge.WorldEffect
|
||||
import Geometry
|
||||
import LensHelp
|
||||
import RandomHelp
|
||||
@@ -46,6 +46,15 @@ addWarningTerminal str outplid = (rmName .++~ "warningTerm-")
|
||||
& tmToggles .~ M.fromList
|
||||
[("DOOR", TerminalToggle (fromJust $ _plMID trpl) (BlConst True))]
|
||||
|
||||
lineOutputTerminal :: [TerminalLine] -> Terminal
|
||||
lineOutputTerminal tls =
|
||||
defaultTerminal
|
||||
{ _tmDisplayedLines = []
|
||||
, _tmFutureLines = []
|
||||
, _tmBootLines = connectionBlurbLines tls
|
||||
, _tmDeathEffect = TmWdWdDoDeathTriggers
|
||||
}
|
||||
|
||||
moveToSideFirstOutLink :: RoomPos -> Room -> Maybe (Point2, Float)
|
||||
moveToSideFirstOutLink rp rm = do
|
||||
0 <- rp ^? rpLinkStatus . rplsChildNum
|
||||
|
||||
@@ -81,8 +81,7 @@ decodeSensorType st w = fromMaybe [] $ do
|
||||
x <- w ^? cWorld . cwGen . cwgParams . sensorCoding . ix st
|
||||
return [makeTermLine $ show x]
|
||||
|
||||
|
||||
-- ugly, when changing check getSensorInfo
|
||||
-- ugly
|
||||
sensorCommand :: World -> Terminal -> PTE.TrieMap Char (PTE.TrieMap Char [TerminalLine])
|
||||
sensorCommand w tm = PTE.singleton "SENSOR" $ fromMaybe mempty $ do
|
||||
ProximitySensor _ d r b <- w ^? cWorld . lWorld . machines . ix (tm ^. tmMachineID) . mcType . _McSensor
|
||||
|
||||
@@ -4,7 +4,6 @@ module Dodge.WorldEffect (
|
||||
doWdWd,
|
||||
accessTerminal,
|
||||
doTmWdWd,
|
||||
lineOutputTerminal,
|
||||
) where
|
||||
|
||||
import Control.Monad
|
||||
@@ -15,13 +14,10 @@ import Dodge.BlBl
|
||||
import Dodge.Creature.Impulse.UseItem
|
||||
import Dodge.Data.Terminal.Status
|
||||
import Dodge.Data.World
|
||||
import Dodge.Default
|
||||
import Dodge.HeldUse
|
||||
import Dodge.Inventory.Lock
|
||||
import Dodge.Item.Grammar
|
||||
--import Dodge.Item.Location
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.Terminal
|
||||
import Dodge.WorldEvent.Cloud
|
||||
import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
@@ -78,18 +74,10 @@ torqueCr x cid w
|
||||
where
|
||||
(rot, g) = randomR (- x, x) $ _randGen w
|
||||
|
||||
lineOutputTerminal :: [TerminalLine] -> Terminal
|
||||
lineOutputTerminal tls =
|
||||
defaultTerminal
|
||||
{ _tmDisplayedLines = []
|
||||
, _tmFutureLines = []
|
||||
, _tmBootLines = connectionBlurbLines tls
|
||||
, _tmDeathEffect = TmWdWdDoDeathTriggers
|
||||
}
|
||||
|
||||
doDeathTriggers :: Terminal -> World -> World
|
||||
doDeathTriggers tm = (cWorld . lWorld . triggers %~ flip (foldl' $ flip doDeathToggle) xs)
|
||||
. (cWorld . lWorld . terminals . ix (tm ^. tmID) . tmStatus .~ TerminalDeactivated)
|
||||
doDeathTriggers tm =
|
||||
(cWorld . lWorld . triggers %~ flip (foldl' $ flip doDeathToggle) xs)
|
||||
. (cWorld . lWorld . terminals . ix (tm ^. tmID) . tmStatus .~ TerminalDeactivated)
|
||||
where
|
||||
xs = M.elems $ _tmToggles tm
|
||||
|
||||
@@ -101,18 +89,7 @@ doTmWdWd tmwdwd = case tmwdwd of
|
||||
TmTmClearDisplayedLines -> \tm -> fromMaybe id $ do
|
||||
tid <- tm ^? tmID
|
||||
return $ cWorld . lWorld . terminals . ix tid . tmDisplayedLines .~ []
|
||||
-- TmGetDamageCoding st -> \tm w -> fromMaybe w $ do
|
||||
-- tid <- tm ^? tmID
|
||||
-- return $
|
||||
-- w & cWorld . lWorld . terminals . ix tid . tmFutureLines
|
||||
-- .~ decodeSensorType st w
|
||||
TmGetSensor s -> \tm w -> fromMaybe w $ do
|
||||
tid <- tm ^? tmID
|
||||
return $ w & cWorld . lWorld . terminals . ix tid . tmFutureLines
|
||||
.~ getSensorInfo w tm s
|
||||
TmTmSetStatus x -> \tm -> fromMaybe id $ do
|
||||
tid <- tm ^? tmID
|
||||
return $ cWorld . lWorld . terminals . ix tid . tmStatus .~ x
|
||||
TmTmSetStatus x -> \tm -> cWorld . lWorld . terminals . ix (tm ^. tmID) . tmStatus .~ x
|
||||
TmWdId -> const id
|
||||
TmWdWdPowerDownTerminal -> powerDownTerminal
|
||||
TmWdWdDeactivateTerminal -> deactivateTerminal
|
||||
@@ -136,17 +113,5 @@ deactivateTerminal tm =
|
||||
|
||||
exitTerminalSubInv :: World -> World
|
||||
exitTerminalSubInv w = case w ^? hud . hudElement . subInventory . termID of
|
||||
Just _ ->
|
||||
w & hud . hudElement . subInventory
|
||||
.~ NoSubInventory --MouseInvNothing
|
||||
Just _ -> w & hud . hudElement . subInventory .~ NoSubInventory
|
||||
_ -> w
|
||||
|
||||
-- ugly, when changing check sensorCommand
|
||||
getSensorInfo :: World -> Terminal -> String -> [TerminalLine]
|
||||
getSensorInfo w tm = \case
|
||||
"REQUIREMENT" -> maybe [] f $ w ^? cWorld . lWorld . machines . ix (tm ^. tmMachineID) . mcType . _McSensor . proxRequirement
|
||||
"DISTANCE" -> maybe [] f $ w ^? cWorld . lWorld . machines . ix (tm ^. tmMachineID) . mcType . _McSensor . proxDist
|
||||
"STATUS" -> maybe [] f $ w ^? cWorld . lWorld . machines . ix (tm ^. tmMachineID) . mcType . _McSensor . sensToggle
|
||||
_ -> []
|
||||
where
|
||||
f s = [makeTermLine $ show s]
|
||||
|
||||
Reference in New Issue
Block a user