diff --git a/changelog.txt b/changelog.txt
index f6572c00..9fce4253 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -171,6 +171,7 @@ CubeScript
[*] listaverage - Returns the average of a list of numbers. (Supports ints and floats - e.g. echo (listaverage "2 5 5") // Output: 4.0)
[*] player1 - // TODO explain // Also getposition and positiontype have been removed in favor of this command which does that and a lot more. :p
[*] rndmap - Returns a random official map. (e.g. echo (rndmap) // Example output: ac_desert3)
+[*] persistidents - Controls persistence of idents/aliases
[*] Multiple Idents - New helper aliases for voting for SURV, TPF, and TLSS. (e.g. /surv ac_desert)
[*] "Sleeps" can be persistent. (e.g. "Persist" even through map loads - new optional 3rd argument of the /sleep command)
[*] Substr crash bug is fixed. Also the command can now use a negative position value.
@@ -183,4 +184,4 @@ CubeScript
[*] The /mapsize command now silenty returns 6-12, instead of conoutf'ing ssize.
[*] The /newmap command has a (temporary) new range of 6-9. // TODO: Fix client crashing on /newmap >9!
[*] The /spectate command can now only be used if connected to a server.
-[*] The /togglebotview command can no longer be used in arena modes.
\ No newline at end of file
+[*] The /togglebotview command can no longer be used in arena modes.
diff --git a/config/scripts.cfg b/config/scripts.cfg
index b35d2ab7..55212cfe 100644
--- a/config/scripts.cfg
+++ b/config/scripts.cfg
@@ -406,4 +406,9 @@ run dyngamma
run survival
run tutorial
-execdir scripts
\ No newline at end of file
+
+persistidents 1
+
+execdir scripts
+
+persistidents 0
diff --git a/docs/reference.xml b/docs/reference.xml
index 44454b50..0bbfc268 100644
--- a/docs/reference.xml
+++ b/docs/reference.xml
@@ -889,7 +889,25 @@
-
+
+
+ Controls whether aliases defined afterwards will be saved (1) or not (0). This option is useful to keep saved.cfg free from unneeded clutter.
+ Note: in map and model configs, this option is always disabled.
+
+
+
+
+
+
+ foo will not be saved and has to be redefined when restarting AC.
+
+
+
+ bar will be saved and persistent across sessions.
+
+
+
+
Injects CubeScript punctuation.
diff --git a/source/src/command.cpp b/source/src/command.cpp
index 2956432a..aaebe702 100644
--- a/source/src/command.cpp
+++ b/source/src/command.cpp
@@ -17,7 +17,10 @@ int loop_level = 0; // avoid bad calls of b
hashtable *idents = NULL; // contains ALL vars/commands/aliases
-bool persistidents = true;
+bool persistidents = true, neverpersist = false;
+COMMANDF(persistidents, ARG_1INT, (int on) {
+ persistidents = neverpersist ? false : on;
+});
void clearstack(ident &id)
{
diff --git a/source/src/md2.h b/source/src/md2.h
index e28cba05..bcb4117e 100644
--- a/source/src/md2.h
+++ b/source/src/md2.h
@@ -259,11 +259,13 @@ struct md2 : vertmodel
loadingmd2 = this;
defformatstring(name2)("packages/models/%s/md2.cfg", loadname);
persistidents = false;
+ neverpersist = true;
if(!execfile(name2))
{
formatstring(name2)("packages/models/%s/md2.cfg", pname);
execfile(name2);
}
+ neverpersist = false;
persistidents = true;
loadingmd2 = 0;
loopv(parts) parts[i]->scaleverts(scale/16.0f, vec(translate.x, -translate.y, translate.z));
diff --git a/source/src/md3.h b/source/src/md3.h
index bfaed039..a941abf5 100644
--- a/source/src/md3.h
+++ b/source/src/md3.h
@@ -216,8 +216,10 @@ struct md3 : vertmodel
loadingmd3 = this;
persistidents = false;
+ neverpersist = true;
if(execfile(cfgname) && parts.length()) // configured md3, will call the md3* commands below
{
+ neverpersist = false;
persistidents = true;
loadingmd3 = NULL;
if(parts.empty()) return false;
diff --git a/source/src/protos.h b/source/src/protos.h
index 41e8afde..1c714f99 100644
--- a/source/src/protos.h
+++ b/source/src/protos.h
@@ -732,7 +732,7 @@ extern bool checkchallenge(const char *answerstr, void *correct);
extern void conoutf(const char *s, ...);
// command
-extern bool persistidents;
+extern bool persistidents, neverpersist;
extern int variable(const char *name, int min, int cur, int max, int *storage, void (*fun)(), bool persist);
extern float fvariable(const char *name, float min, float cur, float max, float *storage, void (*fun)(), bool persist);
extern char *svariable(const char *name, const char *cur, char **storage, void (*fun)(), bool persist);
diff --git a/source/src/world.cpp b/source/src/world.cpp
index e9ccb2d3..d6936c3d 100644
--- a/source/src/world.cpp
+++ b/source/src/world.cpp
@@ -481,7 +481,9 @@ bool empty_world(int factor, bool force) // main empty world creation routine
{
pushscontext(IEXC_MAPCFG);
persistidents = false;
+ neverpersist = true;
execfile("config/default_map_settings.cfg");
+ neverpersist = false;
persistidents = true;
popscontext();
setvar("fullbright", 1);
diff --git a/source/src/worldio.cpp b/source/src/worldio.cpp
index 11872404..5af3e6f3 100644
--- a/source/src/worldio.cpp
+++ b/source/src/worldio.cpp
@@ -674,9 +674,11 @@ bool load_world(char *mname) // still supports all map formats that have
conoutf("%s", hdr.maptitle);
pushscontext(IEXC_MAPCFG); // untrusted altogether
persistidents = false;
+ neverpersist = true;
execfile("config/default_map_settings.cfg");
execfile(pcfname);
execfile(mcfname);
+ neverpersist = false;
persistidents = true;
popscontext();
@@ -822,9 +824,11 @@ void listmapdependencies(char *mapname) // print map dependencies to file
enumeratek(usedmods, const char *, key, concatformatstring(allmods, "%s%s",*allmods ? ", " : "", key); delete key; usedm++);
pushscontext(IEXC_MAPCFG); // untrusted altogether
persistidents = false;
+ neverpersist = true;
execfile(mcfname);
f->printf(" used: %s%s %d total packages (%s.cfg)\n", allmods, usedm ? ", " : "", usedm, mapname);
if(usedm) conoutf(" used: %s (%s.cfg) in %s", allmods, mapname, mapname);
+ neverpersist = false;
persistidents = true;
popscontext();
f->printf("\n\n");