Files
assaultcube-/config/prefabs.cfg
T
ac-stef b650fca2ca persistidents cleanup
Restore the old persistidents system from AC 1.0, since it's working as
intended - if used properly.

As a reminder:

  * aliases created by "const" and "tempalias" are never persistent
  * aliases created or altered by "alias" or "=" become persistent, if
    the persistidents flag is set during that operation
  * persistidents if false during the execution of almost all config files
    during game start - those files can create aliases with default values
    which will not be persistent (until changed later while the flag is
    set)
  * before saved.cfg is executed, the flag is set and stays set all
    throughout the game - which means, that all changes (from menus, for
    example) will change the altered alias to "persistent"
  * exceptions for map or model config files are unnecessary, since those
    run restricted and can't create aliases anyway
  * exceptions are necessary for "late run" config files like those in
    config/opt/

The new command "persistidents" may be used to manually set or clear the
flag. It also returns the current state of the flag. If used in a config
file, the flag is restored to its original value when the file ends
execution.

In short: only late-run config files (meaning: run after saved.cfg was
restored) may need to manually set/reset the flag. Use const and tempalias
where appropriate and clear persistidents before creating an alias with a
not-to-save default value that may be changed and made persistent later.

DOCREF persistidents
2017-05-05 15:50:59 +02:00

47 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
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)
]