Commit graph

1122 commits

Author SHA1 Message Date
Celtic Minstrel
3715c194c2 Merge pull request #642 from Elvish-Hunter/set_variable_lua
Ported [set_variable] to Lua
2016-06-06 12:47:15 -04:00
Charles Dang
7c299ce418 Fixed [lift_fog] (bug #24680)
Firstly, there was a typo in the parse_fog_cfg utility function.

Secondly, wesnoth.get_sides returns a table of side proxy tables, not a
list of side numbers. I changed [lift_fog] and [reset_fog] to iterate through
the table returned by parse_fog_cfg.
2016-05-28 03:29:14 +11:00
dorng
2e5fb7cda7 fix [transform_unit] 2016-05-27 10:26:59 +02:00
Elvish_Hunter
8b82fb3248 [set_variable]: do not iterate through all the elements of a random range 2016-05-22 22:46:38 +02:00
gfgtdf
9757ab4158 fix [teleport] 2016-05-22 19:42:07 +02:00
gfgtdf
2fa8bc0350 cleanup lua feeding implementation. 2016-05-22 19:41:54 +02:00
gfgtdf
5de1d9b046 optimise [random_placement]
the cases distance=0 and distance = -1 now dont loop thougth all
possible locations anymore when removing a used location.
2016-05-20 14:42:49 +02:00
gfgtdf
2ba7ad5c43 move feedung event to lua
this has 2 advantages:
1) It decreased savefile size since the event is no longer sotred in
each savefile.
2) The ABILITY_FEEDING no longer assumes its used from within
[abilities]
2016-05-20 14:42:49 +02:00
Celtic Minstrel
af58b33aca [modify_unit] now supports dvs for modifications
This means [object], [advancement], and [trait] tags within [modify_unit]
can now use delayed_variable_substitution=yes.

This is currently needed for adding teleport, backstab, and leadership abilities.
2016-05-18 20:48:48 -04:00
Celtic Minstrel
15ec939fe0 Suppress deprecation messages unless in debug mode 2016-05-11 14:12:11 -04:00
Elvish_Hunter
00525c340b Implemented random ranges by using tables 2016-04-27 22:21:35 +02:00
Elvish_Hunter
5eb1784195 Re-evalutate the content of the variable in each operation 2016-04-13 22:35:45 +02:00
Elvish_Hunter
a61d3704e9 Fixed a misplaced end 2016-04-13 17:32:48 +02:00
Elvish_Hunter
3c6d3e93d7 Merged upstream/master 2016-04-13 17:27:14 +02:00
Elvish_Hunter
66ee214544 Allow executing multiple operations in the same [set_variable] tag 2016-04-13 15:49:37 +02:00
Elvish_Hunter
d6308cc6f7 Used helper.shallow_literal instead of cfg.__shallow_literal 2016-04-13 15:46:20 +02:00
Celtic Minstrel
73739a1989 Attempt to fix Travis build... again 2016-04-05 10:08:14 -04:00
Celtic Minstrel
7ee37b6f84 Attempt to fix Travis build 2016-04-05 03:19:26 -04:00
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