Difference between revisions of "Template:Recipe item/doc"

From Captain of Industry Wiki
Jump to: navigation, search
(Support instant recipe without unit (for Thermal Storage))
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
<templatestyles src="Template:Recipe draw/styles.css" />
<!--
{{#vardefine: img_plus | [[File:Plus.png|24x24px]] }}
--><templatestyles src="Template:Recipe draw/styles.css" /> <!--
{{#vardefine: imgsz_reg | 48x48px }}
--> {{#vardefine: img_plus | [[File:Plus.png|24x24px]] }} <!--
<!-- The upper 3 rows are required to apply the proper format to render the sample on this page. -->
--> {{#vardefine: imgsz_reg | 48x48px }}<!--
-->{{#vardefine: pollution_1 | air pollution }}<!--
-->{{#vardefine: pollution_2 | water pollution }}<!--
-->{{#vardefine: pollution_3 | }}<!--
-->{{#vardefine: pollution_4 | }}<!--


** The upper 7 rows are required to apply the proper format to render the sample on this page.
-->
;Purpose
;Purpose
:This is a template for improving the maintainability of [[Template: Recipe draw]], where the code for drawing the plus sign and item icon is used nearly 20 times. This template is intended to be used '''only''' in [[Template: Recipe draw]] and does not work alone.
:This is a template for improving the maintainability of [[Template: Recipe draw]], where the code for drawing the plus sign and item icon is used nearly 20 times. This template is intended to be used '''ONLY''' in [[Template: Recipe draw]] and does not work alone.
;Usage
;Usage
:For Input1 and Output1
:The template accepts the following parameters:
*<code>Name</code>: Name of item (example: Iron Ore). If empty string, does not display anything.
*<code>Quantity</code>: Amount of consumed or produced item per 1 cycle of recipe.
*<code>Time</code>: Cycle time of recipe.
*<code>Unit = MW or something</code> (optional): Adds unit to Quantity.
**<code>Unit = ?</code> (optional, rare): Makes quantity to "?" (For [[Waste Sorting Plant]] and so on)
*<code>Plus = yes</code> (optional): Displays "+" icon left of item icon
**<code>Plus = something</code> (optional, rare): Displays specified icon (or text) instead of "+" icon
*<code>Pollution = only</code> (optional): Displays icon only if the item is Air Pollution or Water Pollution
*<code>Pollution = hide</code> (optional): Displays icon only if the item is NOT Air Pollution or Water Pollution
*<code>ImageSize = something</code> (optional, rare): Changes size of the item icon
 
== Examples ==
 
;For Input1 and Output1
<div class="recipe-wrapper>
<div class="recipe-wrapper>
{{markup|<nowiki>
{{markup|<nowiki>
   {{Recipe item
   {{Recipe item
     | Name    = Steam hi
     | Name    = Steam Hi
     | Quantity = 2
     | Quantity = 2
     | Time    = 10
     | Time    = 10
   }}</nowiki>|
   }}</nowiki>|
   {{Recipe item
   {{Recipe item
     | Name    = Steam hi
     | Name    = Steam Hi
     | Quantity = 2
     | Quantity = 2
     | Time    = 10
     | Time    = 10
Line 22: Line 43:
}}
}}
</div>
</div>
:For Input2-6 and Output2-6:
;For Input2-6 and Output2-6:
<div class="recipe-wrapper>
<div class="recipe-wrapper>
{{markup|<nowiki>
{{markup|<nowiki>
   {{Recipe item
   {{Recipe item
     | Name      = Steam hi
     | Name      = Steam Hi
     | Quantity  = 2
     | Quantity  = 2
     | Time      = 10
     | Time      = 10
Line 32: Line 53:
   }}</nowiki>|
   }}</nowiki>|
   {{Recipe item
   {{Recipe item
     | Name      = Steam hi
     | Name      = Steam Hi
     | Quantity  = 2
     | Quantity  = 2
     | Time      = 10
     | Time      = 10
Line 39: Line 60:
}}
}}
</div>
</div>
:For Mechanical power and Electricity:
;For Mechanical Power and Electricity:
<div class="recipe-wrapper>
<div class="recipe-wrapper>
{{markup|<nowiki>
{{markup|<nowiki>
Line 54: Line 75:
}}
}}
</div>
</div>
:For overwriting plus icon and/or icon size:
;For Instant recipe
<div class="recipe-wrapper>
{{markup|<nowiki>
  {{Recipe item
    | Name      = Steam Depleted
    | Quantity  = 1
    | Time      = 0
  }}</nowiki>|
  {{Recipe item
    | Name      = Steam Depleted
    | Quantity  = 1
    | Time      = 0
  }}
}}
</div>
;For variable quantity:
:*For displaying "?," Unit should be used instead of Quantity since Input1Qty, etc. in [[Template: Recipe define]] can receive only integer.
<div class="recipe-wrapper>
<div class="recipe-wrapper>
{{markup|<nowiki>
{{markup|<nowiki>
   {{Recipe item
   {{Recipe item
     | Name      = Steam hi
     | Name      = Steam Hi
    | Unit      = ?  <!-- NOT Quantity -->
    | Time      = 10
  }}</nowiki>|
  {{Recipe item
    | Name      = Steam Hi
    | Unit      = ?
    | Time      = 10
  }}
}}
</div>
;For hiding pollution:
<div class="recipe-wrapper>
{{markup|<nowiki>
  {{Recipe item
    | Name      = Steam Hi
     | Quantity  = 2
     | Quantity  = 2
     | Time      = 10
     | Time      = 10
     | Plus     = [[File:Unity.png|32x32px]]
     | Pollution = hide
     | ImageSize = 24x24px
  }}</nowiki>|
  {{Recipe item
    | Name      = Steam Hi
    | Quantity  = 2
    | Time      = 10
    | Pollution = hide
  }} | <nowiki>
  {{Recipe item
    | Name      = Air Pollution
    | Quantity  = 2
    | Time      = 10
    | Pollution = hide
  }}</nowiki> |
  {{Recipe item
    | Name     = Air Pollution
    | Quantity  = 2
    | Time      = 10
    | Pollution = hide
  }}
}}
</div>
;For showing only pollution:
<div class="recipe-wrapper>
{{markup|<nowiki>
  {{Recipe item
    | Name      = Steam Hi
    | Quantity  = 2
    | Time      = 10
     | Pollution = only
   }}</nowiki>|
   }}</nowiki>|
   {{Recipe item
   {{Recipe item
     | Name      = Steam hi
     | Name      = Steam Hi
    | Quantity  = 2
    | Time      = 10
    | Pollution = only
  }} | <nowiki>
  {{Recipe item
    | Name      = Air Pollution
     | Quantity  = 2
     | Quantity  = 2
     | Time      = 10
     | Time      = 10
     | Plus     = [[File:Unity.png|32x32px]]
     | Pollution = only
     | ImageSize = 24x24px
  }}</nowiki> |
  {{Recipe item
    | Name     = Air Pollution
    | Quantity  = 2
    | Time      = 10
     | Pollution = only
   }}
   }}
}}
}}
</div>
</div>
:When Name is empty:
;When Name is empty:
<div class="recipe-wrapper>
<div class="recipe-wrapper>
{{markup|<nowiki>
{{markup|<nowiki>
Line 85: Line 176:
     | Quantity  = 2
     | Quantity  = 2
     | Time      = 10
     | Time      = 10
  }}
}}
</div>
;For overwriting plus icon and/or icon size:
<div class="recipe-wrapper>
{{markup|<nowiki>
  {{Recipe item
    | Name      = Steam Hi
    | Quantity  = 2
    | Time      = 10
    | Plus      = [[File:Unity.png|32x32px]]
    | ImageSize = 24x24px
  }}</nowiki>|
  {{Recipe item
    | Name      = Steam Hi
    | Quantity  = 2
    | Time      = 10
    | Plus      = [[File:Unity.png|32x32px]]
    | ImageSize = 24x24px
   }}
   }}
}}
}}
</div>
</div>


;The reason this template cannot be used alone
== Reason this template cannot be used alone ==
:[[Template: Recipe draw]] has the following 4 codes to define its style and icons. But, these codes are omitted from here.
:This template depends on the following codes in [[Template: Recipe draw]] to define its style and some parameters.
:*<nowiki><templatestyles src="Template:Recipe draw/styles.css" /></nowiki>
:*<nowiki><div class="recipe-wrapper></nowiki>
:*<nowiki>{{#vardefine: img_plus | [[File:Plus.png|24x24px]] }}</nowiki>
:*<nowiki>{{#vardefine: img_plus | [[File:Plus.png|24x24px]] }}</nowiki>
:*<nowiki>{{#vardefine: imgsz_reg | 48x48px }}</nowiki>
:*<nowiki>{{#vardefine: imgsz_reg | 48x48px }}</nowiki>
:*<nowiki><templatestyles src="Template:Recipe draw/styles.css" /></nowiki>
:*<nowiki>{{#vardefine: pollution_1 | air pollution }}</nowiki>
:*<nowiki><div class="recipe-wrapper></nowiki>
:*<nowiki>{{#vardefine: pollution_2 | water pollution }}</nowiki>
:*<nowiki>{{#vardefine: pollution_3 | }}</nowiki>
:*<nowiki>{{#vardefine: pollution_4 | }}</nowiki>

Latest revision as of 14:37, 16 May 2023

Purpose
This is a template for improving the maintainability of Template: Recipe draw, where the code for drawing the plus sign and item icon is used nearly 20 times. This template is intended to be used ONLY in Template: Recipe draw and does not work alone.
Usage
The template accepts the following parameters:
  • Name: Name of item (example: Iron Ore). If empty string, does not display anything.
  • Quantity: Amount of consumed or produced item per 1 cycle of recipe.
  • Time: Cycle time of recipe.
  • Unit = MW or something (optional): Adds unit to Quantity.
  • Plus = yes (optional): Displays "+" icon left of item icon
    • Plus = something (optional, rare): Displays specified icon (or text) instead of "+" icon
  • Pollution = only (optional): Displays icon only if the item is Air Pollution or Water Pollution
  • Pollution = hide (optional): Displays icon only if the item is NOT Air Pollution or Water Pollution
  • ImageSize = something (optional, rare): Changes size of the item icon

Examples

For Input1 and Output1
Markup Renders as
  {{Recipe item
    | Name     = Steam Hi
    | Quantity = 2
    | Time     = 10
  }}
2
Steam Hi.png
12
For Input2-6 and Output2-6
Markup Renders as
  {{Recipe item
    | Name      = Steam Hi
    | Quantity  = 2
    | Time      = 10
    | Plus      = yes
  }}
Plus.png
2
Steam Hi.png
12
For Mechanical Power and Electricity
Markup Renders as
  {{Recipe item
    | Name      = Electricity
    | Quantity  = 2
    | Unit      = MW
  }}
 
Electricity.png
2 MW
For Instant recipe
Markup Renders as
  {{Recipe item
    | Name      = Steam Depleted
    | Quantity  = 1
    | Time      = 0
  }}
 
Steam Depleted.png
1
For variable quantity
  • For displaying "?," Unit should be used instead of Quantity since Input1Qty, etc. in Template: Recipe define can receive only integer.
Markup Renders as
  {{Recipe item
    | Name      = Steam Hi
    | Unit      = ?  <!-- NOT Quantity -->
    | Time      = 10
  }}
?
Steam Hi.png
?
For hiding pollution
Markup Renders as
  {{Recipe item
    | Name      = Steam Hi
    | Quantity  = 2
    | Time      = 10
    | Pollution = hide
  }}
2
Steam Hi.png
12
  {{Recipe item
    | Name      = Air Pollution
    | Quantity  = 2
    | Time      = 10
    | Pollution = hide
  }}
For showing only pollution
Markup Renders as
  {{Recipe item
    | Name      = Steam Hi
    | Quantity  = 2
    | Time      = 10
    | Pollution = only
  }}
  {{Recipe item
    | Name      = Air Pollution
    | Quantity  = 2
    | Time      = 10
    | Pollution = only
  }}
2
Air Pollution.png
12
When Name is empty
Markup Renders as
  {{Recipe item
    | Name      = 
    | Quantity  = 2
    | Time      = 10
  }}
For overwriting plus icon and/or icon size
Markup Renders as
  {{Recipe item
    | Name      = Steam Hi
    | Quantity  = 2
    | Time      = 10
    | Plus      = [[File:Unity.png|32x32px]]
    | ImageSize = 24x24px
  }}
Unity.png
2
Steam Hi.png
12

Reason this template cannot be used alone

This template depends on the following codes in Template: Recipe draw to define its style and some parameters.
  • <templatestyles src="Template:Recipe draw/styles.css" />
  • <div class="recipe-wrapper>
  • {{#vardefine: img_plus | [[File:Plus.png|24x24px]] }}
  • {{#vardefine: imgsz_reg | 48x48px }}
  • {{#vardefine: pollution_1 | air pollution }}
  • {{#vardefine: pollution_2 | water pollution }}
  • {{#vardefine: pollution_3 | }}
  • {{#vardefine: pollution_4 | }}