Template:Biome: Difference between revisions
More actions
Create Template:Biome for reusable biome resource panes |
m Standardise backdrop lookup on .png only (all biome images are now .png) and skip the file check entirely for the imageless Continent-Wide Resources entry -- both were populating Special:WantedPages with redlinks on every transclusion |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<includeonly>{{# | <includeonly><templatestyles src="Template:Biome/styles.css" />{{#ifeq:{{{name}}}|Continent-Wide Resources | ||
|<div | |<div class="loka-biome-card loka-biome-card--light"><div class="loka-biome-title loka-biome-title--light">{{#ifeq:{{{icon|{{{name}}} Icon.png}}}|none|{{{name}}}|<span class="loka-biome-title-inner">[[File:{{{icon|{{{name}}} Icon.png}}}|20px|link=]]<span>{{{name}}}</span></span>}}</div>{{#if:{{{protected|}}}|<div class="loka-biome-label loka-biome-label--light">Protected Resources</div><div class="loka-biome-row">{{{protected}}}</div>}}{{#if:{{{other|}}}|<div class="loka-biome-label loka-biome-label--light">Other Resources</div><div class="loka-biome-row">{{{other}}}</div>}}</div> | ||
<div | |{{#if:{{{image|}}} | ||
<div | |<div class="loka-biome-card loka-biome-card--dark"><div class="loka-biome-backdrop">[[File:{{{image}}}|260px|link=|alt=]]<div class="loka-biome-scrim"></div><div class="loka-biome-title-overlay"><div class="loka-biome-title">{{#ifeq:{{{icon|{{{name}}} Icon.png}}}|none|{{{name}}}|<span class="loka-biome-title-inner">[[File:{{{icon|{{{name}}} Icon.png}}}|20px|link=]]<span>{{{name}}}</span></span>}}</div></div></div><div class="loka-biome-body">{{#if:{{{protected|}}}|<div class="loka-biome-label">Protected Resources</div><div class="loka-biome-row">{{{protected}}}</div>}}{{#if:{{{other|}}}|<div class="loka-biome-label">Other Resources</div><div class="loka-biome-row">{{{other}}}</div>}}</div></div> | ||
|<div | |{{#ifexist:File:{{{name}}}.png | ||
|<div class="loka-biome-card loka-biome-card--dark"><div class="loka-biome-backdrop">[[File:{{{name}}}.png|260px|link=|alt=]]<div class="loka-biome-scrim"></div><div class="loka-biome-title-overlay"><div class="loka-biome-title">{{#ifeq:{{{icon|{{{name}}} Icon.png}}}|none|{{{name}}}|<span class="loka-biome-title-inner">[[File:{{{icon|{{{name}}} Icon.png}}}|20px|link=]]<span>{{{name}}}</span></span>}}</div></div></div><div class="loka-biome-body">{{#if:{{{protected|}}}|<div class="loka-biome-label">Protected Resources</div><div class="loka-biome-row">{{{protected}}}</div>}}{{#if:{{{other|}}}|<div class="loka-biome-label">Other Resources</div><div class="loka-biome-row">{{{other}}}</div>}}</div></div> | |||
|<div class="loka-biome-card loka-biome-card--light"><div class="loka-biome-title loka-biome-title--light">{{#ifeq:{{{icon|{{{name}}} Icon.png}}}|none|{{{name}}}|<span class="loka-biome-title-inner">[[File:{{{icon|{{{name}}} Icon.png}}}|20px|link=]]<span>{{{name}}}</span></span>}}</div>{{#if:{{{protected|}}}|<div class="loka-biome-label loka-biome-label--light">Protected Resources</div><div class="loka-biome-row">{{{protected}}}</div>}}{{#if:{{{other|}}}|<div class="loka-biome-label loka-biome-label--light">Other Resources</div><div class="loka-biome-row">{{{other}}}</div>}}</div> | |||
}} | |||
}} | |||
}}</includeonly><noinclude> | }}</includeonly><noinclude> | ||
== Usage == | == Usage == | ||
| Line 9: | Line 13: | ||
<pre> | <pre> | ||
{{Biome | {{Biome | ||
|name=Forest | |name=Birch Forest | ||
| | |protected={{ResourceList|1=Birch Wood|1icon1=Birch Log.png}} | ||
| | |other={{ResourceList|1=Dandelion|1icon1=Dandelion.png}} | ||
| | |||
| | |||
}} | }} | ||
</pre> | </pre> | ||
Renders a single biome pane for use on "Biomes and Resources"-style pages, or on any article (e.g. a continent article) that needs to show a biome's protected and other resources. | Renders a single biome pane for use on "Biomes and Resources"-style pages, or on any article (e.g. a continent article) that needs to show a biome's protected and other resources. Styling lives in [[Template:Biome/styles.css]]. | ||
Only <code>name</code> is required. | Only <code>name</code> is required. Both the icon (<code><name> Icon.png</code>) and the backdrop image (<code><name>.png</code>) are auto-detected from the biome name via a file-existence check, so a normal call only needs <code>name</code>, <code>protected</code> and <code>other</code>. If the backdrop file doesn't exist, the pane renders as a flat light card instead. <code>name=Continent-Wide Resources</code> always renders as the flat light card and skips the file check entirely, since it's never meant to have a backdrop. | ||
== Parameters == | == Parameters == | ||
| Line 28: | Line 30: | ||
|- | |- | ||
| <code>name</code> | | <code>name</code> | ||
| Biome display name. | | Biome display name. Also used to auto-detect the icon and backdrop filenames. | ||
|- | |- | ||
| <code>icon</code> | | <code>icon</code> | ||
| | | Overrides the auto-detected icon filename (no <code>File:</code> prefix). Set to <code>none</code> to suppress the icon entirely (e.g. for a non-biome-specific entry with no matching icon file). | ||
|- | |- | ||
| <code>image</code> | | <code>image</code> | ||
| | | Overrides the auto-detected backdrop filename directly (no <code>File:</code> prefix), for the rare case it doesn't follow the <code><name>.png</code> convention. | ||
|- | |- | ||
| <code>protected</code> | | <code>protected</code> | ||
| | | Wikitext for the "Protected Resources" chips — normally a [[Template:ResourceList]] call. | ||
|- | |- | ||
| <code>other</code> | | <code>other</code> | ||
| | | Wikitext for the "Other Resources" chips, same format as <code>protected</code>. | ||
|} | |} | ||
== Biome subtemplates == | |||
Each biome (and each continent's "Continent-Wide Resources" card) has its own subtemplate holding the actual [[Template:Biome|Biome]] call, so a wiki editor updates a biome's resources in exactly one place no matter how many pages embed it (e.g. both [[Biomes and Resources]] and the relevant continent article). | |||
'''Biomes:''' [[Template:Biome/Ancient Forest|Ancient Forest]], [[Template:Biome/Ancient Jungle|Ancient Jungle]], [[Template:Biome/Birch Forest|Birch Forest]], [[Template:Biome/Cherry Grove|Cherry Grove]], [[Template:Biome/Clay Cliffs|Clay Cliffs]], [[Template:Biome/Desert|Desert]], [[Template:Biome/Forest|Forest]], [[Template:Biome/Ice Mountains|Ice Mountains]], [[Template:Biome/Ice Taiga|Ice Taiga]], [[Template:Biome/Ice Wastes|Ice Wastes]], [[Template:Biome/Jungle|Jungle]], [[Template:Biome/Mangrove Forest|Mangrove Forest]], [[Template:Biome/Mega Taiga|Mega Taiga]], [[Template:Biome/Mesa|Mesa]], [[Template:Biome/Moor|Moor]], [[Template:Biome/Mountains|Mountains]], [[Template:Biome/Mushroom Isle|Mushroom Isle]], [[Template:Biome/Pale Garden|Pale Garden]], [[Template:Biome/Plains|Plains]], [[Template:Biome/Roofed Forest|Roofed Forest]], [[Template:Biome/Savannah|Savannah]], [[Template:Biome/Sunset Isles|Sunset Isles]], [[Template:Biome/Swamp|Swamp]], [[Template:Biome/Taiga|Taiga]] | |||
'''Continent-wide:''' [[Template:Biome/Ascalon|Ascalon]], [[Template:Biome/Garama|Garama]], [[Template:Biome/Kalros|Kalros]] | |||
[[Category:Templates]] | [[Category:Templates]] | ||
</noinclude> | </noinclude> | ||
Latest revision as of 01:07, 24 August 2026
Usage
{{Biome
|name=Birch Forest
|protected={{ResourceList|1=Birch Wood|1icon1=Birch Log.png}}
|other={{ResourceList|1=Dandelion|1icon1=Dandelion.png}}
}}
Renders a single biome pane for use on "Biomes and Resources"-style pages, or on any article (e.g. a continent article) that needs to show a biome's protected and other resources. Styling lives in Template:Biome/styles.css.
Only name is required. Both the icon (<name> Icon.png) and the backdrop image (<name>.png) are auto-detected from the biome name via a file-existence check, so a normal call only needs name, protected and other. If the backdrop file doesn't exist, the pane renders as a flat light card instead. name=Continent-Wide Resources always renders as the flat light card and skips the file check entirely, since it's never meant to have a backdrop.
Parameters
| Parameter | Description |
|---|---|
name
|
Biome display name. Also used to auto-detect the icon and backdrop filenames. |
icon
|
Overrides the auto-detected icon filename (no File: prefix). Set to none to suppress the icon entirely (e.g. for a non-biome-specific entry with no matching icon file).
|
image
|
Overrides the auto-detected backdrop filename directly (no File: prefix), for the rare case it doesn't follow the <name>.png convention.
|
protected
|
Wikitext for the "Protected Resources" chips — normally a Template:ResourceList call. |
other
|
Wikitext for the "Other Resources" chips, same format as protected.
|
Biome subtemplates
Each biome (and each continent's "Continent-Wide Resources" card) has its own subtemplate holding the actual Biome call, so a wiki editor updates a biome's resources in exactly one place no matter how many pages embed it (e.g. both Biomes and Resources and the relevant continent article).
Biomes: Ancient Forest, Ancient Jungle, Birch Forest, Cherry Grove, Clay Cliffs, Desert, Forest, Ice Mountains, Ice Taiga, Ice Wastes, Jungle, Mangrove Forest, Mega Taiga, Mesa, Moor, Mountains, Mushroom Isle, Pale Garden, Plains, Roofed Forest, Savannah, Sunset Isles, Swamp, Taiga