603 Commits

Author SHA1 Message Date
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
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
690acf9b79 Allow wesnoth.require to load a whole directory in one call
- Use this feature when loading the WML tags from data/lua/wml
2017-05-03 02:43:13 -04:00
Celtic Minstrel
8d4cf3cf62 Shorten requires where possible 2017-05-03 02:42:25 -04:00
Celtic Minstrel
6b74f91b2f Allow shorter module name specification in wesnoth.require
Basically, you can now omit the "lua/" prefix and the ".lua" suffix.
If necessary, they will automatically be applied for you.
2017-05-03 02:42:17 -04:00
Celtic Minstrel
072ddc4dc1 Reimplement wesnoth.require function in Lua 2017-05-03 02:40:34 -04:00
Celtic Minstrel
efb0fe05e9 Accept [story] as ActionWML 2017-05-02 20:49:10 -04:00
Celtic Minstrel
eb0947c863 Some improvements to the new Lua music API
- Allow removing a track by index and fixup the "set track" interface
- Commit music changes only after event completes, not after any control=flow tag is executed
- Allow inserting a track into the middle of the playlist
- Allow assigning a config to an existing track to overwrite it
- Use std::find when checking for duplicate tracks
2017-04-27 17:09:16 -04:00
Celtic Minstrel
5b4dbe1c61 Port [volume] to Lua
This also fixes [volume] considering 100% to be an invalid volume.
2017-04-27 17:09:05 -04:00
Celtic Minstrel
6906ced4e7 Properly port [music] to Lua 2017-04-27 17:09:03 -04:00
Celtic Minstrel
0a591cd424 Properly port [scroll] to Lua 2017-04-27 17:05:53 -04:00
Celtic Minstrel
339587ee2b Properly port [kill] to Lua 2017-04-27 16:55:38 -04:00
Celtic Minstrel
66f4c2ba3d Add WML tag to change the map zoom level 2017-04-24 12:04:23 -04:00
Celtic Minstrel
1fb4d36ef8 Enable scenarios to change theme in an event 2017-04-24 11:01:12 -04:00
Celtic Minstrel
3d0bd73803 Fix behaviour of [heal_unit]amount= for negative/zero values (#979) 2017-04-10 21:58:46 -04:00
Celtic Minstrel
3f61eda282 Fix [animate_unit]amount=0 healing 1 hp 2017-04-10 21:31:15 -04:00
Celtic Minstrel
7835e05d93 Fix [animate_unit][facing] not working.
This also tweaks the animator:add() API, replacing the facing key
with a target key and requiring it to be an adjacent location.
2017-04-09 01:29:10 -04:00
Jeffrey 'Sigurd' Westcoat
ec2d734acd WML: Add base_income key to [store_side] (#976) 2017-04-08 19:05:49 -04:00
gfgtdf
8c4e09e940 allow to to use a custom rng in helper.rand 2017-04-07 15:05:56 +02:00
Celtic Minstrel
0c4b05ee2a Some fixes to [heal_unit]animate=yes
- Play the healed animation
- Pass the heal amount to both animations
2017-03-27 01:07:33 -04:00
Celtic Minstrel
701649a75e Fix [heal_unit] attempting to animate even if filter didn't match a unit 2017-03-26 00:15:38 -04:00
gfgtdf
cbd3c2644c add lua end_music setter/getter
this also refactors some play_controller members and moves them
to game_data

this also adds a scenario_id getter in lua.
2017-03-23 18:08:16 +01:00
gfgtdf
bd6a0c69d1 replace wesnoth.set_next_scenario() with wesnoth.game_config.next_scenario setter/getter 2017-03-20 02:48:03 +01:00
Celtic Minstrel
1a1a893a4c Update [heal_unit] to use new animation API calls 2017-03-20 12:00:21 +11:00
sigurdfdragon
0ea5ae07ce Add more keys to store_side 2017-03-17 19:26:20 -04:00
Celtic Minstrel
b16728c78e Fix [heal_unit] not restoring statuses by default (GNA25605) 2017-03-17 10:58:06 -04:00
sigurdfdragon
9423e47bab Fixup [unstore_unit] Lua port
Restores check_passability default of yes.
Fixes 50a9a25ae7a84da43a0bcc80287a3a9c119adc22
2017-03-14 23:51:06 -04:00
Charles Dang
15f8ac3c80 Fixed error in [modify_side] shroud_data= 2017-03-14 11:52:20 +11:00
Celtic Minstrel
5437c89bc8 fixup! Address missing component error in [modify_ai] (GNA25558) 2017-03-12 20:32:52 -04:00
Celtic Minstrel
72f9a4f270 Fix [heal_unit] not defaulting to amount=full (GNA25586) 2017-03-12 15:18:57 -04:00
Celtic Minstrel
070e4b6f8c Address missing component error in [modify_ai] (GNA25558) 2017-03-12 15:15:37 -04:00
Celtic Minstrel
d84a52dc45 Fix incorrect API table name in [animate_unit] (GNA25550) 2017-03-12 14:49:52 -04:00
Celtic Minstrel
df0a665571 Fix wrong function name in [modify_side] implementation 2017-03-10 16:15:40 -05:00
Celtic Minstrel
6fe8e65502 another fixup 6de1c9441f25
Missed a usage of the potentially-nil value
2017-03-10 16:13:29 -05:00
Celtic Minstrel
6de1c9441f Fix some [modify_ai] isses (addresses GNA25558)
As far as I can tell, the most likely cause of the bug was that several
cases of [modify_ai]action=add were called with a path that lacked the final
empty braces at the end of the path.

This commit makes both the tag and the underlying Lua API calls explicitly
handle this case as if the final empty braces were, in fact, present.
2017-03-10 00:12:11 -05:00
Celtic Minstrel
7488d6094c Fix error in [heal_unit] (GNA25578)
The helper.get_child function was being called incorrectly.
2017-03-08 21:05:27 -05:00
Charles Dang
d89730410b Improve ensure_config error messages 2017-03-01 11:58:33 +11:00
Celtic Minstrel
80cdac5b89 fixup! Improve error message when Lua config helper functions are not passed a config as the first argument 2017-02-28 19:15:57 -05:00
Celtic Minstrel
8319fee1f8 Improve error message when Lua config helper functions are not passed a config as the first argument 2017-02-28 19:03:41 -05:00