Cleanup terminal display
This commit is contained in:
+22
-18
@@ -53,26 +53,30 @@ addWarningTerminal outplid = (rmName .++~ "warningTerm-")
|
||||
where
|
||||
outplace = extTrigLitPos
|
||||
(atFstLnkOutShiftBy (\(p,a) -> (p +.+ rotateV a (V2 18.5 (-2.5)), a)))
|
||||
(Just . set plSpot (rprShift fps) . putTerminal . termMessages)
|
||||
--termspot = atFstLnkOutShiftBy (\(p,a) -> (p +.+ rotateV a (V2 18.5 (-2.5)), a))
|
||||
fps rp rm = case rp ^? rpLinkStatus . rplsChildNum of
|
||||
Just 0 ->
|
||||
let rppos = _rpPos rp
|
||||
rpdir = _rpDir rp
|
||||
inpos = rppos +.+ rotateV rpdir (V2 0 (-12.5))
|
||||
rtpos = inpos +.+ rotateV rpdir (V2 30 0)
|
||||
ltpos = inpos +.+ rotateV rpdir (V2 (-30) 0)
|
||||
in if any (isJust . intersectSegPolyFirst inpos ltpos) (_rmPolys rm)
|
||||
-- the above test may not work properly if the room polys are
|
||||
-- complicated, it should really use created walls...
|
||||
then Just (rtpos, rpdir)
|
||||
else Just (ltpos, rpdir)
|
||||
_ -> Nothing
|
||||
termMessages trid = ops trid (genTermMessage $ const ["OPEN DOOR?"])
|
||||
ops trid f gw w = f gw w & termFutureLines ++.~ [ TerminalLineInput 0
|
||||
(Just . set plSpot (rprShift moveToSideFirstOutLink) . putTerminal . termMessages)
|
||||
termMessages trid _ = defaultTermParams & addInputLine
|
||||
[unlockCommand trid,quitCommand]
|
||||
[helpCommand,infoCommand theinfo,commandsCommand]
|
||||
]
|
||||
--termMessages trid = ops trid (genTermMessage $ const ["OPEN DOOR?"])
|
||||
--ops trid f gw w = f gw w & termFutureLines ++.~ [ TerminalLineInput 0
|
||||
-- [unlockCommand trid,quitCommand,damageCodeCommand]
|
||||
-- [helpCommand,infoCommand theinfo,commandsCommand]
|
||||
-- ]
|
||||
unlockCommand trid = singleCommand "OPEN" ["YES","Y"] "OPEN THE CONNECTED DOOR." (toggledoor trid)
|
||||
toggledoor trid w' = w' & triggers . ix (fromJust $ _plMID trid) .~ const True
|
||||
theinfo = "DOOR CONTROLABLE WITH THE \"OPEN\" COMMAND. THIS TERMINAL CANNOT CLOSE THE DOOR."
|
||||
|
||||
moveToSideFirstOutLink :: RoomPos -> Room -> Maybe (Point2,Float)
|
||||
moveToSideFirstOutLink rp rm = case rp ^? rpLinkStatus . rplsChildNum of
|
||||
Just 0 ->
|
||||
let rppos = _rpPos rp
|
||||
rpdir = _rpDir rp
|
||||
inpos = rppos +.+ rotateV rpdir (V2 0 (-12.5))
|
||||
rtpos = inpos +.+ rotateV rpdir (V2 30 0)
|
||||
ltpos = inpos +.+ rotateV rpdir (V2 (-30) 0)
|
||||
in if any (isJust . intersectSegPolyFirst inpos ltpos) (_rmPolys rm)
|
||||
-- the above test may not work properly if the room polys are
|
||||
-- complicated, it should really use created walls...
|
||||
then Just (rtpos, rpdir)
|
||||
else Just (ltpos, rpdir)
|
||||
_ -> Nothing
|
||||
|
||||
Reference in New Issue
Block a user