Files
assaultcube-/config/menus_voicecom.cfg
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

67 lines
3.3 KiB
INI

newmenu voicecom 1 1
menuitem [1. Team Replies] [ showmenu [Team Replies] ]
menuitem [2. Team Commands] [ showmenu [Team Commands] ]
menuitem [3. Team State] [ showmenu [Team State] ]
menuitem [4. Team Talk] [ showmenu [Team Talk] ]
menuitem [5. Team Tactics] [ showmenu [Team Tactics] ]
menuitem [6. Public Talk] [ showmenu [Public Talk] ]
const vcrnd [ // pick random shout if possible
tempalias len (listlen $arg1)
if (> $len 1) [
tempalias r (rnd $len)
voicecom (at $arg1 $r) (at $arg2 $r)
] [
voicecom $arg1 $arg2
]
]
const genvcitem [
if (> (listlen $arg2) 1) [ text = (at $arg1 0) ] [ text = $arg1 ] // split multiple shouts
action = (concatword vcrnd " [" $arg2 "]" " [" $arg1 "]")
menuitem (concatword $arg3 ". " $text) $action // add as numbered list
]
// V 1 [ 1,2 ]
newmenu [Team Replies] 1 1
// the following two mirror F1/F2 - disagree/agree
genvcitem [Yes Affirmative "All right, Sir"] [yes affirmative allrightsir] 1 // #
genvcitem [Negative "No can do" "There's no way, Sir!"] [negative nocando theresnowaysir] 2 // *
genvcitem ["On the move" "On my way"] [onthemove_1 onthemove_2] 3
genvcitem ["Got your back!" "Got you covered!"] [igotyourback igotyoucovered] 4
genvcitem ["In position!" "In position now!"] [inposition_1 inposition_2] 5
// V 2 [ 1,2,3 ]
newmenu [Team Commands] 1 1
genvcitem [Recover the flag!] recovertheflag 1 // *
genvcitem [Defend the flag!] defendtheflag 2 // #
genvcitem ["Come on, move!" "Spread out!"] [comeonmove spreadout] 3 // *
// V 3 [ 2,3,4 ]
newmenu [Team State] 1 1
genvcitem [I'm attacking] imattacking 1
genvcitem [Coming in with the flag!] cominginwiththeflag 2 // *
genvcitem [I made contact] imadecontact 3 // #
genvcitem ["Enemy down" "I got one"] [enemydown igotone] 4 // *
genvcitem [I'm on defense] imondefense 5
// V 4 [ 1,2,3 ]
newmenu [Team Talk] 1 1
genvcitem ["We did it!" "Go get 'em boys!" "Good job, team!"] [wedidit gogetemboys goodjobteam] 1
genvcitem [Sorry] sorry 2
genvcitem [I'm on your team, man!] imonyourteamman 3 // *
// V 5 [ 1,2,3 ]
newmenu [Team Tactics] 1 1
genvcitem [Cover me!] coverme 1
genvcitem [Stay together!] staytogether 2
genvcitem [Stay here!] stayhere 3
genvcitem [Report in!] reportin 4 // *
// V 6 [ 1,2,3 ]
newmenu [Public Talk] 1 1
genvcitem [Nice shot] niceshot 1
genvcitem [Thanks! "Thanks, man"] [thanks_1 thanks_2] 2
genvcitem [Awesome Awesome!] [awesome_1 awesome_2] 3