{{
function nicolae_spider_jumping_setup(e, dup)
-- The boolean is for whether the vault has the allow_dup tag or not.
-- Z is for marking water tiles that shouldn't be converted to shallow water
-- because they can't be guaranteed to be connected. There will be no teleport
-- closets on my watch.
    e.tags('unrand no_pool_fixup nico_jumpspide transparent')
    if dup then
        e.tags('allow_dup')
    end
    e.mons('jumping spider')
    e.nsubst('1 = 3=1 / 1. / 1.. / .')
    e.subst('w = w:10 W:1')
    e.subst('Z = w')
    e.clear('-')
end
}}


# A series of small islands, separated by water. The player will have their
# mobility hampered by all the deep water, but the jumping spiders have no such
# problems, and will be able to swarm the player.
# It does have exits, but they're in the subvaults.
NAME:     nicolae_spider_jumping_over_cracks
TAGS:     transparent no_exits
DEPTH:    Spider
ORIENT:   float
SUBVAULT: P : nico_jumpspide
SUBVAULT: Q : nico_jumpspide
SUBVAULT: R : nico_jumpspide
SUBVAULT: S : nico_jumpspide
SUBST:    PQRS = -
CLEAR:    -
MAP
     PPPPPQQQQQ
    PPPPPPQQQQQQ
   PPPPPPPQQQQQQQ
  PPPPPPPPQQQQQQQQ
 PPPPPPPPPQQQQQQQQQ
PPPPPPPPPPQQQQQQQQQQ
PPPPPPPPPPQQQQQQQQQQ
PPPPPPPPPPQQQQQQQQQQ
PPPPPPPPPPQQQQQQQQQQ
PPPPPPPPPPQQQQQQQQQQ
RRRRRRRRRRSSSSSSSSSS
RRRRRRRRRRSSSSSSSSSS
RRRRRRRRRRSSSSSSSSSS
RRRRRRRRRRSSSSSSSSSS
RRRRRRRRRRSSSSSSSSSS
 RRRRRRRRRSSSSSSSSS
  RRRRRRRRSSSSSSSS
   RRRRRRRSSSSSSS
    RRRRRRSSSSSS
     RRRRRSSSSS
ENDMAP


# No allow_dup since it's a weird shape.
NAME:   nicolae_spider_jumping_sub_divot
WEIGHT: 5
SUBST:  p = .-
: nicolae_spider_jumping_setup(_G, false)
MAP
w..--
w.1p--
w..p---
wWwp----
..w------
..w-------
.1w--pppp-
wWw-wp.1..
11wwwWwwww
11W...w---
ENDMAP


# No allow_dup since it's a weird shape.
NAME:   nicolae_spider_jumping_sub_empty
WEIGHT: 5
SUBST:  s = w., ! = w1, S = Z-
: nicolae_spider_jumping_setup(_G, false)
MAP
.sS--
1sS---
.sZS---
WwZS----
.sZZS----
1sZZSS----
.sZZZZSS--
WwZZZZZZSS
1!wssswsss
11W.1.W.1.
ENDMAP


NAME:   nicolae_spider_jumping_sub_grid
NSUBST: M = F / w, N = F / w, O = H / w, P = H / w, Q = H / w, R = H / w
NSUBST: F = w / W, H = w / W, p = w / ., q = w / ., r = w / ., s = w / 1
SUBST:  S = w.
: nicolae_spider_jumping_setup(_G, true)
MAP
-wwww
-w.1ww
wwwppR.
wSwppR1.
.SwOOwQQw
1.MqqPrrww
..MqqPrr1w
wFwNNwww.w
ssF.1SSwww
ssw...ww--
ENDMAP


NAME:   nicolae_spider_jumping_sub_lake
WEIGHT: 5
NSUBST: p = . / w, q = . / w, P = W / w, Q = W / w, R = . / s
SUBST:  s = w.
: nicolae_spider_jumping_setup(_G, true)
MAP
-1w.-
.sWsR.
.wwwww1
wWwZZww1
..wZZZww.
.PPwZZZwR-
pP.wwZZws.
wp..QwwwWw
11qQQ.Wws1
11wq..w..-
ENDMAP


NAME:   nicolae_spider_jumping_sub_lanes
SUBST:  s = w.
NSUBST: p = . / w, q = . / w, P = W / w, Q = W / ., R = W / ., S = W / .
: nicolae_spider_jumping_setup(_G, true)
MAP
www--
QQQQQ.
wssss.-
ZZZZwp.-
wsssqWp..
SSSSsqwsR-
wPPPSsZsR-
w11PSsZsRw
111PSsZsRw
11wwSwZwRw
ENDMAP


# No allow_dup since lava is more of a special feature.
NAME:    nicolae_spider_jumping_sub_lava
WEIGHT:  1
SHUFFLE: PQRS
NSUBST:  Q = . / l, R = . / l, S = . / l
SUBST:   P = .
# Clouds are turned off for lava, since obstructing LOS defeats the whole
# point of the vault.
KPROP:   l = no_cloud_gen
: nicolae_spider_jumping_setup(_G, false)
MAP
--www
..W..w
..ww.W-
WwPlllQ-
.wlP1QlWw
..l111lw..
.wlS1Rlw..
WwSlllRwW-
.1.W....w-
..ww..www-
ENDMAP


