objective_utils.lua

This script contains utility functions for typical tasks that need to be checked for objectives.

check_for_buildings(plr, which[, region])

Checks if the number of buildings defined in which are found for the given player. If region is given, buildings are only searched on the corresponding fields. If more buildings or equal the number of requested buildings are found, this function returns true.

Example usage:

check_for_buildings(wl.Game().players[1], {lumberjacks_hut=2, quarry=1})
Parameters
  • plr (wl.game.Player) – Player to check for

  • region (array of wl.map.Field) – array of fields to check for the buildings

  • which (table) – (name,count) pairs for buildings to check for.

Returns

true if the requested buildings were found, false otherwise