Commit graph

1093 commits

Author SHA1 Message Date
Gregory A Lundberg
468f07364e Bug in [for] missing step
https://forums.wesnoth.org/viewtopic.php?t=46450 reports a Lua crash if end is given but step is not. The wiki says the default step is 1. Note that if end is negative, the [for] does nothing (per sniity check).
2017-06-21 20:45:21 -05:00
Celtic Minstrel
5109a36b56 Revert use of Lua for teleport, leadership, and backstab 2017-06-18 11:40:15 -04:00
gfgtdf
2498036c4d fixup 70a23cdf83 2017-06-14 13:57:29 +02:00
gfgtdf
70a23cdf83 remove variable substitution from leadership and backstab abilities 2017-06-13 23:22:06 +02:00
gfgtdf
80d27b4584 use lua filter in {ABILITY_TELEPORT}
this way it no longer uses variable substitution

Fixes #1281
2017-06-13 22:51:23 +02:00
Celtic Minstrel
e6fce88d21 Minor fixups to [story] 2017-06-04 12:26:02 -04:00
gfgtdf
121c1cb007 fix wml tags using side.controller (#1740) 2017-05-29 11:58:29 +02:00
ProditorMagnus
3bcc2ec0fa Allow showing [chat] to observers, fixes #1735
Fixes https://github.com/wesnoth/wesnoth/issues/1735
Implements https://forums.wesnoth.org/viewtopic.php?f=12&t=46029
[chat] has key observable=yes/no, default yes, which controls, if the message should be visible to observers.
2017-05-29 18:54:51 +11:00
Celtic Minstrel
fbeb6c5b09 Add helper.find_attack and clean up the [animate_unit] / [kill] hack regarding death / victory animations 2017-05-28 18:20:16 -04:00
Celtic Minstrel
686551c9f7 Fix [primary_attack] and [second_attack] not working in [kill] 2017-05-28 18:20:14 -04:00
Celtic Minstrel
7c4e3c62f5 Fix [scroll] with omitted x or y
As reported at https://forums.wesnoth.org/viewtopic.php?f=4&t=46168
2017-05-28 12:21:58 -04:00
Celtic Minstrel
646bedb088 Reverse the Lua API deprecations for the time being. 2017-05-26 20:50:37 -04:00
gfgtdf
ea5dc137ed fixup ae111a40d ([unstore_unit]) 2017-05-25 15:29:03 +02:00
gfgtdf
ae111a40de improve [unstore_unit] error message 2017-05-25 12:41:03 +02:00
Celtic Minstrel
2fe72820d1 Fix Lua deprecation warnings being shown in chat outside debug mode 2017-05-23 23:55:44 -04:00
Celtic Minstrel
fdf50bccd1 core.lua: Explicitly load wml.variable only in Game Lua Kernel 2017-05-23 23:55:43 -04:00
Celtic Minstrel
f42852dd0c Minor rearrangement/fixup in core.lua 2017-05-23 23:55:42 -04:00
Celtic Minstrel
62ac5a6897 fixup 30caf6149a 2017-05-22 20:29:19 -04:00
Celtic Minstrel
9f0c677d02 Remove the optional second argument to wesnoth.get_variable
It was only used in one place and didn't even function as advertised.
2017-05-22 17:31:21 -04:00
Celtic Minstrel
c67d524ced Fix [kill] not affecting recall list units 2017-05-22 17:31:20 -04:00
Celtic Minstrel
30caf6149a Show Lua deprecation warnings to chat only in debug mode, but always log them too 2017-05-22 17:31:17 -04:00
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