Browse Source

emergency commit -- wip

head
Mia 7 months ago
parent
commit
7db6d0e2cd
No known key found for this signature in database
GPG Key ID: 71C6B366DD22D9B5
  1. 5
      gen.env
  2. 15
      rbase
  3. 273
      rgrid

5
gen.env

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
# listgen() makes use of this; should allow for simpler configuation of rng
types="door;swall;topwall;corner;blank;floor" # these are all the defined types
mndoor="2"
types="sdoor;topdoor;swall;topwall;corner;blank;floor" # these are all the defined types
mnsdoor="2"
mntopdoor="2"
mnswall="10"
mntopwall="10"
mncorner="1"

15
rbase

@ -39,13 +39,20 @@ EOF @@ -39,13 +39,20 @@ EOF
# -- rparse should allow for ?+1 arguments to be given thanks to the usage of `shift`
# index of some assests
export blank=' '
export swall='#' # 1x1 block of 3's
export door='|' # 1x1 block of |'s
export sdoor='|' # 1x1 block of |'s
export topdoor='━' # 1x1 block of ─
export corner='+' # 1x1 block of +'s
export topwall='=' # 1x1 block of ='s # rparse
export swall='#' # 1x1 block of #
export topwall='═' # 1x1 block of ═
export path='' # 1x1 path block
export floor='' # 1x1 floor block
#export floor='m'
# example:
# +════━══════+
# # #
# | #
# # #
# # #
# +═══════════+
# dash has issues with unicode
. ${RPATH:-.}/env # env file is used for various rendering data as well as the term size # user should manually configure this
IFS="x"; set -- ${MAX_ROOM_SIZE}; export ML="$1"; export MC="$2"

273
rgrid

