Commit graph

164 commits

Author SHA1 Message Date
gfgtdf
7f13156c28 Revert "Rename team_name/user_team_name to team_id/team_name (old syntax still valid)"
And related commits.

This reverts commit 545253ec2b.
This reverts commit 1215f65eb8.
This reverts commit 11664f4024.
This reverts commit e948df3424.
This reverts commit 3781e7839f.

This commits were reverted to exclude them from wesnoth 1.13.2 release because:
1) We are still unsure about the best name oftthese attributes
2) This breaks multiple campaigns, including LoW and the tutorial.
Feel free to revert this revert after 1.13.2 when thse issues can be solved..
2015-12-10 21:29:52 +01:00
gfgtdf
d7acb178d2 Revert "Added util function for converting an RGB string to color"
And also other commits that used that function.

This reverts commit 0d8c008018.
This reverts commit 956e5f9322.
This reverts commit 8f35c4bfcf.
This reverts commit dcb265ae70.

This commit just contained too many bugs, including:
1) string_to_color not parsing any input correctly
2) string_to_color segfaulting on some input strings
3) missing backwards compability in [unstore_unit]
2015-12-10 21:26:39 +01:00
Charles Dang
956e5f9322 Enable [print] color= and deprecate red,green,blue= keys 2015-12-10 22:06:34 +11:00
Charles Dang
8f35c4bfcf Pass color value directly to game_display::float_label
This is to allow color values created using different util functions -
ie, create_color() or string_to_color().
2015-12-10 22:06:33 +11:00
Celtic Minstrel
c5a08251a1 Lua API: Fix location in put_unit not working as 2nd/3rd param 2015-12-07 20:00:37 -05:00
gfgtdf
9aa6722622 improve performance of wesnoth.delay(0)
In this case we don't need to call SDL_GetTicks() or
game_display_->delay(10)
2015-12-07 15:43:56 +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
Ignacio R. Morelle
de44790d7d Make [*time_area] Lua API functions take a single time area id
This means the Lua code implementing the WML tags are now solely
responsible for parsing the comma-separated id list. It just so happens
that I added code for that without realizing that I was duplicating
existing functionality on the C++ side.

As a result:
 * wesnoth.add_time_area and wesnoth.remove_time_area can operate on
   time area ids that contain commas (if someone feels this is needed
   for some weird reason)
 * [time_area] no longer warns about adding time areas with commas in
   their ids (actually adding the first id of the list instead)
 * [time_area] remove=yes and [remove_time_area] still handle
   comma-separated lists of ids, in the Lua side instead of C++.

This makes the Lua API for this consistent with [event]/[remove_event].

Since the Lua API functions in question are undocumented at this moment,
it's unlikely this impacts anyone, really.
2015-11-26 23:29:16 -03:00
Charles Dang
3781e7839f Rename team_name/user_team_name to team_id/team_name (old syntax still valid) 2015-10-26 00:44:28 +11:00
Celtic Minstrel
e9cfef3b72 Lua API: Fix unit:vision() and unit:jamming() returning movement cost 2015-10-19 23:16:37 -04:00
gfgtdf
5438ec8a48 side specific variables.
http://gna.org/bugs/?23490

This makes it possible to store variables inside the side with the lua
functions get/set_side_variable. These variables are carried over along
other side specific data(units, gold)
2015-10-08 22:29:17 +02:00
gfgtdf
a77fada784 add access to tables via unit.variables
unit.variables now uses the same functionality as
wesnoth.get/set_variable (just for the unit variable instead of the game
variables) which makes it possible to access table values. Its also
posible to access subvariables as
unit.variables["list1[2].list2.length"]
2015-10-08 21:37:29 +02:00
gfgtdf
dd1b681d59 add support for overlays to lua units poxies 2015-10-07 18:44:36 +02:00
Celtic Minstrel
21e06ef482 Add accuracy/parry to Lua unit attacks table 2015-10-06 22:49:38 -04:00
Celtic Minstrel
af7ba3e527 Fix spelling 2015-10-06 22:13:57 -04:00
gfgtdf
83cc82185e add custom [effect]s with wesnoth.effects
Note that is not possible to use untore_unit/put unit inside those
effects becasue it will casue infinite recirsion.

