Commit graph

1122 commits

Author SHA1 Message Date
Celtic Minstrel
8492e8d639 Use standard deprecation mechanism for helper.distance_between 2017-05-22 17:31:15 -04:00
Celtic Minstrel
c0f926e2ed Move all WML and variable manipulator functions into new wml table
(The old functions in wesnoth and helper are still available,
but they are now deprecated.)
2017-05-22 17:31:14 -04:00
Celtic Minstrel
39dad27260 [modify_side][ai] with ai_algorithm now replaces the AI (fixes #1216) 2017-05-22 14:39:35 -04:00
Celtic Minstrel
3d5528f950 Proper fix for [endlevel] music issue (#1704)
(fixup 238c50)
2017-05-20 13:22:06 -04:00
Celtic Minstrel
238c175045 Probable fix for [endlevel] music issue (#1704)
In cbd3c2644, a Lua API to victory and defeat music was added, which exposes it as a vector of strings.
However, the [endlevel] implementation passed the comma-separated string directly.
This commit splits the string before passing it to the Lua API.
2017-05-16 01:58:33 -04:00
Celtic Minstrel
850dc96a3a Fix objectives with variables (#992)
[objectives] now supports delayed_variable_substitution=yes, which means that any
$variables or [insert_tag] are processed when the objectives are shown, rather than
when they are set.

In addition, if $|variable syntax is used to delay substitution of a specific variable,
the variable will now be substituted when the objectives are shown, rather than
being left unsubstituted.
2017-05-13 13:20:32 -04:00
Celtic Minstrel
41d0a6b3d8 Fix #1688 2017-05-12 17:21:38 -04:00
Charles Dang
0e7866db2d Possible for fix #1683 2017-05-13 02:32:26 +11:00
Celtic Minstrel
bea0e92c6c Add voice= key to [message] and [story][part]
Resolves #1621
2017-05-11 18:59:15 -04:00
Celtic Minstrel
a5ec607b54 Fix a (probably) rare case when [message]sound might play even if the dialog wasn't shown 2017-05-11 18:10:41 -04:00
Celtic Minstrel
b11371dbfa Lua: Allow helper.set_variable_array and helper.get_variable_array to work on units and sides 2017-05-11 16:00:56 -04:00
Celtic Minstrel
1ba783959e fixup 0539a68eb 2017-05-11 16:00:52 -04:00
Celtic Minstrel
6efc5ae090 Replace helper.distance_between -> wesnoth.map.distance_between (fixes #1686) 2017-05-11 04:14:03 -04:00
Celtic Minstrel
2eea57b27f Fix registration order of on_load events (fixes #1684) 2017-05-10 23:22:20 -04:00
Celtic Minstrel
0ac01c7622 Fix [set_variable][join] not working with translatable strings (fixes #1682) 2017-05-10 18:57:07 -04:00
Celtic Minstrel
0539a68eb4 Migrate ai_helper.LS_random_hex to location_set:random 2017-05-10 17:40:21 -04:00
Celtic Minstrel
f6c04e7dd1 Add functional.lua which implements higher-order functions
This covers all the main higher-order functions included in WFL, except zip.
The two already implemented in ai_helper have been replaced with redirection stubs.
2017-05-10 17:40:20 -04:00
Celtic Minstrel
2f0a6d13e4 Make [animate_unit] without flag an error (fixes #1678) 2017-05-10 17:40:16 -04:00
Celtic Minstrel
a98a9a74db Deprecate helper.distance_between and implement helper.adjacent_tiles in
terms of wesnoth.map.get_adjacent_tiles
2017-05-10 17:40:15 -04:00
Celtic Minstrel
9b635994e1 Add location_set.(of|to)_triples (migrated from ai_helper) 2017-05-10 17:40:14 -04:00
Celtic Minstrel
37f1c490a5 Lua: Use the second argument to error() where appropriate 2017-05-10 17:40:13 -04:00
Celtic Minstrel
cbba6b3929 wesnoth.require: Automatically check current directory for packages 2017-05-07 18:54:16 -04:00
Celtic Minstrel
71ae14e851 Some minor improvements to Lua error messages
- Fix some missing whitespace in Lua log/error messages and add colons
- helper.lua: Improve error messages for config manipulators

It should now give the location of the misused helper call as the error
location, rather than the location where error was called within helper.lua
2017-05-06 17:47:17 -04:00
Celtic Minstrel
b6ddbd8df2 wesnoth.require: Only log error and return nil on failure 2017-05-05 15:16:10 -04:00
Celtic Minstrel
b045760cd5 Prevent people from altering the special "empty package" value,
which is stored in wesnoth.package to prevent reloading loaded
packages just because they didn't return anything.

There's a special exception for accessing __tostring because ilua needs it.
2017-05-05 13:08:54 -04:00
Celtic Minstrel
2f15a08b78 Add a Lua file for things to be automatically loaded by the engine in all contexts 2017-05-04 20:17:00 -04:00
Celtic Minstrel
a3a84076b8 Support [primary_attack] and [secondary_attack] in [kill] 2017-05-04 19:20:43 -04:00
Celtic Minstrel
a15e6379c2 Lua: Rename wesnoth.map_location -> wesnoth.map
Eventually, game_lua_kernel will add additional stuff to this table.
2017-05-04 19:20:41 -04:00
Celtic Minstrel
9ad5a56984 Fix lua error in [test_condition] 2017-05-03 19:40:17 -04:00
Celtic Minstrel
badc2d56d0 Load all MicroAI definitions in a single line 2017-05-03 02:46:24 -04:00
Celtic Minstrel
5da2d71a20 Move [micro_ai] implementation to data/lua/wml 2017-05-03 02:45:54 -04:00
Celtic Minstrel
e1233fd0f2 Split several of the larger WML tags into their own file 2017-05-03 02:43:22 -04:00
Celtic Minstrel
690acf9b79 Allow wesnoth.require to load a whole directory in one call
- Use this feature when loading the WML tags from data/lua/wml
2017-05-03 02:43:13 -04:00
Celtic Minstrel
8d4cf3cf62 Shorten requires where possible 2017-05-03 02:42:25 -04:00
Celtic Minstrel
6b74f91b2f Allow shorter module name specification in wesnoth.require
Basically, you can now omit the "lua/" prefix and the ".lua" suffix.
If necessary, they will automatically be applied for you.
2017-05-03 02:42:17 -04:00
Celtic Minstrel
072ddc4dc1 Reimplement wesnoth.require function in Lua 2017-05-03 02:40:34 -04:00
Celtic Minstrel
efb0fe05e9 Accept [story] as ActionWML 2017-05-02 20:49:10 -04:00
Celtic Minstrel
eb0947c863 Some improvements to the new Lua music API
- Allow removing a track by index and fixup the "set track" interface
- Commit music changes only after event completes, not after any control=flow tag is executed
- Allow inserting a track into the middle of the playlist
- Allow assigning a config to an existing track to overwrite it
- Use std::find when checking for duplicate tracks
2017-04-27 17:09:16 -04:00
Celtic Minstrel
5b4dbe1c61 Port [volume] to Lua
This also fixes [volume] considering 100% to be an invalid volume.
2017-04-27 17:09:05 -04:00
Celtic Minstrel
6906ced4e7 Properly port [music] to Lua 2017-04-27 17:09:03 -04:00
Celtic Minstrel
0a591cd424 Properly port [scroll] to Lua 2017-04-27 17:05:53 -04:00
Celtic Minstrel
339587ee2b Properly port [kill] to Lua 2017-04-27 16:55:38 -04:00
Celtic Minstrel
66f4c2ba3d Add WML tag to change the map zoom level 2017-04-24 12:04:23 -04:00
Celtic Minstrel
1fb4d36ef8 Enable scenarios to change theme in an event 2017-04-24 11:01:12 -04:00
Celtic Minstrel
3d0bd73803 Fix behaviour of [heal_unit]amount= for negative/zero values (#979) 2017-04-10 21:58:46 -04:00
Celtic Minstrel
3f61eda282 Fix [animate_unit]amount=0 healing 1 hp 2017-04-10 21:31:15 -04:00
Celtic Minstrel
7835e05d93 Fix [animate_unit][facing] not working.
This also tweaks the animator:add() API, replacing the facing key
with a target key and requiring it to be an adjacent location.
2017-04-09 01:29:10 -04:00
Jeffrey 'Sigurd' Westcoat
ec2d734acd WML: Add base_income key to [store_side] (#976) 2017-04-08 19:05:49 -04:00
gfgtdf
8c4e09e940 allow to to use a custom rng in helper.rand 2017-04-07 15:05:56 +02:00
Celtic Minstrel
0c4b05ee2a Some fixes to [heal_unit]animate=yes
- Play the healed animation
- Pass the heal amount to both animations
2017-03-27 01:07:33 -04:00