Difference between revisions of "LuaWML/Time"

From The Battle for Wesnoth Wiki
(Move wesnoth.get_time_of_day to a dedicated ToD functions page)
 
m (Add category)
Line 16: Line 16:
 
* '''name''': translatable string
 
* '''name''': translatable string
 
* '''red, green, blue''': integers (color adjustment for this time)
 
* '''red, green, blue''': integers (color adjustment for this time)
 +
 +
[[Category: Lua Reference]]

Revision as of 02:44, 27 November 2015

LuaWML functions revolving around Time of Day schedule functionality, including time areas.

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)