Cleanup
This commit is contained in:
@@ -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