add wesnoth.current.user_can_invoke_commands

this attribute return whether we are in a context where the user coudl issue new commands.

This is mainly intended to be used to check whethere we can use [do_command] in the currently situation (for exampel if one wants to use [do_command] in a unsycned menu item)
This commit is contained in:
gfgtdf 2017-09-20 10:46:28 +02:00 committed by GitHub
parent 2bd645420c
commit 7c71bab57c

View file

@ -1356,6 +1356,7 @@ int game_lua_kernel::impl_current_get(lua_State *L)
return_int_attrib("side", play_controller_.current_side());
return_int_attrib("turn", play_controller_.turn());
return_string_attrib("synced_state", synced_state());
return_bool_attrib("user_can_invoke_commands", !play_controller_.is_lingering() && play_controller_.gamestate().init_side_done() && !events::commands_disabled && gamedata().phase() == game_data::PLAY);
if (strcmp(m, "event_context") == 0)
{