@ -21,7 +21,7 @@ listgen(){ # generate typelist @@ -21,7 +21,7 @@ listgen(){ # generate typelist
# gen.env now handles max counter's
# how many times they /SHOULD/ appear in the list
ndoor=0;nswall=0;ntopwall=0;ncorner=0;nblank=0;nfloor=0 # set all counters to 0
nsdoor=0;nswall=0;ntopwall=0;ncorner=0;nblank=0;nfloor=0 # set all counters to 0
IFS=";"; tln=0; for i in ${types}; do # produce a number stating how many should be in the list
: $((tln+=$(printf 'mn%s' "$i")))
done
@ -63,25 +63,29 @@ listgen(){ # generate typelist @@ -63,25 +63,29 @@ listgen(){ # generate typelist
: $((nswall+=1))
[ $nswall -eq $mnswall ] && types=$(listr "swall" "${types}" ";")
;; # wall
door)
typelist="${typelist+$typelist;}door"
: $((ndoor+=1))
[ $ndoor -eq $mndoor ] && types=$(listr "door" "${types}" ";")
;; # door
topdoor)
typelist="${typelist+$typelist;}topdoor"
: $((ntopdoor+=1))
[ $ntopdoor -eq $mntopdoor ] && types=$(listr "topdoor" "${types}" ";")
;; # topdoor
sdoor)
typelist="${typelist+$typelist;}sdoor"
: $((nsdoor+=1))
[ $nsdoor -eq $mnsdoor ] && types=$(listr "sdoor" "${types}" ";")
;; # sdoor
esac # this is simply faster than a loop
done
printf 'new typelist: %s\n' "$typelist" >> ./debug
unset IFS
}
clist() { # correct errors in typelist
IFS=";"; unset typelist
clist() { # correct errors and edge cases in typelist
IFS=";"
[ ! "${#1}" -gt 1 ] && {
printf 'empty typelist!!! -- ' >> ./debug
case "$vpos" in
?"b +"?) inchance "blank" "2" ";" ;;
?"= "??) typelist=$(listr "blank" "${typelist}" ";") ;;
?"b c"?) inchance "blank" "2" ";" ;;
?"t "??) typelist=$(listr "blank" "${typelist}" ";") ;;
*)
printf 'COULD NOT CORRECT...\n' >> ./debug
printf 'pos: %s | original typelist: %s\n' "$vpos & $vdpos" "$otypelist" >> ./debug
@ -90,39 +94,78 @@ clist() { # correct errors in typelist @@ -90,39 +94,78 @@ clist() { # correct errors in typelist
printf 'corrected...\n' >> ./debug
}
case "$vpos" in
?'= '??|?'+ '??) : ;;
?'t '??|?'c '??) : ;;
??" f"?) inchance "floor" "5" ";"
case "$vpos" in
??" f=") typelist=$(listr "blank" "${typelist}" ";")
??" ft") typelist=$(listr "blank" "${typelist}" ";")
esac ;;
esac
case "$vpos" in
??" =-"|?"f =b"|"f+ "??) typelist=$(listr "blank" "${typelist}" ";")
??" t-"|?"f tb"|"fc "??) typelist=$(listr "blank" "${typelist}" ";")
esac
case "$vpos" in
?"= "??) typelist=$(listr "floor" "${typelist}" ";")
?"t "??|?"_ "??) typelist=$(listr "floor" "${typelist}" ";")
esac
case "$vpos" in
?"= f+") inchance "corner" "3" ";" ;; # end walls in corners
?"t fc") inchance "corner" "3" ";" ;; # end walls in corners
esac
case "$vpos" in
?"f f"?) inchance "floor" "3" ";"
esac
[ "$c" -gt $((COLUMNS-4 -2)) ] && {
printf '@%s & %s | border close...' "$vpos" "$vdpos" >> ./debug
case "$vpos" in
"bf "??) typelist=$(listr "corner" "${typelist}" ";")
esac
case "$vpos" in
?"f _"?) typelist=$(listr "blank" "${typelist}" ";")
esac
case "$vpos" in
?"t "??)
[ $(inlist "swall" "${typelist}") = ':' ] && {
inchance "corner" "2" ";"
typelist=$(listr "swall" "${typelist}" ";")
}
esac
case "$vpos" in
"ct "??) typelist=$(listr "corner" "${typelist}" ";")
esac
case "$vpos" in
??" #"?) typelist=$(listr "topdoor" "${typelist}" ";")
esac
case "$vpos" in
?"f _"?) inchance "floor" "1" ";"
esac
case "$vpos" in
?"t #"?) inchance "corner" "1" ";"
esac
# BORDER CASE
if [ "$c" -gt $((COLUMNS-10 -2)) ]; then
typelist=$(listr "topdoor" "${typelist}" ";")
case "$vpos" in
?"= "??)
?"t "??)
typelist=$(listr "topwall" "${typelist}" ";")
inchance "corner" "2" ";";;
?"b "??)
typelist=$(listr "corner" "${typelist}" ";") ;;
?"f #"?|?"f +"?)
?"f #"?|?"f c"?)
inchance "swall" "2" ";"
inchance "corner" "2" ";" ;;
esac
}
fi
# EMPTY CASE
case "$vpos" in
?"f c"?)
[ "${#typelist}" -le 1 ] && {
inchance "swall" "5" ";"
inchance "floor" "3" ";"
inchance "blank" "1" ";"
} || : ;;
?"t c"?|"t d"?)
[ "${#typelist}" -le 1 ] && {
inchance "corner" "1" ";"
} || : ;;
esac # ignore BORDER case if typelist is empty
for i in ${1}; do
for i in ${typelist}; do
[ "${#i}" -gt 1 ] && {
typelist="${typelist+${typelist};}$i"
}
@ -141,18 +184,18 @@ clist() { # correct errors in typelist @@ -141,18 +184,18 @@ clist() { # correct errors in typelist
}
sgrid() { # print $1 # $3 l $2 c
case "$1" in
'=') topwallc=$((${topwallc:-0}+1)) ;;
'#'|'|') swallc=$((${swallc:-0}+1)); [ "$((swallc%2))" -eq 0 -a "$swallc" -ge 2 ] && swallc=$((swallc/2)) ;;
'+') unset topwallc; unset swallc ;;
't'|'_') topwallc=$((${topwallc:-0}+1)) ;;
'#'|'d') swallc=$((${swallc:-0}+1)); [ "$((swallc%2))" -eq 0 -a "$swallc" -ge 2 ] && swallc=$((swallc/2)) ;;
'c') unset topwallc; unset swallc ;;
' ') unset room
esac # counter logic
# DEBUG
printf 'list length: %s | pos: %s | l %s c %s | room: %s ' "$tln" "$vpos & $vdpos" "$l" "$c" "${room:-false}" >> ./debug
case "$1" in
'=') printf '| topwall counter: %s ' "${topwallc:-0}" >> ./debug ;;
't') printf '| topwall counter: %s ' "${topwallc:-0}" >> ./debug ;;
'#'|'|') printf '| wall counter: %s ' "${swallc:-0}" >> ./debug
esac
[ "$1" != "#" -a "$1" != "|" -a "$room" ] && printf '| wall counter: %s ' "${swallc:-0}" >> ./debug
[ "$1" != "#" -a "$1" != "d" -a "$room" ] && printf '| wall counter: %s ' "${swallc:-0}" >> ./debug
printf '| typelist: %s | picked #%s (' "$typelist" "$ran" >> ./debug
printf '%s)\n' "$1" >> ./debug; [ "$FILE" ] || printf '%s' "$1" >> state
eval $(printf 'l%sc%s="%s"' "$3" "$2" "$1")
@ -177,7 +220,7 @@ listr() { # create a new typelist using the items in $2; MUST not contain $1 @@ -177,7 +220,7 @@ listr() { # create a new typelist using the items in $2; MUST not contain $1
echo "$2"; return # listr always runs in a subshell -- thus this exit will NOT close $0
} || { # if inlist returns '!' do nothing and exit
for i in ${2}; do
[ "$i" != "$1" ] && {
[ "$i" != "$1" -a "${#i}" -gt 1 ] && {
o="${o+${o};}$i"
}
done
@ -208,6 +251,7 @@ listSz(){ # list ($1) size; uses $2 as IFS or unset @@ -208,6 +251,7 @@ listSz(){ # list ($1) size; uses $2 as IFS or unset
echo "$n"
unset IFS
}
## POS
# if there are 4 items in $1/$typelist this will return `1`
pos() { # $1 l $2 c # case statements are present to replace spaces or unicode
oIFS="${IFS}"; IFS=""
@ -217,6 +261,11 @@ pos() { # $1 l $2 c # case statements are present to replace spaces or unicode @@ -217,6 +261,11 @@ pos() { # $1 l $2 c # case statements are present to replace spaces or unicode
case "$(eval $(printf 'printf $l%sc%s' "$(($1-1))" "$2") 2>/dev/null)" in
"${blank}") A="b" ;;
"${floor}") A="f" ;;
"${topwall}") A="t" ;;
"${corner}") A="c" ;;
"${sdoor}") A="d" ;;
"${topdoor}") A='_' ;;
"${swall}") A="#" ;;
*) A="$(eval $(printf 'printf $l%sc%s' "$(($1-1))" "$2") 2>/dev/null)$A"
esac
if [ "$1" -eq 4 ]; then
@ -225,6 +274,11 @@ pos() { # $1 l $2 c # case statements are present to replace spaces or unicode @@ -225,6 +274,11 @@ pos() { # $1 l $2 c # case statements are present to replace spaces or unicode
case "$(eval $(printf 'printf $l%sc%s' "$(($1-2))" "$2") 2>/dev/null)" in
"${blank}") A="${A}b" ;;
"${floor}") A="${A}f" ;;
"${topwall}") A="${A}t" ;;
"${corner}") A="${A}c" ;;
"${sdoor}") A="${A}d" ;;
"${topdoor}") A="${A}_" ;;
"${swall}") A="${A}#" ;;
*) A="$A$(eval $(printf 'printf $l%sc%s' "$(($1-2))" "$2") 2>/dev/null)"
esac
fi
@ -235,6 +289,11 @@ pos() { # $1 l $2 c # case statements are present to replace spaces or unicode @@ -235,6 +289,11 @@ pos() { # $1 l $2 c # case statements are present to replace spaces or unicode
case "$(eval $(printf 'printf $l%sc%s' "$1" "$(($2-1))") 2>/dev/null)" in
"${blank}") L="b" ;; # replace ' ' (blank) with b
"${floor}") L="f" ;;
"${topwall}") L="t" ;;
"${corner}") L="c" ;;
"${sdoor}") L="d" ;;
"${topdoor}") L='_' ;;
"${swall}") L="#" ;;
*) L="$(eval $(printf 'printf $l%sc%s' "$1" "$(($2-1))") 2>/dev/null)"
esac
if [ "$2" -eq 4 ]; then
@ -243,6 +302,11 @@ pos() { # $1 l $2 c # case statements are present to replace spaces or unicode @@ -243,6 +302,11 @@ pos() { # $1 l $2 c # case statements are present to replace spaces or unicode
case "$(eval $(printf 'printf $l%sc%s' "$1" "$(($2-2))") 2>/dev/null)" in
"${blank}") L="b$L" ;;
"${floor}") L="f$L" ;;
"${topwall}") L="t$L" ;;
"${corner}") L="c$L" ;;
"${sdoor}") L="d$L" ;;
"${topdoor}") L="_$L" ;;
"${swall}") L="#$L" ;;
*) L="$(eval $(printf 'printf $l%sc%s' "$1" "$(($2-2))") 2>/dev/null)$L"
esac
fi
@ -257,11 +321,21 @@ dpos() { # diagonal pos # $1 l $2 c @@ -257,11 +321,21 @@ dpos() { # diagonal pos # $1 l $2 c
case "$(eval $(printf 'printf $l%sc%s' "$(($1-1))" "$(($2+1))") 2>/dev/null)" in
"${blank}") R=b ;;
"${floor}") R=f ;;
"${topwall}") R=t ;;
"${corner}") R=c ;;
"${sdoor}") R=d ;;
"${topdoor}") R='_' ;;
"${swall}") R='#' ;;
*) R="$(eval $(printf 'printf $l%sc%s' "$(($1-1))" "$(($2+1))") 2>/dev/null)"
esac
case "$(eval $(printf 'printf $l%sc%s' "$(($1-1))" "$(($2-1))") 2>/dev/null)" in
"${blank}") L=b ;;
"${floor}") L=f ;;
"${topwall}") L=t ;;
"${corner}") L=c ;;
"${sdoor}") L=d ;;
"${topdoor}") L='_' ;; # topdoors will use `_` as their non unicode case charaecter
"${swall}") L='#' ;;
*) L="$(eval $(printf 'printf $l%sc%s' "$(($1-1))" "$(($2-1))") 2>/dev/null)"
esac
fi
@ -288,7 +362,7 @@ cont() { # continue reading from a state file -- given as $1 or `-` for STDIN @@ -288,7 +362,7 @@ cont() { # continue reading from a state file -- given as $1 or `-` for STDIN
oIFS="${IFS}"; IFS=""; #l=3
: $((l-=1))
while read -r p || [ -n "$p" ]; do
c=3; vdpos="$(dpos $l $c)"; vpos="$(pos $l $c)"
c=3; vdpost"$(dpos $l $c)"; vpost"$(pos $l $c)"
: $((l+=1)); [ "$l" -gt 3 ] && {
echo; [ "$c" -eq $((COLUMNS-2)) ] || c=1
bord; [ "$bord" ] && {
@ -298,10 +372,10 @@ cont() { # continue reading from a state file -- given as $1 or `-` for STDIN @@ -298,10 +372,10 @@ cont() { # continue reading from a state file -- given as $1 or `-` for STDIN
printf ' '
}
while [ "$p" ]; do
next="${p#?}" # current is ${p%$next}
nextt"${p#?}" # current is ${p%$next}
sgrid "${p%$next}" "$c" "$l"
: $((c+=1))
p="${next}"; unset next
pt"${next}"; unset next
done
done
export Fc=$c
@ -352,33 +426,36 @@ EOF @@ -352,33 +426,36 @@ EOF
##D
diapos() {
case "$vdpos" in
?' +'|'+ '?|?' #')
?' c'|'c '?|?' #')
typelist=$(listr "corner" "${typelist}" ";") ;;
??'b'|??' ')
case "$vpos" in
?'b '??)
typelist=$(listr "door" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
typelist=$(listr "swall" "${typelist}" ";")
esac; : ;;
??'|')
??'d')
typelist=$(listr "corner" "${typelist}" ";")
esac
case "$vdpos" in
??'f'|'f'??)
case "$vpos" in
??" b"?) inchance "corner" "4" ";"
??" b"?) inchance "swall" "6" ";"
esac
esac
case "$vdpos" in
'# '?) typelist=$(listr "corner" "${typelist}" ";")
esac
}
##R
roompos() {
case "$vdpos $vpos" in
?' '?' '?'= '??|?????'b '??)
?' '?' '?'t '??|?????'b '??)
unset room
case "$vpos" in
??" f"?) room="true"
esac ;;
'+ '????' ='?|'+ '???'+ '??|'= '???'b '??|?????"f ="?|??????" f"?|?" f "??' b'?|?" f "??' +'?|?" f "??' ='?|?' = '?"f "??|?????"| ="?)
'c '????' t'?|'c '???'c '??|'t '???'b '??|?????"f t"?|??????" f"?|?" f "??' b'?|?" f "??' c'?|?" f "??' t'?|?' t '?"f "??|?????"| t"?)
room="true" ;;
*)
unset room
@ -387,48 +464,58 @@ roompos() { @@ -387,48 +464,58 @@ roompos() {
##B
sidepos() {
case "$vpos" in # ? is any /single/ char
"f+ "??)
"fc "??)
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "floor" "${typelist}" ";") && unset room
typelist=$(listr "blank" "${typelist}" ";")
typelist=$(listr "corner" "${typelist}" ";") ;;
"#f "??|"|f "??|"+f "??)
"#f "??|"df "??|"cf "??)
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "blank" "${typelist}" ";")
typelist=$(listr "door" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
typelist=$(listr "swall" "${typelist}" ";")
typelist=$(listr "topwall" "${typelist}" ";")
typelist=$(listr "corner" "${typelist}" ";") ;;
"b| "??)
inchance "floor" "3" ";"
"bd "??)
inchance "floor" "1" ";"
typelist=$(listr "blank" "${typelist}" ";")
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "corner" "${typelist}" ";")
typelist=$(listr "topwall" "${typelist}" ";") ;;
?"| "??)
?"d "??)
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "corner" "${typelist}" ";")
typelist=$(listr "topwall" "${typelist}" ";") ;;
"+b "??)
"cb "??)
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "topwall" "${typelist}" ";")
typelist=$(listr "door" "${typelist}" ";") ;;
"b+ "??)
typelist=$(listr "door" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";") ;;
"bc "??)
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
typelist=$(listr "corner" "${typelist}" ";")
typelist=$(listr "blank" "${typelist}" ";") ;;
?"b "??|?"f "??|"ff "??)
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "topwall" "${typelist}" ";") ;;
"=+ "??)
"tc "??)
inchance "blank" "3" ";"
typelist=$(listr "door" "${typelist}" ";")
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
typelist=$(listr "corner" "${typelist}" ";")
typelist=$(listr "swall" "${typelist}" ";") ;;
?"+ "??)
?"c "??)
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "blank" "${typelist}" ";")
typelist=$(listr "door" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
typelist=$(listr "corner" "${typelist}" ";")
typelist=$(listr "swall" "${typelist}" ";")
typelist=$(listr "swall" "${typelist}" ";")
[ "$c" -eq $COLUMNS ] && {
typelist=$(listr "topwall" "${typelist}" ";")
} || : ;;
# corner logic
?"= "??)
typelist=$(listr "door" "${typelist}" ";")
?"t "??|?"_ "??)
typelist=$(listr "sdoor" "${typelist}" ";")
typelist=$(listr "blank" "${typelist}" ";")
[ "$topwallc" -a "${topwallc:-0}" -gt "$MC" ] && { # $MC is max columns (length) -- see rbase
typelist=$(listr "topwall" "${typelist}" ";")
@ -438,31 +525,41 @@ sidepos() { @@ -438,31 +525,41 @@ sidepos() {
typelist=$(listr "corner" "${typelist}" ";")
}
}
case "$vpos" in
?"_ "??)
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "corner" "${typelist}" ";") ;;
"_t "??) typelist=$(listr "topdoor" "${typelist}" ";")
esac
typelist=$(listr "floor" "${typelist}" ";")
inchance "topwall" "3" ";" ;; # increase the chance of topwall
# topwall logic
"b# "??)
room="true"; inchance "floor" "3" ";"
typelist=$(listr "door" "${typelist}" ";")
room="true"; inchance "floor" "1" ";"
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
typelist=$(listr "blank" "${typelist}" ";")
typelist=$(listr "corner" "${typelist}" ";")
typelist=$(listr "topwall" "${typelist}" ";")
typelist=$(listr "swall" "${typelist}" ";") ;;
?"# "??|"#"?" "??)
typelist=$(listr "door" "${typelist}" ";")
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
typelist=$(listr "corner" "${typelist}" ";")
typelist=$(listr "topwall" "${typelist}" ";")
typelist=$(listr "swall" "${typelist}" ";") ;;
?"- "??)
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "topwall" "${typelist}" ";")
esac
}
##A
apos() {
case "$vpos" in
??" ++")
??" cc")
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "corner" "${typelist}" ";")
typelist=$(listr "door" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
typelist=$(listr "swall" "${typelist}" ";") ;;
??" #"?)
[ "${swallc:-0}" -lt $((MiL+1)) ] && {
@ -470,7 +567,7 @@ apos() { @@ -470,7 +567,7 @@ apos() {
} || inchance "corner" "2" ";"
[ "${swallc:-0}" -gt $ML ] && typelist=$(listr "swall" "${typelist}" ";")
case "$vpos" in
??" #+") typelist=$(listr "corner" "${typelist}" ";")
??" #c") typelist=$(listr "corner" "${typelist}" ";")
esac
case "$vpos" in
?"b "??) : ;;
@ -479,66 +576,72 @@ apos() { @@ -479,66 +576,72 @@ apos() {
esac
[ "$(inlist wall "${typelist}")" = ":" ] && inchance "swall" "4" ";"
typelist=$(listr "topwall" "${typelist}" ";") ;;
??" |"?)
??" d"?)
inchance "swall" "2" ";"
[ "${swallc:-0}" -lt $((MiL+1)) ] && {
typelist=$(listr "corner" "${typelist}" ";")
}
[ "${swallc:-0}" -gt $ML ] && typelist=$(listr "swall" "${typelist}" ";")
typelist=$(listr "topwall" "${typelist}" ";")
typelist=$(listr "door" "${typelist}" ";")
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
typelist=$(listr "blank" "${typelist}" ";") ;;
??" bb")
typelist=$(listr "door" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
typelist=$(listr "swall" "${typelist}" ";") ;;
??" ="?|??" f"?)
??" t"?|??" f"?|??" _"?)
case "$vpos" in
??" ff"|?"+ ff"|"+= ff"|"== ff"|?"+ +f"|"+= +f"|"== +f") : ;;
??" ff"|?"c ff"|"ct ff"|"tt ff"|?"c cf"|"ct cf"|"tt cf"|"c_ cf"|"t_ cf"|"t_ ff"|"_t ff") : ;;
*)
typelist=$(listr "corner" "${typelist}" ";")
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "topwall" "${typelist}" ";")
inchance "blank" "2" ";"
esac
typelist=$(listr "swall" "${typelist}" ";")
typelist=$(listr "door" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
case "$vpos" in
?"+ =b") typelist=$(listr "blank" "${typelist}" ";")
?"c tb") typelist=$(listr "blank" "${typelist}" ";")
esac
case "$vpos" in
?"= "??) : ;;
?"t "??) : ;;
??" f"?) inchance "floor" "4" ";"
esac ;;
??" b"?)
typelist=$(listr "door" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
typelist=$(listr "swall" "${typelist}" ";") ;;
??" +-"|??" +b")
??" c-"|??" cb")
case "$vpos" in
'#'????|?'# '??|?'| '??) typelist=$(listr "swall" "${typelist}" ";") ;; # cannot be wall if wall is 2 blocks over
?"b "??|?"f "??)
inchance "swall" "2" ";"
esac
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "topwall" "${typelist}" ";")
typelist=$(listr "corner" "${typelist}" ";")
typelist=$(listr "blank" "${typelist}" ";") ;;
??" +"?)
??" c"?)
case "$vpos" in
'#'????|?'# '??|?'| '??|"|f "??) typelist=$(listr "swall" "${typelist}" ";") ;; # cannot be wall if wall is 2 blocks over
'#'????|?'# '??|?'d '??|"df "??) typelist=$(listr "swall" "${typelist}" ";") ;; # cannot be wall if wall is 2 blocks over
?"b "??|?"f "??)
inchance "swall" "3" ";"
esac
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "topwall" "${typelist}" ";")
typelist=$(listr "corner" "${typelist}" ";") ;;
??" ="?|??" b=")
??" t"?|??" bt")
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "topwall" "${typelist}" ";")
typelist=$(listr "swall" "${typelist}" ";")
typelist=$(listr "corner" "${typelist}" ";")
typelist=$(listr "door" "${typelist}" ";") ;;
typelist=$(listr "sdoor" "${typelist}" ";") ;;
??" -"?)
typelist=$(listr "door" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
typelist=$(listr "swall" "${typelist}" ";")
esac
}
[ "$FILE" ] || :>./state
[ "$FILE" ] || :>./state
## LOOP
ml=0; for l in $(s 1 $LINES); do # for each line
[ "$l" -gt 3 ] && printf '\n' >> ./state
mc=0; for c in $(s 1 $COLUMNS); do # left to right across screen
@ -557,6 +660,7 @@ ml=0; for l in $(s 1 $LINES); do # for each line @@ -557,6 +660,7 @@ ml=0; for l in $(s 1 $LINES); do # for each line
typelist="$otypelist"
} || {
listgen; otypelist="$typelist"
otypelist=$(listr "floor" "${otypelist}" ";")
}
@ -570,10 +674,10 @@ ml=0; for l in $(s 1 $LINES); do # for each line @@ -570,10 +674,10 @@ ml=0; for l in $(s 1 $LINES); do # for each line
# generate the typelist
# basically the idea here is have a list of all possible things a 1x1 space can be
# wall,door,blank,etc; these are ofc effected by the blocks around them and the current pos
# wall,sdoor,blank,etc; these are ofc effected by the blocks around them and the current pos
# basically use ran() and some pain to have it pick what a block should be
# the list should be dynamic based on the pos and blocks around it
# ie; placing a door when there is no where for it to lead makes no sense
# ie; placing a sdoor when there is no where for it to lead makes no sense
if [ "$l3c3" ]; then # counter logic is handled in sgrid() as items are handed off to it after being picked
#printf 'start positional logic...\n' >> ./debug
# do logic if indexes are set
@ -589,7 +693,7 @@ ml=0; for l in $(s 1 $LINES); do # for each line @@ -589,7 +693,7 @@ ml=0; for l in $(s 1 $LINES); do # for each line
## BELOW/ABOVE
apos
case "$vpos" in
?'= #'?|?'= |'?|?'= +'?|?'+ #'?|?'+ +'?)
?'t #'?|?'t d'?|?'t c'?|?'c #'?|?'c c'?)
typelist=$(listr "swall" "${typelist}" ";")
inchance "corner" "2" ";"
esac
@ -599,11 +703,11 @@ ml=0; for l in $(s 1 $LINES); do # for each line @@ -599,11 +703,11 @@ ml=0; for l in $(s 1 $LINES); do # for each line
## FLOOR
[ "$room" ] && {
case "$vpos" in
?"b =f"|"f# =f") inchance "blank" "2" ";" ;;
?"b tf"|"f# tf") inchance "blank" "2" ";" ;;
*)
typelist=$(listr "blank" "${typelist}" ";")
case "$vpos" in
?"= "??) : ;;
?"t "??) : ;;
*) inchance "floor" "5" ";"
esac
esac
@ -615,17 +719,18 @@ ml=0; for l in $(s 1 $LINES); do # for each line @@ -615,17 +719,18 @@ ml=0; for l in $(s 1 $LINES); do # for each line
else # below may run if last exit code is !0 and not handled
typelist=$(listr "topdoor" "${typelist}" ";")
typelist=$(listr "floor" "${typelist}" ";")
typelist=$(listr "door" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
typelist=$(listr "topwall" "${typelist}" ";")
typelist=$(listr "swall" "${typelist}" ";")
[ "$l" -gt 3 ] && {
printf 'failed to preform positional logic... $l3c3 likely unset\n' >> ./debug
}
fi
[ "$c" -le 3 -o "$l" -lt 2 ] && { # must be at least 3 over on C to create a door
[ "$c" -le 3 -o "$l" -lt 2 ] && { # must be at least 3 over on C to create a sdoor
# must also be at least 1 L down; this should also be effected by the surrounding blocks
typelist=$(listr "door" "${typelist}" ";")
typelist=$(listr "sdoor" "${typelist}" ";")
}
clist "${typelist}" # correct any errors in the list

Loading…
Cancel
Save