Files
assaultcube-/config/prefabs.cfg
T
ac-stef a291b74504 take measurements to create arch prefabs from existing maps
The arch menu now allows

 * editing all vertices instead of only half of them, for non-symmetrical
   arches
 * deleting saved custom arches
 * using custom arches for other widths than what they were created for
 * measuring an arch on a map and creating a prefab of it

Scripts:

av_measure

  "echo (av_measure)" prints the list of vdelta values of a selected arch.
  Only works as expected, if the selection is only 1 cube wide. To use the
  measurements to create a width 8 arch, select 8x1 cubes under the arch
  to copy and type "av 8 (av_measure)". Or use the menu.

av width-1 vdelta_list

  One of the oldest scripts of the game (and because of that, the first
  argument stayed "arch width minus one", for compatibility reasons).
  Creates a prefab arch of the desired width. If the list has exactly
  as many entries as required, all of them are used to create the prefab -
  this is the way the script has always worked.
  If there are too few or too many elements in the list, the script will
  try to take half the required values from the list and mirror the other
  half to create a symmetrical arch. This way, a list can be used for
  slightly wider or narrower archs. Or use the menu.
2016-09-18 00:22:27 +02:00

50 lines
1.4 KiB
INI

// this cfg defines the shapes of heightfield prefabs, i.e. arches and such
// arch of 2xN cubes, i.e. 3 vertices [0..2]
// archvertex <cubespan> <vertex> <delta>
// vertices not defined have a 0 delta
persistidents 0
const av [
push vn (+ $arg1 1)
if (= (listlen $arg2) $arg1) [
loop i $arg1 [
archvertex $vn (+ $i 1) (at $arg2 $i)
]
][
loop i (div $vn 2) [
archvertex $vn (+ $i 1) (at $arg2 $i)
archvertex $vn (- $vn (+ $i 1)) (at $arg2 $i)
]
]
pop vn
]
av 1 "2"
av 2 "4 4"
av 3 "5 6 5"
av 4 "5 6 6 5"
av 5 "5 7 8 7 5"
av 6 "5 7 8 8 7 5"
av 7 "7 11 13 14 13 11 7"
av 8 "7 11 13 14 14 13 11 7"
av 9 "7 11 13 14 14 14 13 11 7"
av 10 "7 11 13 14 14 14 14 13 11 7"
av 11 "8 13 16 18 19 19 19 18 16 13 8"
av 12 "8 13 16 18 19 19 19 19 18 16 13 8"
av 13 "8 13 16 18 19 19 19 19 19 18 16 13 8" // these last few can be improved
av 14 "8 13 16 18 19 19 19 19 19 19 18 16 13 8"
av 15 "8 13 16 18 19 19 19 19 19 19 19 18 16 13 8"
// add wider arches here! :)
const av_measure [
push ii ""
selectionwalk [ ii = (concat $ii $sw_vdelta) ] [ if (&& (!= (at $sw_cursel 2) 1) (!= (at $sw_cursel 3) 1)) [ echo "using wide selections may lead to weird measurements..."] ]
push offs (at $ii 0)
push res ""
loop i (listlen $ii) [ if $i [ res = (concat $res (- (at $ii $i) $offs)) ] ]
result (pop res offs ii)
]
persistidents 1