persistidents - control whether newly defined idents are persistent (suggested by Bukz)
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6526 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+2
-1
@@ -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.
|
||||
[*] The /togglebotview command can no longer be used in arena modes.
|
||||
|
||||
+6
-1
@@ -406,4 +406,9 @@ run dyngamma
|
||||
run survival
|
||||
run tutorial
|
||||
|
||||
execdir scripts
|
||||
|
||||
persistidents 1
|
||||
|
||||
execdir scripts
|
||||
|
||||
persistidents 0
|
||||
|
||||
+19
-1
@@ -889,7 +889,25 @@
|
||||
<identifierReference identifier="checkinit"/>
|
||||
</references>
|
||||
</command>
|
||||
|
||||
|
||||
<command name="persistidents">
|
||||
<description>Controls whether aliases defined afterwards will be saved (1) or not (0). This option is useful to keep saved.cfg free from unneeded clutter.</description>
|
||||
<description>Note: in map and model configs, this option is always disabled.</description>
|
||||
<arguments>
|
||||
<argument token="B" description="control option" valueNotes="1...persistent, 0...not persistent"/>
|
||||
</arguments>
|
||||
<examples>
|
||||
<example>
|
||||
<code><![CDATA[persistidents 0; foo = [ echo "bar"]]]></code>
|
||||
<explanation>foo will not be saved and has to be redefined when restarting AC.</explanation>
|
||||
</example>
|
||||
<example>
|
||||
<code><![CDATA[persistidents 1; bar = [ echo "foo"]]]></code>
|
||||
<explanation>bar will be saved and persistent across sessions.</explanation>
|
||||
</example>
|
||||
</examples>
|
||||
</command>
|
||||
|
||||
<command name="addpunct">
|
||||
<description>Injects CubeScript punctuation.</description>
|
||||
<examples>
|
||||
|
||||
@@ -17,7 +17,10 @@ int loop_level = 0; // avoid bad calls of b
|
||||
|
||||
hashtable<const char *, ident> *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)
|
||||
{
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user