Commit graph

171 commits

Author SHA1 Message Date
Celtic Minstrel
840b6e70be Fix [modify_side]reset_maps=true
I have no idea how this was missed...
2021-02-22 21:26:30 -05:00
Celtic Minstrel
2271de81b7 Promote deprecation warning for [option]message= to level 3
Addresses #3980
2021-02-22 21:26:05 -05:00
newfrenchy83
698066d2d1 [heal_unit]: clear the animation after playing it (#3526)
Fixes another case of unit halo remaining after death.
2018-09-07 19:38:41 +03:00
Jyrki Vesterinen
4666ae8c23 [animate_unit]: clear the animation after playing it
This avoids a reference to the unit from being leaked, which prevented the
unit's halo (if any) from disappearing when the unit died.

Fixes #3509. Closes #3520.
2018-09-06 20:14:16 +03:00
josteph
167d56519e WML: Don't add a \n before condition=lose objectives if there are no objectives listed before them. 2018-07-04 20:15:59 -04:00
Andras Szell
cc04bc764a Fix: add redraw to narrator's message so village count is refreshed
Fixes: https://forums.wesnoth.org/viewtopic.php?f=21&t=48370

In the tutorial when we occupy the first village the message tells us the
village count got incremented, but in the old version it was incremented
only afterwards. Non-narrator messages were updated properly. By adding the
redraw, narrator messages triggered by capture event produce the same
result as other speakers.
2018-06-26 18:44:08 +11:00
Iris Morelle
1b7557a2ca Fall back to the unit type name for [message] captions for nameless units
Fixes #3211.
2018-06-05 04:44:23 -04:00
Iris Morelle
79812a853e Don't allow [kill] animate=yes to scroll to units through fog and shroud
Restores 1.12's behaviour.
2018-06-04 16:15:30 -04:00
Iris Morelle
d2e94b320f Do not allow [message] to scroll to units through fog/shroud
This was a regression from 1.12.
2018-05-21 23:23:00 -04:00
mattsc
51b2dbec19 Lua code: replace deprecated wesnoth.set_variable() calls 2018-05-12 17:41:28 -07:00
mattsc
2922b19802 Lua code: replace deprecated wesnoth.get_variable() calls 2018-05-10 19:55:31 -07:00
mattsc
32170543fd Lua code: replace deprecated wesnoth.tovconfig() calls 2018-05-10 19:54:59 -07:00
Jyrki Vesterinen
77b9bc3969 [heal_unit]: ensure that heal amount is an integer 2018-04-16 20:52:17 +03:00
gfgtdf
56cf77e3a0
fix [message] side_for= not working for the last side.
fixes #2776
2018-04-04 18:21:56 +02:00
Celtic Minstrel
cfceec1d58
Fix unintended change to the semantics of [modify_side]income= 2018-03-30 11:05:58 -04: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