Commit graph

316 commits

Author SHA1 Message Date
Celtic Minstrel
b35a7f7352 Support root=cube and root=int in [set_variable]
(cherry-picked from commit 7a3d6f958a)
2018-10-07 03:18:39 +00:00
Celtic Minstrel
12ada04b8f Use wesnoth.format instead of string.format for translateable strings in [objectives]
(cherry-picked from commit 15ae9fcb0c)
2018-10-07 03:18:39 +00:00
Celtic Minstrel
b5b87ef373 Nicer handling of some Pango formatting attributes in [message]
(cherry-picked from commit c835e5b7e6)
2018-10-07 03:18:39 +00:00
Celtic Minstrel
05a45b8cd1 Handle speaker=id directly in [message] instead of relying on SUF
(cherry-picked from commit 2bd2a8b1b6)
2018-10-07 03:18:39 +00:00
Celtic Minstrel
52d3b7bb6a Support [set_variable]round=trunc
(cherry-picked from commit beb5dc75aa)
2018-10-07 03:18:38 +00:00
Celtic Minstrel
0d1df0f2d7 Fix unintended change to the semantics of [modify_side]income=
(cherry-picked from commit 79bc18fe95)
2018-10-07 03:18:37 +00:00
Celtic Minstrel
d72612443f Allow percentages in [random_placement]num_items=
(cherry-picked from commit 229d2f0483)
2018-10-07 03:18:19 +00:00
Celtic Minstrel
0131631220 Allow WFL for [random_placement]num_items=
(cherry-picked from commit e4a2c14177)
2018-10-07 03:18:18 +00:00
Celtic Minstrel
c023f7b222 Fix typo in 1dd411a84e
(cherry-picked from commit 4427ee1936)
2018-10-07 03:18:18 +00:00
Celtic Minstrel
02b6987158 Support to_location in [move_unit]
(cherry-picked from commit 1dd411a84e)
2018-10-07 03:18:13 +00:00
Celtic Minstrel
a314876bf2 Use new persistent tags interface for [object] [objectives] [item] 2018-03-17 17:16:23 -04:00
Celtic Minstrel
08ec9017b5 Lua API: Some tweaks of the experimental wml module 2018-03-17 16:48:00 -04:00
Charles Dang
0103959c36 Cleaned up deprecated API usage in core Lua
[ci skip]
2018-03-13 16:55:36 +11:00
Charles Dang
3489dac642 [heal_unit]: don't play healed animation if no healing is done
[ci skip]

Addresses #2530. Not closing that though, since the behavior might still be tweaked.

The healer will still play their own animation, if applicable (behavior option 2 in
the bug report).
2018-03-05 15:44:42 +11:00
Celtic Minstrel
aa0a3bebd1 Add suffix= and prefix= operations to [set_variable] 2018-03-04 22:03:16 -05:00
Celtic Minstrel
5fc9d8d173 Use new deprecated_message() function wherever possible (C++)
This also covers handling of legacy DescriptionWML for [set_menu_item],
and tweaks its handling in the other cases (mainly [multiplayer_side]).