Intead you can eigher use direct lua unit modification or use reuse
effects with wesnoth.add_modification(u, ..., , ..., false)

The main problem here was, that [effect]s are often applied in unit's
constructor where is was previously not possible to create a lua_unit
refering to that unit, to fix that i had to change lua_unit, luaW_checkunit
and luaW_getunit.
2015-10-06 00:15:04 +02:00
gfgtdf
11d6c3f199 fix assertion failue in wesnth.random 2015-10-06 00:14:59 +02:00
gfgtdf
eaa192ffa8 fix [lua] tags beeing lost on reload 2015-10-06 00:14:57 +02:00
gfgtdf
f74d89d166 more lua modifyable unit properties 2015-10-06 00:14:55 +02:00
Celtic Minstrel
e00b57cdcd Lua API: Change wesnoth.put_unit, add wesnoth.erase_unit 2015-09-23 22:22:03 -04:00
Celtic Minstrel
6a60f79d15 Lua API: Add wesnoth.unit_(vision|jamming)_cost 2015-09-23 22:21:55 -04:00
Celtic Minstrel
ffe8b4baa7 Lua API: Change wesnoth.get_unit, removing 1-argument underlying ID form
- Removes 1-argument form accepting an integer ID
- Adds 1-argument form accepting a string ID
- Now accepts locations either as 2 arguments or as {i,j} or {x=i,y=j}
2015-09-23 22:21:42 -04:00
Celtic Minstrel
2b5c887f6b Lua API: Let wesnoth.message accept translatable strings 2015-09-23 22:21:31 -04:00
Celtic Minstrel
a20c88c8a3 Simplify unit method names 2015-09-23 22:21:23 -04:00
Celtic Minstrel
0b42f43d2a Lua API: Add some existing wesnoth.* functions as proxy unit methods 2015-09-23 22:21:16 -04:00
gfgtdf
2c245afdc2 add description parameter to wesnoth.synchronize_choice(s)
and removed the 'tagname' parmaeter which is now always "input"
2015-09-21 00:13:56 +02:00
gfgtdf
61fabacd36 fix compiler warnings. 2015-09-20 22:32:22 +02:00
gfgtdf
3c11aa63f8 move get_user_choice function to a new file 2015-09-20 21:52:47 +02:00
gfgtdf
9c9f8f5a6e split wesnoth.synchronize_choice function
previously there was one function which sometimes returned a wml table
and sometimes a map integer to wml tables dependent on its parameters.

Now there are 2 different functions: wesnoth.synchronize_choice and
wesnoth.synchronize_choices. the first one handles the case where you just
want to get a choice from one side and thus it returns just one wml
table. The second function handles the case where you want to get
choices from multiple sides. that function retruns a table of wml
tables.

I also added an optional string parameter to that function specifying
the type of that choice (this is useful to make replays more robust and
readable)
2015-09-20 21:47:31 +02:00
Celtic Minstrel
e74c119b9b Merge pull request #488 from CelticMinstrel/backstab 2015-09-19 15:42:35 -04:00
Celtic Minstrel
4ca0aeb506 Expose the extra filter unit to the Lua API 2015-09-19 12:31:12 -04:00
Celtic Minstrel
907d527cc3 Lua API: Replace wesnoth.skipping_replay() with is_skipping_messages() and skip_messages() 2015-09-19 12:13:40 -04:00
Celtic Minstrel
376020097f Port [object] ActionWML tag from C++ to Lua
Lua API additions:
- wesnoth.show_popup_dialog()
- optional write_to_mods parameter to wesnoth.add_modification
2015-09-19 12:13:25 -04:00
Celtic Minstrel
d4835b0157 Port [message] ActionWML tag from C++ to Lua
Lua API additions:
- wesnoth.skipping_replay()
- wesnoth.deselect_hex()

