Commit graph

273 commits

Author SHA1 Message Date
newfrenchy83
985ea1113a
Fix indentation in schema 2023-08-17 21:38:56 +02:00
Steve Cotton
cc8dddea6e Support negative numbers in ranges
Adds support for using these in the weapons and ability filters:
* "-1", which was previously treated as an parse error (no number before the separator).
* "-3--1"
* "-infinity" as the lower number in the range, provided a different upper number is given.

This treats "-infinity" (with no other number), "-infinity--infinity",
"infinity" (with no other number) and "infinity-infinity" as errors. It seems
unlikely that someone would intend to use a filter that can't match any
reasonable number.

The range "-infinity-infinity" will be parsed successfully. I don't see a use
case for that, but nor do I see a reason to add extra C++ to reject it.
However, it's not added to the schema, as I think it's good for the schema to
give a warning when someone creates a filter which will accept every value
(including accepting the default, so "-infinity-infinity" accepts the unset
value too).

Includes new unit tests for the C++ and the Lua stringx.parse_range functions.
The next commit adds more WML tests, but is kept separate to credit the author.

This started as a change to move common filter functions from unit.cpp to
somewhere that they could be reused for other config-based filters. In the
process a missing feature was found and added, the move is still included in a
single Git commit because the move was required in order to make these
functions accessible to the Boost unit tests.

Two CodeBlocks project files additionally get src/utils/any.hpp added,
which was in one of them but missing from the other two. I noticed because
these are alphabetically at the start of the src/utils file list.

Thanks to @CelticMinstrel for the review comments and Xcode project updates.
2023-08-11 21:59:06 +02:00
Steve Cotton
20ec934658 Whitespace consistency 2023-08-11 08:37:23 +02:00
Ivo Julca
5ebc9a790a Implement event priority
For any given event name, events execute in order of decreasing priority.

Priority is a real number, and may be assigned via the `priority` attribute for
the WML [event] tag, or through the Lua APIs:

- wesnoth.game_events.add({priority = number})
- wesnoth.game_events.add_repeating(name, action, [priority])

Note that delayed variable substitution is not currently supported in the WML attribute.
2023-08-11 08:34:43 +02:00
Gunter Labes
a0d7054360
Fix schema to allow upkeep in SUF 2023-08-03 20:09:19 +02:00
Gunter Labes
68b3eeb0ff
Fix schema to allow SUF under [advancement] 2023-08-03 19:49:52 +02:00
Severin Glöckner
96046499f9 schema: advances_to can be a list 2023-06-28 20:54:38 +02:00
Gunter Labes
df855235b4
Fix version validation
Fixes #7396
2023-06-01 11:01:08 +02:00
Pentarctagon
ad3f1c95b0 Add support for distinct sub-achievements.
This adds support for having up to 28 distinct sub-achievements within a single achievement. This limit exists since wesnoth's layout isn't smart enough to tell a horizontal listbox to actually use its scrollbar instead of forcing a horizontal scrollbar on the whole window.

Additionally this adds the [set_sub_achievement] and [has_sub_achievement] WML tags and their respective lua functions. [has_sub_achievement] is unsafe for use in MP, for the same reasons that [has_achievement] is.
2023-05-17 23:54:16 -05:00
newfrenchy83
f9a94e1312 [1.17] add [filter_ability] in [filter] events and [effect]remove_ability and [filter_ability_active] in [filter] events
see https://forums.wesnoth.org/viewtopic.php?p=681371#p681371 in forum

