86 Commits

Author SHA1 Message Date
Celtic Minstrel
a76aa9bddc
Add wesnoth.interface.add_floating_label as a replacement for wesnoth.print (#5837)
This returns a label handle which allows you to remove, reposition, or replace the label later.

In addition to all the features of wesnoth.print, you can now specify where the label appears onscreen, as well as a fadeout time separate from the duration.

You can also anchor the text to an edge or corner instead of centering in on the screen,
specify the maximum width it can occupy as an absolute width or a percentage,
and specify a background colour and transparency.

It includes a demo scenario that demonstrates many of the capabilities of the API.
To play the demo scenario, run with -toverlay_text_demo or select it from the in-game test list.
2022-04-10 13:00:29 -04:00
Celtic Minstrel
14865d0afd Lua: Fix incorrect check for string type 2022-02-17 13:49:01 -05:00
Celtic Minstrel
e518fe622b Lua: Fix a deprecation warning in the hex reference API 2022-02-17 13:48:58 -05:00
Celtic Minstrel
e1300e29b0
Lua API: Add inline documentation for pretty much everything and convert existing docs (#6483)
The new format is EmmyLua-based and can be used with (at least) Visual Studio Code.
2022-02-17 13:43:31 -05:00
Steve Cotton
2afc7f80bd Fixup 5b18f2df4 (trailing whitespace) 2022-01-09 07:35:39 +01:00
Elvish_Hunter
5b18f2df4c Fixed broken gui.get_user_choice() 2022-01-08 22:29:56 +01:00
Pentarctagon
370d03ccb7 Fix luacheck warnings and add to CI.
Note the `exclude_files` in .luacheckrc should be deleted once the eventual Ubuntu 22.04 base image has an updated luacheck that supports lua 5.4.
2021-11-28 14:26:02 -06:00
Celtic Minstrel
ff6894cee8 Lua API: Add a wesnoth.type() function
This checks both the Lua type and the metatable type to return a single unified result.
2021-09-04 22:20:28 -04:00
Celtic Minstrel
35fce3fa3b Lua API: Fix an error in the terrain hex API
Attempting to access a non-string key was an error.
2021-09-04 22:20:28 -04:00
Celtic Minstrel
23bfa4c896 fix whitespace 2021-07-30 19:22:57 -04:00
Celtic Minstrel
44da16d66a Lua API: Use the new location_set complement in the place_shroud deprecation wrapper 2021-07-30 19:22:57 -04:00
Celtic Minstrel
300b4492b8 Lua API: Ensure unit test assertions specify a message string 2021-07-30 19:22:57 -04:00
Celtic Minstrel
eb1bd1af6c Lua API: Add wesnoth.map.filter_tags for the mapgen kernel
This was supposed to be added for 1.16, but it was forgotten; anyone wishing to use it in 1.16 will have to copy it from World Conquest.
2021-07-30 19:22:57 -04:00
Celtic Minstrel
5951a63d3e Lua API: Fix wesnoth.map.find(filter, unit) ignoring the unit 2021-07-30 19:22:57 -04:00
Celtic Minstrel
858f37e20e Lua API: Fix the deprecation wrappers for place_shroud and remove_shroud
- The "all" special case moved to place_shroud, as it should be
- Shroud data string handling fixed

Fixes #5885
2021-07-30 19:22:57 -04:00
Celtic Minstrel
30a3619202 Lua API: Fix bug in wesnoth.map.iter_adjacent
Fixes #5972
2021-07-30 19:22:57 -04:00
Celtic Minstrel
5f450542f5 WFL/Lua: Add lerp and clamp functions 2021-07-30 19:22:57 -04:00
Celtic Minstrel
82a98fd96e Lua API: Revive mp_settings.active_mods and mp_settings.era_id
These were removed without deprecation in 0efd35acbcba45724be4737073dc7f77480ec781
This adds them back as deprecated.

Fixes #5941
2021-07-13 14:10:07 -04:00
Celtic Minstrel
8b05449bbc Lua API: Deprecate helper.set_wml_action_metatable
wml.fire now supports the same syntax - both of the following work:

- wml.fire("message", {message = "Hello World"})
- wml.fire.message{message = "Hello World"}
2021-07-07 01:32:05 -04:00
Celtic Minstrel
771f472dd7 Lua API: Add wesnoth.map.iter_adjacent
This replaces helper.adjacent_tiles
2021-07-07 01:32:05 -04:00
Celtic Minstrel
47951c4700 Lua API: Add wesnoth.sides.iter
This replaces both helper.get_sides and helper.all_teams
2021-07-07 01:32:05 -04:00
Celtic Minstrel
1e42f80c13 Lua API: Use the named tuple idiom for WML tags
Instead of this:

for i,t in ipairs(cfg) do
  if t[1] == 'foo' then
    do_something(t[2])
  end
end

You can now write this:

for i,t in ipairs(cfg) do
  if t.tag == 'foo' then
    do_something(t.value)
  end
end
2021-07-07 01:32:05 -04:00
Celtic Minstrel
0b309a0d6a Lua API: Move wesnoth.as_text into core
This means it's now usable in map generation or plugin scripts.
2021-07-02 14:04:54 -04:00
Celtic Minstrel
3b556b3c4b Improve a deprecation message 2021-06-29 09:35:15 -04:00
Celtic Minstrel
3c9639f603 Fix another deprecation message 2021-06-29 09:23:58 -04:00
Celtic Minstrel
0ef4a86b7e Fix wml.remove_children 2021-06-24 00:51:13 -04:00
Pentarctagon
0b4f820a46
Fix whitespace. 2021-06-23 10:30:39 -05:00
Celtic Minstrel
8bcfbed34e Implement shroud API deprecation wrappers that handle shroud data strings
Addresses #5885
2021-06-23 09:55:26 -04:00
Celtic Minstrel
91f6bf93a4 Fix a broken deprecation and replace some deprecated uses
Fixes #5877
2021-06-20 00:59:59 -04:00
Pentarctagon
7b383cee68
Fixup deprecation method typo. 2021-06-19 23:37:22 -05:00
Celtic Minstrel
bb21464a0a Lua: Move the gamestate_inspector deprecation to a different file 2021-06-19 17:30:22 -04:00
Celtic Minstrel
7f162cbd24 Lua: Rename find_vacant_tile to find_vacant_hex for naming consistency 2021-06-19 17:09:31 -04:00
Celtic Minstrel
1b13622bf9 fix whitespace 2021-06-19 15:43:33 -04:00
Celtic Minstrel
45c3ca3a73 Move path-related functions into a new wesnoth.paths module
This also adds support to the mapgen version of wesnoth.find_path for
taking an options table as the 3rd argument instead of several additional arguments.

The intent of this is to bring the two versions of find_path closer together.
For now, however, the actual options accepted in the table have not changed.
2021-06-19 15:43:33 -04:00
Celtic Minstrel
5a1e38e99b
Add wesnoth.sync module for the synchronization-related commands (#5862) 2021-06-19 15:39:10 -04:00
Celtic Minstrel
f145dc2bba Replace uses of the moved interface functions 2021-06-19 12:09:46 -05:00
Celtic Minstrel
bfa7e918e4 Move several functions to the wesnoth.interface module 2021-06-19 12:09:46 -05:00
Celtic Minstrel
1c2636e989 fix whitespace 2021-06-19 11:07:53 -04:00
Celtic Minstrel
96b5bf43ef Move shroud/fog ops to wesnoth.sides and change the API somewhat
- place_shroud and remove_shroud no longer accept a shroud data string or the special string "all"
- new functions are added to convert between lists of locations and shroud data strings
- place_fog, remove_fog, is_fogged, and is_shrouded aren't changed, only moved
2021-06-19 11:07:53 -04:00
Celtic Minstrel
a03d59d7eb Lua: Add a new schedule module
The primary components of this are:
- wesnoth.current.schedule
- wesnoth.map.get_time_area()
- wesnoth.schedule module
2021-06-19 11:07:53 -04:00
Celtic Minstrel
67ba27b8a3
Move the end level data accessors to wesnoth.scenario (#5861) 2021-06-17 20:41:48 -04:00
Celtic Minstrel
131ad43e3e Move wesnoth.get_traits into wesnoth.game_config as global_traits 2021-06-15 09:57:30 -04:00
Celtic Minstrel
7e2d9cba28 Move wesnoth.teleport into wesnoth.units 2021-06-15 09:56:04 -04:00
Celtic Minstrel
3c8de46771 There were some old functions that are now covered by the wesnoth.scenario module, so deprecate them 2021-06-06 13:42:54 -04:00
Celtic Minstrel
1122ed00fb Fix broken global_vars table 2021-05-17 20:35:27 -04:00
Celtic Minstrel
49bc5cc6db Fix missing deprecation for wesnoth.random 2021-05-17 19:35:06 -04:00
Celtic Minstrel
bf318a6e23
math.random wasn't even supposed to be deprecated at all 2021-05-15 17:31:12 -04:00
Celtic Minstrel
cc42e00e4b Fix a deprecation typo 2021-05-15 13:32:40 -04:00
Celtic Minstrel
eab8645e90 Fix incorrect deprecation wrapper for wesnoth.color_adjust
The source function wasn't public API, but it can't hurt to make it work.
2021-05-13 19:22:31 -04:00
Celtic Minstrel
6584302d41
Merge pull request #5537 from wesnoth/lua_reorg
Various Lua reorganization work
2021-05-11 19:12:40 -04:00