Automatically determine automatic doors
This commit is contained in:
@@ -4,6 +4,7 @@ module Dodge.Placement.Instance.Door (
|
||||
putDoubleDoorThen,
|
||||
) where
|
||||
|
||||
import Linear
|
||||
import Control.Lens
|
||||
import Dodge.Data.CreatureEffect
|
||||
import Dodge.Data.GenWorld
|
||||
@@ -52,7 +53,7 @@ doorBetween ::
|
||||
(Placement -> Maybe Placement) ->
|
||||
Placement
|
||||
doorBetween isauto wl cond soff pa pb speed g = case divideLine 40 pa pb of
|
||||
[x, y] -> ptCont (PutSlideDr isauto adoor wl soff x y) g
|
||||
[x, y] -> ptCont (PutSlideDr adoor wl soff x y) g
|
||||
(x : y : zs) -> divideDoorPane isauto Nothing wl cond (soff - dist y pb) speed (zip (x : y : zs) (y : zs)) g
|
||||
_ -> undefined
|
||||
where
|
||||
@@ -76,7 +77,7 @@ divideDoorPane isauto mid wl cond soff speed ppairs g = case ppairs of
|
||||
(p : ps) -> ptCont (adoor p) $ \pl -> Just $ divideDoorPane isauto (_plMID pl) wl cond soff speed ps g
|
||||
_ -> undefined
|
||||
where
|
||||
adoor (x, y) = PutSlideDr isauto thedoor wl soff x y
|
||||
adoor (x, y) = PutSlideDr thedoor wl soff x y
|
||||
thedoor =
|
||||
defaultDoor & drUpdate . drLerpSpeed .~ speed & drTrigger .~ cond
|
||||
& drPushedBy .~ maybe PushesItself PushedBy mid
|
||||
@@ -88,9 +89,10 @@ putAutoDoor a b = Placement (PS 0 0) (PutCoord a) Nothing Nothing $ \_ apl ->
|
||||
let x = w ^?! gwWorld . coordinates . ix (apl ^?! plMID . _Just)
|
||||
y = w ^?! gwWorld . coordinates . ix (bpl ^?! plMID . _Just)
|
||||
in Just $
|
||||
putDoubleDoor True
|
||||
putDoubleDoor
|
||||
True
|
||||
defaultAutoWall
|
||||
(WdBlCrFilterNearPoint 40 (0.5 *.* (x + y)) CrIsAnimate)
|
||||
(WdBlCrFilterNearPoint 40 (0.5 *^ (x + y)) CrIsAnimate)
|
||||
a
|
||||
b
|
||||
3
|
||||
|
||||
Reference in New Issue
Block a user