Commit graph

512 commits

Author SHA1 Message Date
gfgtdf
60d114b606 finish moving cavegen (cave_map_generator.cpp) to lua.
This map generator is used in HttT 17 and SoF 4. which needed to be updated aswell.

With this we finally have a lua generator that is used in mainline and that
can be used an an example by wml authors who want to write other map generators.

Unfortunateley there are still umc add ons in 1.12 that use
scenario_generation=cave so i didn't remove the cpp implementation yet.
2016-09-17 20:52:49 +02:00
Gregory A Lundberg
6af699fdf3 Fix bug: 'text' is nil 2016-09-10 14:20:04 -05:00
Gregory A Lundberg
65134d6f0f [role] always error on missing role= 2016-09-01 20:14:15 -05:00
Celtic Minstrel
742b4b0be3 Fix an issue with translatable strings that included a possible plural 2016-08-31 21:01:17 -04:00
Celtic Minstrel
3f7db7f878 Give error on missing role= in [role] without [auto_recall] 2016-08-31 20:59:58 -04:00
Gregory A Lundberg
fcbb72d8d0 Fix bug [role] missing role=
Missing role for [role] caused runtime errors. Do NOT report an error on this; using an empty string is intentional. It allows type-prioritized recalls!

"I want to recall the two highest-level bowmen and, if needed, will recruit them. They don't have a role, and won't need one later."

        [repeat]
            times=2
            [do]
                [role]
                    search_recall_list=only
                    type=Master Bowman,Longbowman,Bowman
                    [auto_recall][/auto_recall]
                    [else]
                        [unit]
                            placement=leader
                            side=1
                            type=Bowman
                        [/unit]
                    [/else]
                [/role]
            [/do]
        [/repeat]
2016-08-31 12:51:00 -05:00
Celtic Minstrel
b24fdbcbe1 Merge pull request #759 from GregoryLundberg/GL_modify_unit_mode
Add mode=replace to [modify_unit]
2016-08-30 12:31:23 -04:00
Charles Dang
ae6b8f97f2 Temporary fix for broken Objective dialog formatting (f866039e81) 2016-08-30 18:55:17 +11:00
Celtic Minstrel
f866039e81 Add support for gettext plurals to Lua API 2016-08-29 16:47:17 -04:00
Gregory A Lundberg
82c3b0114d Add mode=replace to [modify_unit]
When specified, replace rather than merge the [unit] sub-tags. Does not effect [object], [trait], [effect] or [advancement].

For example:
    [modify_unit]
        [filter]
            id=Deoran
        [/filter]
        mode=replace

        [filter_recall]
            [not]
                id="Sir Gerrick"
            [/not]
        [/filter_recall]
    [/modify_unit]

