field_animations.lua

This script contains some animations to reveal and hide fields seen by a player. This functions are currently used in the campaigns and scenarios to tell the prologue to a story.

reveal_randomly(player, region, time)

Reveal a given region field by field, where the fields are chosen randomly. The region will be hidden before being revealed. The animation runs the specified time. See also wl.map.Field.region()

Parameters
  • player – The player who gets sight to the region

  • region (array of wl.map.Fields) – The region that has to be revealed

  • time – Optional. The time the whole animation will run. Defaults to 1000 (1 sec)

hide_randomly(player, region, time)

Hide a given region field by field, where the fields are chosen randomly. The animation runs the specified time regardless how big the given region is. So region(6) and region(13) will take the same time. See also wl.map.Field.region()

Parameters
  • player – The player whose sight gets hidden

  • region (array of wl.map.Fields) – The region that will be hidden

  • time – Optional. The time the whole animation will run. Defaults to 1000 (1 sec)

reveal_concentric(player, center, max_radius, hide, delay)

Reveal a part of the map in a concentric way beginning from center onto max_radius. The region get hidden prior revealing as default.

Parameters
  • player – The player who gets sight to the region

  • center – The field from where the animation should start revealing

  • max_radius – The last ring to reveal

  • hide (boolean) – Optional, if false automatic hiding is disabled

  • delay – Optional, defaults to 100. The delay between revealing each ring. If you want to set the delay, you must also set hide

hide_concentric(player, center, max_radius, delay)

Hide a part of the map in a concentric way beginning from max_radius onto center.

Parameters
  • player – The player whose sight gets hidden

  • center – The field where the animation should end hiding

  • max_radius – The first ring to hide

  • delay – Optional, defaults to 100. The delay between revealing each ring

get_sees_fields(player)

Gather all fields a player can see in the current view. The current view is the whole area of the map in the current game window. You can use this function to get an unregular (non hexagonal) region and feed e.g. reveal_randomly() with it.

Parameters

player – The player for whom the fields get gathered

Returns

A table containing all visible fields in the current view