Note: vultraz and aetheryn deserve partial credit for the Lua implementation
2015-09-19 12:13:23 -04:00
Ignacio R. Morelle
928b6e8008 Comment spelling fixes 2015-09-15 23:22:37 -03:00
gfgtdf
f01252a42c add [unsynced] actionwml
This can be used like in the following example (note that without the
[unsynced] it would cause OOS becasue rand= might or might not be
called.):

[unsynced]
[store_side]
variable = "side"
side = "$side_number"
[/store_side]
[if]
[variable]
name = "side.controller"
equals = "human"
[/variable]
[then]
[set_variable]
name = "num"
rand = _ "two,four,seven"
[/set_variable]
[message]
message = _ "I want $num stones"
[/message]
[/then]
[/if]
[unsynced]
2015-09-11 22:33:30 +02:00
gfgtdf
12e839b9b7 remove level_ member of game_lua_kernel
the intention is to be able to remove the level cfg.
2015-09-09 16:31:30 +02:00
Ignacio R. Morelle
df9908932d Merge branch 'amla' of https://github.com/CelticMinstrel/wesnoth into staging/pr-468 2015-08-23 21:40:31 -03:00
Nils Kneuper
c51c913156 converted some old C style casts to new c++ style casts
Those casts created warnings that broke building with cmake and gcc 4.9.3.
2015-08-23 11:05:06 +02:00
Celtic Minstrel
ad62e1d4fd Add deprecated warnings for [advance] 2015-08-22 23:43:50 -04:00
Celtic Minstrel
7a5ba33f5a Change [advance] modifications to [advancement]
This change maintains backwards compatibility
- [advance] will still work if present
- attempts to add [advance] via Lua will instead add [advancement].
2015-08-22 07:58:47 -04:00
Celtic Minstrel
af6d3060e2 Add new "category" and "creator" properties to map labels
- The "category" property is mainly for use by scenario designers; players will be able to hide labels based on this
- The "creator" property is meant to allow players to hide labels placed by specific other players
- Map editor allows setting the "category" property
2015-08-06 23:27:11 -04:00
gfgtdf
2cd2cf47c0 add wesnoth.random lua function
wesnoth.random has the same interface as math.random. So it can
substitute that function easily.
2015-08-04 22:36:52 +02:00
gfgtdf
49219ad0fd add team share_vision=all/shroud/none
previously there were 2 flags share_view=yes/no and share_maps=yes/no,
but only 3 possible settings (share both, share none, only share shroud)
(so share_maps= was ignored if share_viewv=yes). This made the wml code and
the c++ code needlessly complicated.

Now these 2 flags are replaced by share_vision=all/shroud/none
2015-07-23 14:00:08 +02:00
gfgtdf
1cbde8d0d3 simplify wesnoth.set_next_scenario and wesnoth.set_end_campaign_credits
luaL_checkstring never returns NULL so we can skip this check.
2015-07-21 17:32:34 +02:00
Elvish_Hunter
4360679c2a Upstream merged 2015-07-15 20:48:48 +02:00
gfgtdf
55662b9960 add parameter to wesnoth.allow_undo
now it can also disallow undoing.
https://gna.org/bugs/?23506
2015-07-14 18:21:38 +02:00
gfgtdf
31796c0b46 add wesnoth,.current.event_context.unit_x/y
http://gna.org/bugs/?23507
2015-07-14 15:32:29 +02:00
Ignacio R. Morelle
bcfdc85568 Use prefix instead of postfix increment/decrement
Found by cppcheck.
2015-07-06 22:31:24 -03:00
gfgtdf
fc220fee26 make units advancements modifyable in lua.
http://gna.org/bugs/?23677

units advancements is an array of wml tables.

This also adds template lua_push/lua_check functions wich also accept
vectors or similar. The file scripting/push_check.hpp was written using msvc
which implements look-up in template functions differently so it might be
necessary to fix it for other compilers by adding forward declarations of
those template functions.
2015-07-06 23:26:21 +02:00