Difference between revisions of "LuaWML/Time"
(→wesnoth.get_time_of_day: Added sound and mask fields to returned table) |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | {{Template:LuaMove}} | ||
+ | |||
[[LuaWML]] functions revolving around Time of Day schedule functionality, including time areas. | [[LuaWML]] functions revolving around Time of Day schedule functionality, including time areas. | ||
Line 16: | Line 18: | ||
* '''name''': translatable string | * '''name''': translatable string | ||
* '''red, green, blue''': integers (color adjustment for this time) | * '''red, green, blue''': integers (color adjustment for this time) | ||
+ | * {{DevFeature1.15|14}} '''sound''': string (sound played, as in [time]) | ||
+ | * {{DevFeature1.15|14}} '''mask''': string (image displayed over hexes, as in [time]) | ||
==== wesnoth.add_time_area ==== | ==== wesnoth.add_time_area ==== |
Latest revision as of 21:05, 17 June 2021
LuaWML functions revolving around Time of Day schedule functionality, including time areas.
Contents
wesnoth.get_time_of_day
- wesnoth.get_time_of_day([for_turn], [ {x, y, [consider_illuminates]} ])
Returns schedule information. First parameter (optional) is the turn number for which to return the information, if unspecified: the current turn ($turn_number). Second argument is an optional table. If present, first and second fields must be valid on-map coordinates and all current time_areas in the scenario are taken into account (if a time area happens to contain the passed hex). If the table isn't present, the scenario main schedule is returned. The table has an optional third parameter (boolean). If true (default: false), time of day modifying units and terrain (such as Mages of Light or lava) are taken into account (if the passed hex happens to be affected). The units' placement being considered is always the current one.
wesnoth.get_time_of_day(2, { 37, 3, true })
The function returns a table with these named fields:
- id: string (as in [time])
- lawful_bonus: integer (as in [time])
- bonus_modified: integer (bonus change by units)
- image: string (tod image in sidebar)
- name: translatable string
- red, green, blue: integers (color adjustment for this time)
- (Version 1.15.14 and later only) sound: string (sound played, as in [time])
- (Version 1.15.14 and later only) mask: string (image displayed over hexes, as in [time])
wesnoth.add_time_area
- wesnoth.add_time_area(cfg)
(Version 1.13.0 and later only)
Creates a new time area. This takes a WML table containing the same information normally used by the [time_area] tag.
(Version 1.13.2 and later only) Since 1.13.2, commas in the id attribute of the WML table are no longer handled specially for this function, allowing the creation of time areas with commas in their ids (but why would anyone want to do that, really).
wesnoth.remove_time_area
- wesnoth.remove_time_area(id)
(Version 1.13.0 and later only)
Removes a time area. This requires the time area to have been assigned an id at creation time.
(Version 1.13.2 and later only) Since 1.13.2, commas in the id are no longer handled specially for this function, requiring you to use a loop to remove multiple time areas instead.
for i, id in ipairs({'foo', 'bar', 'baz'}) do wesnoth.remove_time_area(id) end
wesnoth.get_max_liminal_bonus
- wesnoth.get_max_liminal_bonus()
(Version 1.15.4 and later only) Returns the maximum attack bonus that liminal units can get in the current scenario.