504 Commits

Author SHA1 Message Date
Celtic Minstrel
5cf12798ce Port "trivial" WML tags to Lua
This is more about adding Lua API for things that should have it than porting WML tags to Lua.
The following new Lua API functions have been added to the wesnoth table:
- add_fog, remove_fog
- add_sound_source, remove_sound_source, get_sound_source
- log
2016-04-05 02:24:42 -04:00
Celtic Minstrel
a275f22ebe Fix potential "image is nil" error in [message] 2016-04-04 20:55:45 -04:00
Celtic Minstrel
d3374d3670 WML tags fixup 2016-04-04 20:10:52 -04:00
Celtic Minstrel
a791909544 Split the more complicated WML tags into separate Lua files 2016-04-04 17:03:38 -04:00
Elvish_Hunter
d6747f5098 Ported [set_variable] to Lua 2016-04-04 21:23:00 +02:00
Celtic Minstrel
7c37ad57bd Two new [message] features
- ~LEFT() does the opposite of ~RIGHT(), but takes higher priority;
  use it to force an image to the left that's normally on the right
  (eg female silver mage)
- image=~RIGHT() means "use normal portrait, but on the right"
2016-04-02 15:15:31 -04:00
Celtic Minstrel
1c27cafa74 Add highlight=yes|no to [scroll_to], [scroll_to_unit], [message]
Defaults to no in the first two cases, yes in the third
If yes, the target hex is outlined.
2016-03-20 02:55:12 -04:00
mattsc
bce1fae063 Fix portrait missing in [message] with empty image= key
This is mostly important for use of the MESSAGE macro.  Use image=none
if no image/portrait is supposed to be shown.
2016-03-19 14:25:28 -07:00
Celtic Minstrel
2e6ad2bee3 Add wesnoth.select_unit(), deprecate wesnoth.select_hex()
wesnoth.select_unit() is also callable as u:select() where u is a unit
2016-03-16 12:51:31 -04:00
Celtic Minstrel
ecb3dc6c46 Error if looping tags lack [do] 2016-03-14 13:15:04 -04:00
Celtic Minstrel
c1b6060e4b Fix cleanup of [foreach] scope 2016-03-14 13:15:03 -04:00
gfgtdf
986550c040 move [teleport] actionwml to lua. 2016-03-14 14:42:05 +01:00
gfgtdf
50a9a25ae7 move [unstore_unit] definition to lua
This also adds a 'color' parameter to wesnoth.float_label. It was already
previously possible to set a labels color using pango markup, but to
implement [unstore_unit] i need to support the color= syntax as given
by [unstore_unit]