will replace the current contents of [filter_recall] with the given contents. Without mode=replace, the contents would be appended to the previous contents.
2016-08-24 19:35:06 -05:00
Charles Dang
30fe0cecd8 Fixed bug in [unstore_unit] when unstoring from variable 2016-08-24 23:42:02 +11:00
Gregory A Lundberg
e1c39430de Remove dead code
Tested with just cfg.message and it comes out as info/wml which seems just fine.
2016-08-22 09:24:09 -05:00
Gregory A Lundberg
9d44a45f88 Fix bug with gender-specific messages in [message] 2016-08-19 20:43:50 -05:00
Gregory A Lundberg
f0ad540001 Add result variable to [message] tag
If [message] includes one or more [option] choices, store the choice index in the result variable.
2016-08-14 00:19:11 -05:00
Gregory A Lundberg
5f9a711dab Fix the fix (#746)
I have SO got to check I pressed Save before I press Commit! This time it bit me because it got merged so quickly.
2016-08-12 14:32:55 -04:00
Gregory A Lundberg
652c5b9b0d Do not select unit in silent object
This causes, for example, units the player does not control to be selected at the start of HttT S08, S11 and S16.
2016-08-12 13:16:07 -05:00
Celtic Minstrel
f4ac23a3c5 Allow [endlevel] to be used in victory or defeat events 2016-08-08 04:09:32 -04:00
fendrin
b9d2ec4409 Renamed [foreach] variable= to array= and item_var= to variable= 2016-08-06 06:20:41 +02:00
Charles Dang
7b22051c3c Merge pull request #721 from GregoryLundberg/GL_lua_objectives
objectives.lua show_turn_counter in white
2016-08-05 21:00:56 +11:00
Celtic Minstrel
53828a01b9 New [remove_object] WML tag 2016-08-02 00:52:52 -04:00
Celtic Minstrel
6dab777f66 Accept [effect] in [modify_unit] 2016-08-02 00:01:48 -04:00
Gregory A Lundberg
ee8778a6d7 objectives.lua show_turn_counter in white
This matches the style used for OBJECTIVE_FOOTNOTE and makes the turn count more apparent.
2016-08-01 20:22:15 -05:00
Celtic Minstrel
dc3d22a5e4 Merge pull request #710 from spixi/call_events_by_id
Allow firing an event by id instead of name.
2016-07-30 01:21:12 -04:00
Gregory A Lundberg
b064328102 New features for [role]
Add search_recall_list=only to search the recall list, but not the map
This is intended as a more clear way of doing 'x,y=recall,recall' and omitting search_recall_list. Note that search_recall_list=no with x,y=recall,recall produces a useless [role] which only runs the [else] block(s).

Add reassign attribute
Optional attribute, default 'yes'. If 'no' then do not re-assign the role if a unit already has the role. If 'no' and no unit has the role, the role is still assigned.

Refactor auto_recall as a sub-tag
Instead of a yes|no attribute, if there is an [auto_recall] sub-tag then recall the unit from the recall list. This acts as a [recall] tag without any StandardUnitFilterto which we add id=$unit.id and issue the recall.
2016-07-29 18:18:53 -05:00
Spixi
5588642c81 Allow firing an event by id instead of name. 2016-07-23 12:23:19 +02:00
Bär Halberkamp
1d8d843a80 move set_variable.rand's logic to helper.rand 2016-07-19 13:48:31 -04:00
Celtic Minstrel
36eeed413c Comment fixup 2016-07-17 19:51:09 -04:00
Bär Halberkamp
0a83e2e6b6 Fix [message]s without an image not working 2016-07-17 19:49:29 -04:00
gfgtdf
1d168bce9a fixup on_event.lua 2016-07-16 20:34:33 +02:00
Celtic Minstrel
6abd7a6941 Add [message]image_pos=left|right
This is meant to replace ~RIGHT() and also the newer ~LEFT(),
with one exception: ~RIGHT() will still be the standard way to
make a unit's portrait go on the right by default.
2016-07-15 17:35:51 -04:00
gfgtdf
ceea75cf0a replace some victory with scenario_end events.
victory is an unsynced event to its potentially unsafe to change the
gamestate in it, this mostly effects LoW (which can be played as a mp
campaign) where i replaced most victory events.

But it also effects sp becasue it can casue bugs to create units in
unsynced events which are used later (here: in later scenarios), so i
replaced also all sp victory events that do that.

Note that the 'scenario_end event'+'proceed_to_next_scenario filter' has
a slightly different meaning than 'victory event': the second gets fired
when there is a local human side who won the scneario while the first
gets fired if there is any human side who on the scenario. In sp this
is the same since there are no remote human sides, but in mp this is the
reason why the first is synced and the second is not.

We could add a seperate event for this case ("before next scenario" or
similar) for easier use, but i didn't find a good name for
that yet.
2016-07-14 22:15:33 +02:00
Celtic Minstrel
d4b8fec953 New features in [role] WML tag
- search_recall_list=yes|no (default yes)
- [else] tag which is run if no unit matches
- auto_recall=yes|no (default no) which recalls the unit if it's on the recall list
2016-07-11 20:13:57 -04:00
ln-zookeeper
937df219c9 Don't issue a warning when no unit found for [role] 2016-07-11 23:41:33 +03:00
gfgtdf
d73d32e8e2 fixup on_event.lua 2016-07-11 15:12:12 +02:00
gfgtdf
9a5eabb207 fixup on_event.lua 2016-07-11 15:09:25 +02:00
gfgtdf
ac717f70b8 improve on_event.lua
Added some features:
1) on_event now supports a comma separated list of event names in its first parameter

2) on_event now supports a number as second parameter that specifies in which order the event handlers are called.

3) on_event now passes wesnoth.current.event_context to the handler function, since the handler function will most likeley need it.
2016-07-11 14:01:04 +02:00
gfgtdf
16014a9795 fix [set_variable] rand= 2016-07-09 21:42:10 +02:00
gfgtdf
40ff1ec986 make utils.split return empty set on nil values
previously it returned a "nil" string
2016-07-09 21:01:35 +02:00
Charles Dang
240b940618 Fixed [teleport] not working 2016-07-03 04:34:54 +11:00
Pentarctagon
d22b15b19b Add color=value to [message] (#651)
Add support for the pango attributes as keys in [message]
This is equivalent to surrounding the entire string in a span with the specified attribtues.
2016-06-06 12:50:49 -04:00
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