I added the next_dev_version constant intending to use it, but then
decided not to do so; however I left it in in case someone finds it useful.
2018-03-04 21:21:33 -05:00
Celtic Minstrel
29942eec35 Expose side_name attribute to Lua API and [modify_side] 2018-02-18 12:53:00 -05:00
Charles Dang
c8abb8d5d9 Add formula= option to [set_variable] (change by @celticminstrel)
[ci skip]
2018-02-02 15:40:44 +11:00
vgaming
728204665c fix code problems found by luacheck (#2388)
fix code problems found by luacheck

Second iteration of the process, now handling data/lua/wml/*.lua

luacheck command used to find bugs:
  luacheck ./*.lua --globals wesnoth wml --codes --ignore 542 213
Additionally, error code 211 (unused variables) could be ignored,
as using underscore convention `_` is controversial in
wesnoth ( see https://github.com/wesnoth/wesnoth/pull/2380#discussion_r162519341 )

Actual bugs found:
* items.lua, access of global `write_name` instead of local `cfg.write_name`
* kill.lua, typo `primary_unit` -> `primary`
* bad code style: global `i` instead of local `i`
  (would conflict with 3-rd party code if it would use global `i`, too)
2018-01-23 13:35:04 -06:00
Jyrki Vesterinen
d81f230680 Clear unit death animation after killing the unit
This is another and much better way to fix the unit halo remaining.
2017-12-28 12:02:29 +02:00
Jyrki Vesterinen
f50c7d3f2a Revert "Work around unit halo not disappearing with [kill] animate=yes"
This reverts commit 70b468070b.

As I said in the commit message, the fix is not pretty, and
@CelticMinstrel said in IRC that a different fix would definitely be
better. I'll fix the problem by having an animation automatically
release the unit when done, instead (next commit).
2017-12-28 11:48:12 +02:00
Jyrki Vesterinen
70b468070b Work around unit halo not disappearing with [kill] animate=yes
The problem was that the kill animation retained a reference to the unit.
Triggering a Lua garbage collection (which destroys the animation object)
fixes it, although it's definitely not a pretty fix.

Closes pull request #2313.
2017-12-25 18:35:01 +02:00
Jyrki Vesterinen
e0e59ac463 Fix exception when [harm_unit] is used without an attacking unit
Regression from commit 38e31aa61f.
In particular, it broke WML unit tests.
2017-12-21 20:24:48 +02:00
Gregory A Lundberg
38e31aa61f Do not access non-existent unit
The [kill] tag can run animations. But it can also fire the `last breath` event, which can call [kill]. When we get back to the original [kill], the unit is gone, causing an error attempting to run the animations.

Added a check to ensure the unit is still on the map before we attempt to run the animations.

The Issue also requested that [harm_unit] pass the unit causing the harm into the [kill] tag so that `last breath` could use the secondary (killing) unit available like it does elsewhere.

Closes #2298
2017-12-19 15:05:24 -06:00
Jyrki Vesterinen
f064f50f1b [heal_unit]: Turn on floating text with animate=yes
I also moved the animation to be played *before* healing, which is the same
order as in C++ code. In the previous order, the animation isn't played for
some reason.

Fixes #2295.
2017-12-18 23:28:45 +02:00
Jyrki Vesterinen
d80d47eb8a [heal_unit]: fix wrong value of "hits" parameter
Only "hit", "miss" and "kill" are allowed.
2017-12-18 22:04:35 +02:00
sigurdfdragon
23c23b7a55 WML: Add [show_if] usage in [objectives] subtag [gold_carryover] 2017-11-22 20:27:13 -05:00
Jyrki Vesterinen
3b5880f5fb Fix #1980: [modify_unit] makes the unit disappear for a frame or two
Regression from commit d40a9e930b.

In that commit I removed a redraw after the death animation of a killed
unit has been played, but just to be safe, I then added a redraw after the
unit has been erased from the map. Turns out it's not a good idea because
[modify_unit] operates by killing and recreating the unit.

This commit simply removes the redraw after erasing. Hopefully we aren't
relying on [kill] triggering a redraw somewhere.

[ci skip]
2017-09-12 21:36:40 +03:00
Jyrki Vesterinen
d40a9e930b Fix [kill]ed units flashing briefly after death animation 2017-09-08 21:54:03 +03:00
gfgtdf
121c1cb007 fix wml tags using side.controller (#1740) 2017-05-29 11:58:29 +02: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
c67d524ced Fix [kill] not affecting recall list units 2017-05-22 17:31:20 -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
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
6efc5ae090 Replace helper.distance_between -> wesnoth.map.distance_between (fixes #1686) 2017-05-11 04:14:03 -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
2f0a6d13e4 Make [animate_unit] without flag an error (fixes #1678) 2017-05-10 17:40:16 -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
8d4cf3cf62 Shorten requires where possible 2017-05-03 02:42:25 -04:00