This also adds a 'fire_event' parameter to wesnoth.put_unit to specify
whether the 'unit_placed' event is fired, this is needed to implement
fire_events=yes/no in [unstore_unit] but its also generally useful
for the same reason why [unstore_unit] has this parameter.
2016-03-14 14:41:45 +01:00
Charles Dang
b512ad2143 Make [message] use wesnoth.highlight_hex() 2016-03-14 09:42:04 +11:00
Charles Dang
6aa060ed06 Fixed [put_to_recall_list] (bug #24390)
put_recall_unit() already deals with erasing it from the map, rendering
this erase_unit() call redundant and harmful.
2016-03-05 11:55:40 +11:00
ln-zookeeper
93a7f5e599 Fixed the last character of [objectives] note= getting eaten 2016-02-14 02:12:01 +02:00
Celtic Minstrel
1873b38243 Demote [option] deprecated message even further 2016-02-13 18:42:02 -05:00
Celtic Minstrel
d28365730b Demote [option] deprecated message to log 2016-02-13 18:23:07 -05:00
gfgtdf
5caa9dd95b cleanup wml_actions.store_items 2016-02-03 22:58:23 +01:00
gfgtdf
08236f8953 added name= attribute to [item]
name= has no effect but can be used to delete the item. I also changed
[item] to automatically create an id (in case no id was given) and
return that (only usable if called from lua).

I used the id= field from overlay class for this, it was previously only
used by the editor. Not sure if it is a good idea to reuse the id field.
2016-01-31 02:25:46 +01:00
CelticMinstrel
ac77c262bd Merge pull request #578 from CelticMinstrel/fix-message
Fix [message] issues
2016-01-09 00:50:14 -05:00
Celtic Minstrel
4d2e4e2dbc Don't needlessly preparse [message][command]
Fixes bug #24288
2016-01-08 23:14:54 -05:00
Celtic Minstrel
129418e2f9 Outline the speaker's hex in [message]
Unfortunately, this also highlights the speaker's reach.
2016-01-02 22:20:36 -05:00
Celtic Minstrel
2e293fb61d Apply TC to unit sprites in [message] 2016-01-02 20:36:29 -05:00
Celtic Minstrel
fa9a394987 Deselect speaker after [message] 2016-01-02 20:36:27 -05:00
Celtic Minstrel
64ddd50895 Fix [for] loop not iterating the correct number of times
(when the array length changes during the loop)
2015-12-29 23:40:36 -05:00
gfgtdf
571014f374 remove undocumented [wml_action] tag
there is no reason to use this when lua code can easily add a function
to wesnoth.wml_actions directly.
2015-12-21 23:32:47 +01:00
gfgtdf
4c955e7461 don't use __shallow_literal directly
the passed config might not be a vconfig.
2015-12-21 20:53:47 +01:00
gfgtdf
1eefcddc17 use wesnoth.advance_unit to advance units in [harm_unit] 2015-12-21 20:53:45 +01:00
gfgtdf
b4e5f16d74 improve formatting in lua code.
This also fixes a bug in [harm_unit] where a second arument was passed
to wml_actions.animate_unit which was obviously meant to be part of the
first argument.

This also changes harm_unit to use wml_actions.animate_unit instead of
wesnoth.animate_unit becasue the former is better known an thus easier
to understand.
2015-12-21 20:53:44 +01:00
gfgtdf
203f7b0ded clenaup DW scenario9 scorpion placement code. 2015-12-21 13:11:14 +01:00
gfgtdf
3b9a0fdb15 fix bonus=yes/no in [endlevel]
http://gna.org/bugs/?24191
2015-12-17 01:28:46 +01:00
gfgtdf
ab1a4629a9 rename [filter] -> [filter_location] in [random_placement] 2015-12-10 01:43:32 +01:00
gfgtdf
442a2292a2 fixup removal of [side]name= 2015-12-08 14:52:20 +01:00
gfgtdf
9d656ad755 update [randon_placement]
removes use_delay: one could easily use [delay] inside [command] so
there is no reason to have that there.
changes 'radius' -> 'min_distance'
removes a debugging message
2015-12-07 22:31:56 +01:00
gfgtdf
5db889eb14 reset variable after [random_placement]
none of the usecases found in mainline or in UMC use that variable
afterwards so there is no reason to keep it.
2015-12-07 21:49:15 +01:00
gfgtdf
dc786dc181 add tag [random_placement]
and use it to implement SCATTER_IMAGE,SCATTER_EMBELLISHMENTS and
SCATTER_UNITS
2015-12-07 21:49:09 +01:00
gfgtdf
d755d3b820 add [endlevel] bonus=number
instead of bonus=yes/no you can also pass a number, so bonus=0.5 will
give you only half of the bonus gold.
2015-11-30 02:49:08 +01:00
gfgtdf
91943451c7 move most of [endlevel] implementation to lua
as a side effect we get read/write fields
side.carryover_bonus/carryover_add/carryover_percentage in lua sides.
2015-11-30 02:49:01 +01:00
gfgtdf
59233ce903 attempt to fix bug in [message]
previously this bug http://i.imgur.com/9B7bquA.png happend in LoW scenario3.
2015-11-27 18:13:07 +01:00
Ignacio R. Morelle
9d85887ed1 Add [remove_time_area] and allow [time_area] remove=yes to take an id list
[remove_time_area] is syntatic sugar but it's used to implement
[time_area] remove=yes now, just like [remove_event]/[event].
2015-11-26 22:38:03 -03:00
Celtic Minstrel
9d3f1e5c9d Fix some issues with [test_condition] 2015-10-06 16:23:55 -04:00
Celtic Minstrel
8a7f71578d Add (male|female)_message to [message] 2015-10-06 15:03:55 -04:00
Celtic Minstrel
f8e897e8dd Change [explain] to [test_condition] 2015-10-06 14:45:29 -04:00
Celtic Minstrel
9724d98d44 string.format blows up on booleans 2015-10-06 14:45:05 -04:00
Celtic Minstrel
5353dfb439 Use return instead of goto in [while] 2015-10-06 13:51:28 -04:00
Celtic Minstrel
aa2e24d1b7 Finally fix all the [for] issues. Probably.
(With unit tests to back it up!)

- Fixes [for]step=0
- Fixes [for]start,stop=0,0
- Fixes [for]start,end,step=0,1,-1
- Probably fixes several other things too
2015-10-06 13:51:28 -04:00
Celtic Minstrel
fd34675dd9 Add an [explain] WML tag
This explains (in the log) why a WML conditional has failed (or succeeded). Currently it is fairly basic, looping through and/or/not and printing out the specific conditional tag that failed as well as, for [variable], the current content of the variable.

It's used in the WML unit tests system, but could also be useful for debugging.

This commit also fixes an issue with passing multiple -a arguments to run_wml_tests.
2015-10-06 13:51:27 -04:00
CelticMinstrel
33385f97b8 Merge pull request #499 from CelticMinstrel/lua-unit
Lua API changes (mainly relating to units)
2015-10-03 21:13:04 -04:00
Celtic Minstrel
74152fc2cb Fix [object] without a filter 2015-10-01 16:13:19 -04:00