NAME:   nicolae_spider_jumping_sub_moat
NSUBST: M = N / w, N = w / W, O = W / w, D = W / w, E = W / w, F = 1 / w
: nicolae_spider_jumping_setup(_G, true)
MAP
www--
w.www-
w.1E...
w..E.1.-
wDDww..w-
w.1.wwwww-
w..MMwO.w-
wNwM..O1w-
F1N.1.O.w-
1Fwwwwwwww
ENDMAP


# No allow_dup since it's a weird shape.
NAME:   nicolae_spider_jumping_sub_narrow
WEIGHT: 5
NSUBST: P = w / W, p = w / .
SUBST:  q = Z-
: nicolae_spider_jumping_setup(_G, false)
MAP
----q
----q.
----q..
--qqww1.
ZqwwwWw..
www11wwqqq
p.P11wq---
wPwPwwq---
11P.wq----
w1wpwZ----
ENDMAP


NAME:   nicolae_spider_jumping_sub_notch
NSUBST: M = W / w, F = F / w, NOD = 1=w, DEF = 1=w, Q = w / W
SUBST:  NODEF = W, p = .-
: nicolae_spider_jumping_setup(_G, true)
MAP
ww..w
1Q.1w-
.wQww--
wQ.w----
...w-pppp
.MMww....p
.M..O..1.p
ww..wDwFFw
1WwNw.E..p
11w...w.1p
ENDMAP


# No allow_dup since it can't have guaranteed exits along the rim.
NAME:   nicolae_spider_jumping_sub_no_exit
NSUBST: M = W / w, N = W / w, q = w / 1
SUBST:  D = Z-
: nicolae_spider_jumping_setup(_G, false)
MAP
DDD--
wwww--
w.1www-
wWwW.w--
..w..ww--
wNww1.wZ--
wqqN..www-
wqqwMMw.wD
11Nw..W1ww
w1w...w..w
ENDMAP


NAME:   nicolae_spider_jumping_sub_offset
NSUBST: M = W / w, N = W / w, O = W / w, D = W / w
: nicolae_spider_jumping_setup(_G, true)
MAP
ZZZZ-
wwwww-
w...N.-
ww..N..-
.W.wwOOww
.www1..D..
.W.111.D..
ww..1www..
wWwMMwwww-
.ww...w---
ENDMAP


NAME:   nicolae_spider_jumping_sub_plain
NSUBST: p = . / w, P = W / w, Q = W / w, R = W / w
: nicolae_spider_jumping_setup(_G, true)
MAP
wwwww
w.1.w-
w...ww.
wp...W..
pwPwPww1.
...W.1ww.-
..www..w.-
wQw.R.wwWw
11Q.wRw1.w
11w...w..w
ENDMAP


NAME:   nicolae_spider_jumping_sub_pools
NSUBST: P = w / W, Q = R / w, R = w / W
SUBST:  q = w.
: nicolae_spider_jumping_setup(_G, true)
MAP
1.---
.qP.--
.ww.1--
wPwP.wZ-
q..wwwww-
qqwwq1.w--
ZwwW..qR.-
wwWwQQwwR-
w1ww..Rw1.
111wq.w.qq
ENDMAP


NAME:   nicolae_spider_jumping_sub_rim
SUBST:  p = .-, s = w.
NSUBST: M = F / w, N = F / w, O = F / w, P = F / w, F = w / W, q = w / 1
: nicolae_spider_jumping_setup(_G, true)
MAP
-----
pppp--
s..pp--
wPP.pp--
..Pw.pp--
s.sww.pp--
wMMZww.pp-
wqqNsOO.p-
1qqN..O.p-
11wws.wsp-
ENDMAP


NAME:    nicolae_spider_jumping_sub_shuffled
SHUFFLE: MN
NSUBST:  P = W / w, Q = w / W, R = D / w, D = w / W, q = w / 1
SUBST:   M = ., N = w
: nicolae_spider_jumping_setup(_G, true)
MAP
1..w-
.PPw--
.P..1..
wwNN.wRw
.M.N.R...
.MMwDwDw.-
1..Q...w1-
wQwww.1www
qqQ.wQww--
qqw...w---
ENDMAP


# No allow_dup so the vault won't take more than one staircase.
NAME:   nicolae_spider_jumping_sub_stairs
: if you.depth() == 1 then
SUBST:  S = )}]
: elseif you.depth() ~= dgn.br_depth(you.branch()) then
SUBST:  S = (){}[]
: else
SUBST:  S = ({[
: end
NSUBST: p = . / w, q = w / 1
SUBST:  Q = Z-
: nicolae_spider_jumping_setup(_G, false)
MAP
-QQQQ
QwwwwQ
ww..www
wWp.1.w-
.pwwwWwQ-
1.w...wwwQ
..w.S.w.wQ
wWw...w.wQ
qqwwwww1ww
qqW.1.W...
ENDMAP