the type of ability used is also filtered.
2023-05-09 19:26:10 +02:00
Celtic Minstrel
3ba31d532f Add new schemas to validate fonts.cfg and language.cfg 2023-05-02 21:04:41 -04:00
Celtic Minstrel
3cfe0c338d Minor improvement to the schema validation script 2023-05-02 21:04:41 -04:00
Celtic Minstrel
5a1491a6ae Split up the GUI2 schema into multiple files.
The motivation for this is to reuse parts of it for another schema.
2023-05-02 21:04:41 -04:00
Slayer95
de6f37f75f
Add gender-specific names for units with random traits (#7546)
Support (fe)male_name key in unit.

Support FEMALE_NAME in macros for named units with random gender.

Add female variants to generic unit names in DiD, TSG and UtBS.
2023-04-24 23:01:14 +02:00
Gunter Labes
bf8e3ed137
Schema update for 6876695 2023-03-13 14:16:12 +01:00
Steve Cotton
f1ba89ec6d Fix mixed indents in the schema, and verify new additions
This uses tabs instead of spaces, because although that's not our coding
standard, it is only a few lines of changes.

The alternative of running wmlindent on these files changes 4700 lines.
2023-03-02 15:34:41 +01:00
Hejnewar
6632116caa
Quenoth Rework (#7349)
Hopefully making the whole faction more interesting and enjoyable to play. 

Co-authored-by: Steve Cotton <steve@octalot.co.uk>
Co-authored-by: nemaara <nemaara@users.noreply.github.com>
2023-02-18 00:33:48 +01:00
Celtic Minstrel
05d35442b6 Fix [harm_unit]alignment not accepting variables 2023-02-16 21:48:26 -05:00
Toom
02cb4a9e81 Remove hp_bar_scaling and xp_bar_scaling from [unit] schema
#2913
2023-02-12 10:11:05 -06:00
Pentarctagon
d3b6cf7b54 Allow playing a sound when an achievement is completed. 2023-02-05 21:29:04 -06:00
Pentarctagon
7825de6a71 Have hidden achievements actually be hidden.
Also hidden_name and hidden_hint are no longer attributes of [achievement].
2023-02-04 21:40:02 -06:00
Pentarctagon
e3bb346b39 Add functionality for achievements to be partially complete.
Instead of being either complete or incomplete, achievements can now specify a value at which they will be considered complete. For such achievements that are not yet complete, a progress bar is added to the achievements dialog showing how close to completion the achievement is.
2023-02-04 15:43:28 -06:00
Celtic Minstrel
cbbd34a79e
Add new attacks_used key to [attack] (#7351) 2023-02-04 19:55:04 +01:00
Steve Cotton
8e90a2616b Add game_config.cfg's show_*_orb to the schema, rename show_partly_orb
These keys are supported in game_config.cfg, but currently they're not used in
that file, instead falling back to the defaults in the C++.

The name show_partly_orb is inconsistent - in other places, including the WML
that's stored in the user's preferences file, it's called show_partial_orb.
2023-01-31 06:45:53 +01:00
Steve Cotton
88f13f32ff Remove the disengaged_orb_color preference
These are leftovers from the original implementation of the disengage orb,
when it was a new color for the single-color orb. During the review process it
became the two-color design, but these parts were left in.

The value of orb_status_helper::get_orb_color(orb_status::disengaged) is used
(both before and after this commit) by the minimap; this commit changes
get_orb_color to return the partial_color() directly. The result will be the
same as before, because disengage_color() returned the same as partial_color().
Prior to this commit that was done by giving both orbs the same value in
game_config.cfg. If the advanced preference to change orbs colors was used, the
value chosen for the partial orb was passed to set_disengage_color() too.
2023-01-31 06:45:53 +01:00
Celtic Minstrel
7ef71decc5 Correct some errors in the schema that were unearthed by the previous commit 2023-01-24 23:39:21 -05:00
Celtic Minstrel
f43c52cdbf Update the pbl file schema
* forum_auth and [translation] were missing
* passphrase and email are only relevant with forum_auth=no
2023-01-24 23:39:21 -05:00
Pentarctagon
d1465a9eb9
Add basic achievements functionality. (#7237)
* Add basic achievements functionality.

This reads the mainline achievements.cfg and then all the achievements of each installed add-on.

This is intentionally handled separately from other WML loading so that:
a) All achievements and their status are able to be displayed on the main menu right after Wesnoth starts and regardless of which add-ons are active.
b) Add-ons can add additional achievements to other content, whether UMC or mainline. For example, a modification that adds more achievements for mainline campaigns.

Marking something as achieved is handled by the new [set_achieved] tag and whether an achievement has been completed can be checked via [has_achievement].

There is no attempt to prevent people from manually editing which achievements they've accomplished.

NOTE: These are *not* in any way related to Steam achievements!
2023-01-21 10:32:45 -06:00
Kingofd
492c20baa6
Add exclusive unit traits handling similar to require_amla (#7109) 2023-01-19 13:49:39 -05:00
walodar
6eb2246eff
Colored attack type icons, resistances and movement costs. Reordered resistances. (#5264)
Using colors to make relevant information stand out at a quick glance.

The six attack type icons are recolored using the six equidistant hues cyan, green, yellow, red, magenta and blue, with the same saturation and lightness as the old icons. The images are optimized with woptipng.

Resistances and movement costs are colored using a gradient from red to green, like the defense values.

The resistance table in the help browser now also shows the attack type icons.

Previously, the resistance table was always ordered alphabetically by their original English names (not their translation, unlike the terrain modifiers). Now, the order is set to blade - pierce - impact - fire - cold - arcane.

These changes are made in all relevant areas, including the help browser, tooltips, the sidebar and dialogs.

Missing icons are handled by replacing them with a blank image scaled to the same size.
2022-08-01 17:57:46 -05:00
Tommy
3127178e17 Add a submerge value to items, to control submerge amount
It defaults to 0, which is no submersion.
2022-07-30 14:56:38 +12:00
Celtic Minstrel
53b6f892dc That just... doesn't even do anything... 2022-07-26 00:03:17 -04:00
Gunter Labes
1a49e91b0a
Schema: Use correct type 2022-07-19 15:35:18 +02:00
Gunter Labes
7c021b73cb
Schema: Add missing modify_unit_type keys 2022-07-19 15:22:36 +02:00
Steve Cotton
2e28ed4617 Schema: the [fire_event][data] tag is optional
Fixup for 715cf386.
2022-07-19 13:09:29 +02:00
Celtic Minstrel
715cf3864e Add missing tag in the schema 2022-07-19 02:10:02 -04:00
Celtic Minstrel
42889232ea Update schema for the new [event] options 2022-07-18 21:56:42 -04:00
Tommy
8144c06389
Add new [screen_fade] WML action (#6864)
* Add new [screen_fade] WML action

It takes (for now) the arguments:
 * red, green, blue = values between 0 and 255
 * alpha = value between 0 and 255
 * duration = time in ms over which to fade

The game display is faded to the given colour over the duration.
It will be left with an overlay of that colour and alpha until
a screen_fade to 0 alpha is performed.
2022-07-15 09:32:19 -04:00
Tommy
613f047c1e Remove hex_brightening config option
It is not used, and appears to have been unused for a long time.
It was related to mouseover hex brightening, but the brightening
amount is hardcoded. There were associated hex_semi_brightening,
mouseover_image and selected_image keys, but that info is also
hardcoded, and those keys appear to have been removed already.
2022-07-01 15:06:25 +12:00
mattsc
38978feadd Schema: allow key values to be variables 2022-06-28 09:47:11 -05:00
mattsc
6fcca95be0 Schema: Add missing path key to [textdomain] 2022-06-28 09:47:11 -05:00
mattsc
ce9ba142bc Add new AI aspect allow_ally_villages 2022-06-22 08:00:50 -07:00
Tommy
ebcae03e48 Add a new image tiling mode: "tile_highres" for high-DPI tiled images.
The other options "tile" and "tile_center" work in draw space,
which is consistent with past behaviour, but doesn't look as nice.
2022-06-14 14:48:03 +12:00
Tommy
638c02b59e Rename image_shape.vertical_mirror_ to mirror_.
It is in fact (and always was) mirroring horizontally.
2022-05-31 21:17:33 +12:00
Celtic Minstrel
a76aa9bddc
Add wesnoth.interface.add_floating_label as a replacement for wesnoth.print (#5837)
This returns a label handle which allows you to remove, reposition, or replace the label later.

In addition to all the features of wesnoth.print, you can now specify where the label appears onscreen, as well as a fadeout time separate from the duration.

You can also anchor the text to an edge or corner instead of centering in on the screen,
specify the maximum width it can occupy as an absolute width or a percentage,
and specify a background colour and transparency.

It includes a demo scenario that demonstrates many of the capabilities of the API.
To play the demo scenario, run with -toverlay_text_demo or select it from the in-game test list.
2022-04-10 13:00:29 -04:00
Pentarctagon
c3a5763f03
Fix schema. 2022-04-08 11:49:02 -05:00
Celtic Minstrel
b53fc5979f
Schema: Add category and creator keys to [label]
These were added in af6d3060e2

Partially addresses #6447
2022-01-16 11:53:49 -05:00
newfrenchy83
0813c60142 add 'multiply' and 'divide' 2021-12-09 18:04:24 +01:00
newfrenchy83
3e70b335da fix 'add' and 'sub' not added in leadership shema validation 2021-12-09 18:04:24 +01:00
Celtic Minstrel
9ad9833789 AI: Support [unit][ai][candidate_action]
This is essentially a syntax sugar for adding a candidate action filtered to only run for that single unit.
2021-09-04 22:20:28 -04:00