building_help.lua

This script returns a formatted entry for the ingame building help. Pass the internal tribe name and building name to the coroutine to select the building type.

dependencies_basic(images[, text = nil])

Creates a dependencies line of any length.

Parameters
  • images – images in the correct order from left to right as table (set in {}).

  • text – comment of the image.

Returns

a row of pictures connected by arrows.

item_image(mapobject)

Creates Richtext image code for the given map object.

Parameters

mapobject – the mapobject to represent

Returns

richtext code for displaying the mapobject as an image, preferable using its menu icon

find_resource_indicator(tribe, resource)

Returns the biggest resource indicator available.

Parameters
  • tribe – the tribe to use for getting a tribe-specific indicator

  • resource – a map resource description

Returns

a resource indicator immovable description

find_created_collected_matches(creator, collector)

Returns a table of map objects that link the two given production sites

Parameters
  • creator – a productionsite description that creates bobs, immovables and/or resources

  • collector – a productionsite description that collects bobs, immovables and/or resources

Returns

a list of all bob, immovable and resource descriptions that matches both

dependencies_collects(tribe, building_description)

Assemble dependency help for a building that collects bobs, immovables and/or resources

Parameters
  • tribe – the tribe for which to display this help

  • building_description – a production site that collects bobs, immovables and/or resources from the map

Returns

a richtext-formatted p()

dependencies_creates(tribe, building_description)

Assemble dependency help for a building that places bobs, immovables and/or resources on the map

Parameters
  • tribe – the tribe for which to display this help

  • building_description – a production site that creates bobs, immovables and/or resources

Returns

a richtext-formatted p()

dependencies_training_food(foods)

Creates dependencies lines for food in training sites.

Parameters

foods – an array of arrays with food items. Outer array has “and” logic and will appear from back to front, inner arrays have “or” logic

Returns

a list of food descriptions with images

dependencies_training_weapons(weapons)

Creates a dependencies line for any number of weapons.

Parameters
  • weapons – an array of weapon names

  • tribename – the name of the tribe for filtering the buildings

Returns

a list weapons images with the producing and receiving building

building_help_general_string(tribe, building_description)

Creates the string for the general section in building help

Parameters
Returns

rt of the formatted text

building_help_dependencies_production(tribe, building_description)

The input and output wares of a productionsite

Parameters
Returns

an rt string with images describing a chain of ware/building dependencies

building_help_dependencies_training(tribe, building_description)

Shows the production dependencies for a training site.

Parameters
Returns

rt string with training dependencies information.

building_help_building_section(building_description)

Formats the “Building” section in the building help: Enhancing info, costs and space required

Parameters

building_description – The wl.map.BuildingDescription for the building that we are displaying this help for.

Returns

an rt string describing the building section

building_help_crew_section(tribe, building_description)

Displays the building’s workers with an image and the tool they use

Parameters
Returns

Workers/Crew section of the help file

building_help_production_section(tribe, building_description)

Displays the production/performance section with a headline

Parameters
Returns

rt for the production section

building_help(tribe, building_description)

Main function to create a building help string.

Parameters
Returns

rt of the formatted text