15 #ifndef SCRIPTING_LUA_HPP
16 #define SCRIPTING_LUA_HPP
29 namespace ai {
class engine_lua; }
30 namespace ai {
class lua_ai_action_handler; }
31 namespace ai {
class lua_ai_context; }
178 std::vector<team> &
teams();
209 virtual void log_error(
char const*
msg,
char const* context =
"Lua error");
int intf_get_terrain_info(lua_State *L)
Gets details about a terrain.
int intf_kill(lua_State *L)
const gamemap & map() const
std::stack< game_events::queued_event const * > queued_events_
int map_locked_
A value != 0 means that the shouldn't remove any units from the map, usually because we are currently...
std::string apply_effect(const std::string &name, unit &u, const config &cfg, bool need_apply)
void(* handler)(const queued_event &, const vconfig &)
int intf_remove_sound_source(lua_State *L)
Removes a sound source by its ID Arg 1: sound source ID.
int intf_allow_end_turn(lua_State *)
Allow undo sets the flag saying whether the event has mutated the game to false.
int intf_find_path(lua_State *L)
Finds a path between two locations.
int intf_set_end_campaign_credits(lua_State *L)
game_display * game_display_
int intf_get_time_of_day(lua_State *L)
Gets time of day information.
int intf_get_unit(lua_State *)
Gets the unit at the given location or with the given id.
int intf_get_variable(lua_State *L)
Gets a WML variable.
int intf_modify_ai_wml(lua_State *L)
int intf_match_location(lua_State *L)
Matches a location against the given filter.
std::vector< int > get_sides_vector(const vconfig &cfg)
Gets a vector of sides from side= attribute in a given config node.
int impl_theme_items_get(lua_State *L)
Creates a field of the theme_items table and returns it (__index metamethod).
int intf_replace_schedule(lua_State *l)
Replacing the current time of day schedule.
bool run_wml_action(std::string const &, vconfig const &, game_events::queued_event const &)
Runs a command from an event handler.
int intf_view_locked(lua_State *L)
Gets whether gamemap scrolling is disabled for the user.
void set_wml_action(std::string const &, game_events::wml_action::handler)
Registers a function for use as an action handler.
std::vector< team > & teams()
int intf_set_terrain(lua_State *L)
Sets a terrain code.
int intf_log(lua_State *L)
Logs a message Arg 1: (optional) Logger; "wml" for WML errors or deprecations Arg 2: Message Arg 3: W...
int intf_clear_messages(lua_State *)
Removes all messages from the chat window.
int intf_play_sound(lua_State *L)
Plays a sound, possibly repeated.
int intf_label(lua_State *L)
int intf_extract_unit(lua_State *L)
Extracts a unit from the map or a recall list and gives it to Lua.
int intf_get_all_vars(lua_State *L)
Gets all the WML variables currently set.
int intf_find_cost_map(lua_State *L)
Is called with one or more units and builds a cost map.
void clear(const std::string &key)
int intf_set_time_of_day(lua_State *L)
Define actions for the game's events mechanism.
int intf_set_village_owner(lua_State *L)
Sets the owner of a village.
int intf_match_unit(lua_State *L)
Matches a unit against the given filter.
int intf_set_next_scenario(lua_State *L)
void push_builtin_effect()
Registers a function for use as an effect handler.
int intf_skip_messages(lua_State *L)
Set whether to skip messages Arg 1 (optional) - boolean.
int intf_scroll(lua_State *L)
int impl_theme_items_set(lua_State *L)
Sets a field of the theme_items table (__newindex metamethod).
int intf_get_sides(lua_State *L)
Returns a proxy table array for all sides matching the given SSF.
void lua_chat(std::string const &caption, std::string const &msg)
int intf_gamestate_inspector(lua_State *)
bool run_wml_conditional(std::string const &, vconfig const &)
Runs a command from an event handler.
const game_events::queued_event & get_event_info()
int intf_get_locations(lua_State *L)
Gets all the locations matching a given filter.
Unit and team statistics.
static void extract_preload_scripts(config const &game_config)
int intf_find_reach(lua_State *L)
Finds all the locations reachable by a unit.
void set_game_display(game_display *gd)
int intf_set_variable(lua_State *L)
Sets a WML variable.
int intf_delay(lua_State *L)
Delays engine for a while.
int(* lua_CFunction)(lua_State *L)
This class stores all the data for a single 'side' (in game nomenclature).
A small explanation about what's going on here: Each action has access to two game_info objects First...
void select_hex_callback(const map_location &loc)
int intf_get_map_size(lua_State *L)
Returns the map size.
int intf_simulate_combat(lua_State *L)
Simulates a combat between two units.
int intf_select_unit(lua_State *L)
Selects and highlights the given location on the map.
int intf_remove_tile_overlay(lua_State *L)
Removes an overlay from a tile.
int intf_remove_time_area(lua_State *)
Removing new time_areas dynamically with Standard Location Filters.
Proxy table for the AI context.
int intf_get_villages(lua_State *L)
Gets all the villages matching a given filter, or all the villages on the map if no filter is given...
int intf_fire_wml_menu_item(lua_State *L)
Fires a wml menu item.
int intf_set_end_campaign_text(lua_State *L)
int intf_get_displayed_unit(lua_State *)
Gets the unit displayed in the sidebar.
std::string synced_state()
converts synced_context::get_synced_state() to a string.
virtual void log_error(char const *msg, char const *context="Lua error")
int intf_get_recall_units(lua_State *L)
Gets the numeric ids of all the units matching a given filter on the recall lists.
Encapsulates the map of the game.
void initialize(const config &level)
int intf_teleport(lua_State *L)
Teeleports a unit to a location.
int intf_get_village_owner(lua_State *L)
Gets the side of a village owner.
int cfun_builtin_effect(lua_State *L)
Applies its upvalue as an effect Arg 1: The unit to apply to Arg 3: The [effect] tag contents Arg 3: ...
int intf_is_enemy(lua_State *L)
Returns whether the first side is an enemy of the second one.
int intf_is_skipping_messages(lua_State *L)
Return true if a replay is in progress but the player has chosen to skip it.
int intf_get_sound_source(lua_State *L)
Get an existing sound source Arg 1: The sound source ID Return: Config of sound source info...
int intf_put_unit(lua_State *L)
Places a unit on the map.
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
int intf_redraw(lua_State *L)
int intf_add_tile_overlay(lua_State *L)
Adds an overlay on a tile.
int impl_current_get(lua_State *L)
Gets some data about current point of game (__index metamethod).
void load_game(const config &level)
Executes the game_events.on_load function and passes to it all the scenario tags not yet handled...
play_controller & play_controller_
int intf_modify_side(lua_State *L)
int impl_theme_item(lua_State *L, std::string name)
Executes its upvalue as a theme item generator.
void save_game(config &level)
Executes the game_events.on_save function and adds to cfg the returned tags.
Encapsulates the map of the game.
ai::lua_ai_context * create_lua_ai_context(char const *code, ai::engine_lua *engine)
int intf_add_event(lua_State *L)
Adding new events.
int intf_message(lua_State *L)
Displays a message in the chat window and in the logs.
int intf_heal_unit(lua_State *L)
int impl_game_config_set(lua_State *L)
Sets some game_config data (__newindex metamethod).
int intf_end_turn(lua_State *)
int intf_remove_event(lua_State *L)
int intf_get_units(lua_State *)
Gets all the units matching a given filter.
Game configuration data as global variables.
int intf_set_side_variable(lua_State *L)
Gets a side specific WML variable.
int intf_animate_unit(lua_State *)
int intf_scroll_to_tile(lua_State *L)
Scrolls to given tile.
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
ai::lua_ai_action_handler * create_lua_ai_action_handler(char const *code, ai::lua_ai_context &context)
bool run_filter(char const *name, unit const &u)
Runs a script from a unit filter.
int intf_lock_view(lua_State *L)
Sets whether gamemap scrolling is disabled for the user.
int intf_add_time_area(lua_State *)
Adding new time_areas dynamically with Standard Location Filters.
int intf_get_starting_location(lua_State *L)
Returns the starting position of a side.
int impl_game_config_get(lua_State *L)
Gets some game_config data (__index metamethod).
int intf_get_selected_tile(lua_State *L)
Returns the currently selected tile.
int intf_set_menu_item(lua_State *L)
int intf_add_sound_source(lua_State *L)
Add a new sound source Arg 1: Table containing keyword arguments.
int intf_shroud_op(lua_State *L, bool place_shroud)
Proxy class for calling AI action handlers defined in Lua.
int intf_allow_undo(lua_State *)
Allow undo sets the flag saying whether the event has mutated the game to false.
int intf_match_side(lua_State *L)
Matches a side against the given filter.
GLuint const GLchar * name
int intf_toggle_fog(lua_State *L, const bool clear)
Implements the lifting and resetting of fog via WML.
bool run_event(game_events::queued_event const &)
Executes the game_events.on_event function.
virtual std::string my_name()
int intf_erase_unit(lua_State *L)
Erases a unit from the map.
int intf_color_adjust(lua_State *L)
int intf_open_help(lua_State *L)
int intf_clear_menu_item(lua_State *L)
int intf_get_mouseover_tile(lua_State *L)
Returns the currently overed tile.
A variable-expanding proxy for the config class.
static config preload_config
Container associating units to locations.
int intf_print(lua_State *L)
void mouse_over_hex_callback(const map_location &loc)
int intf_put_recall_unit(lua_State *L)
Puts a unit on a recall list.
int cfun_wml_action(lua_State *L)
Executes its upvalue as a wml action.
int intf_get_side_variable(lua_State *L)
Gets a side specific WML variable.
int intf_get_terrain(lua_State *L)
Gets a terrain code.
int intf_deselect_hex(lua_State *L)
Deselects any highlighted hex on the map.
A config object defines a single node in a WML file, with access to child nodes.
int intf_check_end_level_disabled(lua_State *L)
int intf_find_vacant_tile(lua_State *L)
Finds a vacant tile.
GLsizei const GLcharARB ** string
int intf_fire_event(lua_State *L)
Fires an event.
int intf_random(lua_State *L)
Returns a random numer, same interface as math.random.
int intf_select_hex(lua_State *L)
static std::vector< config > preload_scripts
int return_unit_method(lua_State *L, char const *m)
int intf_float_label(lua_State *L)
Floats some text on the map.
int intf_end_level(lua_State *)
int intf_highlight_hex(lua_State *L)
Highlights the given location on the map.
game_lua_kernel(CVideo *, game_state &, play_controller &, reports &)