Add code to automatically update existing spec binds to spec_ask_forfeit, executed by the menu only once
// function keys
bind F1 vyes
bind F2 vno
-bind F3 spec
+bind F3 spec_ask_forfeit
bind F4 ready
bind F5 team_selection_show
bind F6 team_auto
alias team_yellow "cmd selectteam yellow; cmd join"
alias team_auto "togglemenu 0; cmd selectteam auto; cmd join"
+
+// Xonotic 0.9.0 update: menu will change any spec bind to spec_ask_forfeit (and set this cvar to 1)
+// TODO remove menu code and this cvar in a later Xonotic version
+seta _spec_ask_forfeit_bindupdate 0
+
alias spec "spectate ${* ?}"
+alias spec_ask_forfeit "spectate \"\" ASK_FORFEIT"
// mutator aliases
alias sandbox "cmd g_sandbox ${* ?}"
me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("Are you sure you want to observe and quit current match?")));
me.TR(me);
me.TR(me);
- me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Yes"), '1 0 0', "spec \"\" FORFEIT", COMMANDBUTTON_CLOSE));
+ me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Yes"), '1 0 0', "spec", COMMANDBUTTON_CLOSE));
me.TD(me, 1, 1, e = makeXonoticButton(_("No"), '0 1 0'));
e.onClick = Dialog_Close;
e.onClickEntity = me;
KEYBIND_HEADER(_("Teamplay"));
KEYBIND_DEF("team_auto" , _("auto-join team"));
KEYBIND_DEF("team_selection_show" , _("team selection"));
- KEYBIND_DEF("spec" , _("observe"));
+ KEYBIND_DEF("spec_ask_forfeit" , _("observe"));
KEYBIND_EMPTY_LINE();
KEYBIND_HEADER(_("Misc"));
replace_bind("impulse 8", "weapon_group_8");
replace_bind("impulse 9", "weapon_group_9");
replace_bind("impulse 14", "weapon_group_0");
+
+ // Xonotic 0.9.0 update
+ // TODO remove cvar and this code in a later Xonotic version
+ if (!cvar("_spec_ask_forfeit_bindupdate"))
+ {
+ replace_bind("spec", "spec_ask_forfeit");
+ cvar_set("_spec_ask_forfeit_bindupdate", "1");
+ }
}
void XonoticKeyBinder_loadKeyBinds(entity me)
{
return;
}
- bool caller_wants_to_forfeit = false;
- if (argv(2) == "FORFEIT" || warmup_stage)
- caller_wants_to_forfeit = true; // player replied that they want to forfeit
+ bool forfeit_now = (warmup_stage || argv(2) != "ASK_FORFEIT");
- if (IS_PLAYER(caller) && !caller_wants_to_forfeit && caller.cvar__menu_forfeit_dialog_available)
+ if (IS_PLAYER(caller) && !forfeit_now && caller.cvar__menu_forfeit_dialog_available)
{
- // ask player if they want to forfeit
+ // ask player to confirm the forfeit
stuffcmd(caller, "menu_showforfeitdialog\n");
return;
}
if (mutator_returnvalue == MUT_SPECCMD_RETURN_FORFEIT)
{
- if (caller_wants_to_forfeit || !caller.cvar__menu_forfeit_dialog_available)
+ if (forfeit_now || !caller.cvar__menu_forfeit_dialog_available)
mutator_returnvalue = MUT_SPECCMD_FORCE;
else
{