Module:Infobox/parsing/doc: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
m (Fixed method rename)
(Added _technology_trigger)
 
Line 4: Line 4:


== Methods ==
== Methods ==
=== _technology_trigger ===
Takes one argument in the form of a string. The string is expected to have the following format:
<pre>trigger-type: Item, count + Iron ore</pre>
The trigger type can be one of the following:
* <code>mine-entity</code>
* <code>build-entity</code>
* <code>craft-item</code>
* <code>capture-spawner</code>
* <code>create-space-platform</code>
* <code>send-item-to-orbit</code>
The items and counts are optional, when they are left out then the colon after the trigger-type should also be removed. The items and counts are forwarded to <code>_item</code> to be parsed and displayed as icons.
Examples:
<pre>build-entity: asteroid collector</pre>
<pre>capture-spawner</pre>


=== _technology ===
=== _technology ===

Latest revision as of 12:30, 28 October 2024

Lua methods used by Template:Infobox via Module:Infobox.

Edit this documentation on Module:Infobox/parsing/doc.

Methods

_technology_trigger

Takes one argument in the form of a string. The string is expected to have the following format:

trigger-type: Item, count + Iron ore

The trigger type can be one of the following:

  • mine-entity
  • build-entity
  • craft-item
  • capture-spawner
  • create-space-platform
  • send-item-to-orbit

The items and counts are optional, when they are left out then the colon after the trigger-type should also be removed. The items and counts are forwarded to _item to be parsed and displayed as icons.

Examples:

build-entity: asteroid collector
capture-spawner

_technology

Takes one argument in the form of a string and one named argument, "color". The string is expected to have the following format:

Military 4 + Advanced oil processing + Advanced electronics 2, 2

This string is split so that each entry between a + is forwarded to Template:Icon/special so that it displays the technology and has the level as the caption.

Before forwarding the arguments to the icon template, " (research)" is appended to the technology if a page with that name exists. Furthermore, the technology level is deduced from the technology name if it is not manually specified.

The color defaults to "999".

_item

Takes one argument in the form of a string. The string is expected to have the following format:

Item, count + Iron plate, 45 + Iron ore + Electronic circuit, 5

This string is split so that each entry between a + is forwarded to Template:Icon/special so that it displays the item and has the number as the caption. The number (, N) is optional and defaults to nothing.

_crafting

Takes one argument in the form of a string. The string is expected to have the following format:

Item ingredient, count + Iron ore, 45 + Electronic circuit, 5 = Item product, count + Advanced circuit, 4

The text in front of the equals sign are treated as the recipe ingredients, the text behind the equals sign is treated as the recipe products. The products are optional and default to the name of the current page. For both ingredients and products, the count (, N) is optional and defaults to 1.

This string is split so that each entry between a + is forwarded to Template:Icon/special so that it displays the item and has the count as the caption.

_crafting_raw

Takes one argument in the form of a string. The string is expected to have the following format:

Item ingredient, count + Iron ore, 45 + Electronic circuit, 5

The text in front of the equals sign are treated as the recipe ingredients, the text behind the equals sign is treated as the recipe products. If this is given the format from "_crafting", then the products are ignored. For the ingredients the count (, N) is optional and defaults to 1.

This string is split so that each entry between a + is forwarded to Template:Icon/special so that it displays the item and has the count as the caption.