Difference between revisions of "Template:Recipe draw/sandbox"

From Captain of Industry Wiki
Jump to: navigation, search
(Reworked the algorithm of determining if draw a vertical line at the left of pollution. Now recipe with both product and pollution such as Exhaust Scrubber can be displayed the same format in the game.)
(Test of optimization)
Line 60: Line 60:
   -->}}<!--
   -->}}<!--
-->}}<!--
-->}}<!--
  ** Determine if we should display the "PROVIDES" or "ACCEPTS" text in the output **
-->{{#if: {{{Input1Name|}}}{{{Input2Name|}}}{{{Input3Name|}}}{{{Input4Name|}}}{{{Input5Name|}}}{{{Input6Name|}}} || {{#vardefine: provides | yes}} }} <!--
-->{{#vardefine: combined_output | {{lc:{{{Output1Name|}}}{{{Output2Name|}}}{{{Output3Name|}}}{{{Output4Name|}}}{{{Output5Name|}}}{{{Output6Name|}}} }} }}<!--
-->{{#ifeq: <!--
  -->{{#expr: <!--
    -->    {{#ifeq: {{#var: combined_output}} | {{#var: pollution_1}} | 1 | 0 }} <!--
    --> or {{#ifeq: {{#var: combined_output}} | {{#var: pollution_2}} | 1 | 0 }} <!--
    --> or {{#ifeq: {{#var: combined_output}} | {{#var: pollution_3}} | 1 | 0 }} <!--
    --> or {{#ifeq: {{#var: combined_output}} | {{#var: pollution_4}} | 1 | 0 }} <!--
    --> or {{#ifeq: {{#var: combined_output}} | | 1 | 0 }} <!--
  -->}} | 1 | <!--
  -->{{#vardefine: accepts| yes}} | <!--
-->}} <!--




Line 88: Line 73:
-->}}<!--
-->}}<!--


   ** Draw "ACCEPTS" or "PROVIDES", if appropriate **
   ** Combine each of input, non-pollution output, and pollution **


-->{{#ifeq: {{#var: accepts}} | yes | <div class="block accepts-provides">ACCEPTS</div> }}<!--
-->{{#vardefine: all_inputs | <!--
-->{{#ifeq: {{#var: provides}} | yes | <div class="block accepts-provides">PROVIDES</div> }}<!--
  -->{{Recipe item | Name = {{{Input1Name|}}} | Quantity = {{{Input1Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input1Unit|}}} }}<!--
 
  -->{{Recipe item | Name = {{{Input2Name|}}} | Quantity = {{{Input2Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input2Unit|}}} | Plus = yes }}<!--
   ** Draw outputs except pollution if {{#var: provides}} is `yes`. **
  -->{{Recipe item | Name = {{{Input3Name|}}} | Quantity = {{{Input3Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input3Unit|}}} | Plus = yes }}<!--
   ** Draw input unless {{#var: provides}} is `yes`. **
   -->{{Recipe item | Name = {{{Input4Name|}}} | Quantity = {{{Input4Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input4Unit|}}} | Plus = yes }}<!--
 
   -->{{Recipe item | Name = {{{Input5Name|}}} | Quantity = {{{Input5Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input5Unit|}}} | Plus = yes }}<!--
-->{{#ifeq: {{#var: provides}} | yes |<!--
  -->{{Recipe item | Name = {{{Input6Name|}}} | Quantity = {{{Input6Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input6Unit|}}} | Plus = yes }}<!--
-->}}<!--
-->{{#vardefine: all_products | <!--   product means non-pollution output
   -->{{Recipe item | Name = {{{Output1Name|}}} | Quantity = {{{Output1Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output1Unit|}}} | Pollution = hide }}<!--
   -->{{Recipe item | Name = {{{Output1Name|}}} | Quantity = {{{Output1Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output1Unit|}}} | Pollution = hide }}<!--
   -->{{Recipe item | Name = {{{Output2Name|}}} | Quantity = {{{Output2Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output2Unit|}}} | Pollution = hide | Plus = yes }}<!--
   -->{{Recipe item | Name = {{{Output2Name|}}} | Quantity = {{{Output2Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output2Unit|}}} | Pollution = hide | Plus = yes }}<!--
Line 103: Line 90:
   -->{{Recipe item | Name = {{{Output5Name|}}} | Quantity = {{{Output5Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output5Unit|}}} | Pollution = hide | Plus = yes }}<!--
   -->{{Recipe item | Name = {{{Output5Name|}}} | Quantity = {{{Output5Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output5Unit|}}} | Pollution = hide | Plus = yes }}<!--
   -->{{Recipe item | Name = {{{Output6Name|}}} | Quantity = {{{Output6Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output6Unit|}}} | Pollution = hide | Plus = yes }}<!--
   -->{{Recipe item | Name = {{{Output6Name|}}} | Quantity = {{{Output6Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output6Unit|}}} | Pollution = hide | Plus = yes }}<!--
  -->|<!--
-->}}<!--
   -->{{Recipe item | Name = {{{Input1Name|}}} | Quantity = {{{Input1Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input1Unit|}}} }} <!--
-->{{#vardefine: all_pollution | <!--
   -->{{Recipe item | Name = {{{Input2Name|}}} | Quantity = {{{Input2Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input2Unit|}}} | Plus = yes }}<!--
   -->{{Recipe item | Name = {{{Output1Name|}}} | Quantity = {{{Output1Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output1Unit|}}} | Pollution = only }}<!--
   -->{{Recipe item | Name = {{{Input3Name|}}} | Quantity = {{{Input3Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input3Unit|}}} | Plus = yes }}<!--
   -->{{Recipe item | Name = {{{Output2Name|}}} | Quantity = {{{Output2Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output2Unit|}}} | Pollution = only }}<!--
   -->{{Recipe item | Name = {{{Input4Name|}}} | Quantity = {{{Input4Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input4Unit|}}} | Plus = yes }}<!--
   -->{{Recipe item | Name = {{{Output3Name|}}} | Quantity = {{{Output3Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output3Unit|}}} | Pollution = only }}<!--
   -->{{Recipe item | Name = {{{Input5Name|}}} | Quantity = {{{Input5Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input5Unit|}}} | Plus = yes }}<!--
   -->{{Recipe item | Name = {{{Output4Name|}}} | Quantity = {{{Output4Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output4Unit|}}} | Pollution = only }}<!--
   -->{{Recipe item | Name = {{{Input6Name|}}} | Quantity = {{{Input6Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input6Unit|}}} | Plus = yes }}<!--
   -->{{Recipe item | Name = {{{Output5Name|}}} | Quantity = {{{Output5Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output5Unit|}}} | Pollution = only }}<!--
   -->{{Recipe item | Name = {{{Output6Name|}}} | Quantity = {{{Output6Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output6Unit|}}} | Pollution = only }}<!--
-->}}<!--
-->}}<!--


  ** Draw "ACCEPTS" if there is no output except pollution, draw "PROVIDES" if there is no input **
  ** If there is no input, then draw outputs, else draw inputs **


  ** Draw the recipe times unless it has a unit defined (KW, MW, etc). **
-->{{#if: {{#var: all_products}} || <div class="block accepts-provides">ACCEPTS</div> }}<!--
  ** Use the "/ 60 🕓" format if: **
-->{{#if: {{#var: all_inputs}} <!--
    ** {{#var: provides}} is `yes` OR {{#var: accepts}} is `yes` **
   -->| {{#var: all_inputs}} <!--
   ** Draw an arrow unless: **
  -->| <div class="block accepts-provides">PROVIDES</div> {{#var: all_products}} <!--
    ** {{#var: provides}} is `yes` OR {{#var: accepts}} is `yes` **
-->}}<!--
      ** e.g., pumping groundwater, dumping brine **


  ** Draw the recipe times unless 'Time = 0' **
  ** Use the "/ 60 🕓" format if: only there are only input or there are only output (pollution is ignored) **
  ** Use the "60 🕓" format and draw an arrow if: there are both inputs and outputs (pollution is ignored) **
-->{{#vardefine: draw_arrow |<!--
  -->{{#if: {{#var: all_inputs}} | {{#if: {{#var: all_products}} | yes | no }} | no }}<!--
-->}}<!--
-->{{#if: {{{Time|}}} |<!--
-->{{#if: {{{Time|}}} |<!--
   --><div class="block time"><!--
   --><div class="block time"><!--
     -->{{#ifeq: {{lc:{{{Time}}}}} | <!-- instant --> 0 | <div>{{#var: img_arrow}}</div> |<!--
     -->{{#ifeq: {{{Time}}} | 0 | <div>{{#var: img_arrow}}</div> |<!--
       --><div class="upper"><!--
       --><div class="upper"><!--
         -->{{#ifeq: {{#var: provides}} | yes | /&nbsp; }}<!--
         -->{{#ifeq: {{#var: draw_arrow}} | no | /&nbsp; }}<!--
        -->{{#ifeq: {{#var: accepts}} | yes | /&nbsp; }}<!--
         -->{{{Time}}}&nbsp;[[File:Clock.png|link=Time|16x16px]]<!--
         -->{{{Time}}}&nbsp;[[File:Clock.png|link=Time|16x16px]]<!--
       --></div><!--
       --></div><!--
       --><div><!--
       --><div><!--
         -->{{#ifeq: {{#var: provides}} | yes | <br/> |<!--
         -->{{#ifeq: {{#var: draw_arrow}} | yes | {{#var: img_arrow}} | <br/> }}<!--
          -->{{#ifeq: {{#var: accepts}} | yes | <br/> |<!--
            -->{{#var: img_arrow}}<!--
          -->}}<!--
        -->}}<!--
       --></div><!--
       --></div><!--
       --><div class="lower blue"><!--
       --><div class="lower blue"><!--
         -->{{#ifeq: {{#var: provides}} | yes | /&nbsp; }}<!--
         -->{{#ifeq: {{#var: draw_arrow}} | no | /&nbsp; }}<!--
        -->{{#ifeq: {{#var: accepts}}  | yes | /&nbsp; }}<!--
         -->60&nbsp;[[File:Clock 60s.png|link=Time|16x16px]]<!--
         -->60&nbsp;[[File:Clock 60s.png|link=Time|16x16px]]<!--
       --></div><!--
       --></div><!--
Line 147: Line 137:
   ** Draw outputs except pollution unless {{#var: provides}} is `yes` **
   ** Draw outputs except pollution unless {{#var: provides}} is `yes` **


-->{{#ifeq: {{#var: provides}} | yes ||<!--
-->{{#if: {{#var: all_inputs}} | {{#var: all_products}} }}<!--
  -->{{Recipe item | Name = {{{Output1Name|}}} | Quantity = {{{Output1Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output1Unit|}}} | Pollution = hide }}<!--
  -->{{Recipe item | Name = {{{Output2Name|}}} | Quantity = {{{Output2Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output2Unit|}}} | Pollution = hide | Plus = yes }}<!--
  -->{{Recipe item | Name = {{{Output3Name|}}} | Quantity = {{{Output3Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output3Unit|}}} | Pollution = hide | Plus = yes }}<!--
  -->{{Recipe item | Name = {{{Output4Name|}}} | Quantity = {{{Output4Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output4Unit|}}} | Pollution = hide | Plus = yes }}<!--
  -->{{Recipe item | Name = {{{Output5Name|}}} | Quantity = {{{Output5Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output5Unit|}}} | Pollution = hide | Plus = yes }}<!--
  -->{{Recipe item | Name = {{{Output6Name|}}} | Quantity = {{{Output6Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output6Unit|}}} | Pollution = hide | Plus = yes }}<!--
  -->}}<!--
    
    
   ** Draw vertical line and pollution if pollution exists **
   ** Draw vertical line and pollution if pollution exists **
 
-->{{#if: {{#var: all_pollution}} |<!--
-->{{#vardefine: all_pollutions |<!--
  -->{{Recipe item | Name = {{{Output1Name|}}} | Quantity = {{{Output1Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output1Unit|}}} | Pollution = only }}<!--
  -->{{Recipe item | Name = {{{Output2Name|}}} | Quantity = {{{Output2Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output2Unit|}}} | Pollution = only }}<!--
  -->{{Recipe item | Name = {{{Output3Name|}}} | Quantity = {{{Output3Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output3Unit|}}} | Pollution = only }}<!--
  -->{{Recipe item | Name = {{{Output4Name|}}} | Quantity = {{{Output4Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output4Unit|}}} | Pollution = only }}<!--
  -->{{Recipe item | Name = {{{Output5Name|}}} | Quantity = {{{Output5Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output5Unit|}}} | Pollution = only }}<!--
  -->{{Recipe item | Name = {{{Output6Name|}}} | Quantity = {{{Output6Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output6Unit|}}} | Pollution = only }}<!--
-->}}<!--
-->{{#if: {{#var: all_pollutions}} |<!--
   -->&emsp;<!--
   -->&emsp;<!--
   --><div style="display: inline-block;
   --><div style="display: inline-block;
Line 174: Line 148:
                 margin-right: 11px"
                 margin-right: 11px"
   --></div><!--
   --></div><!--
   -->{{#var: all_pollutions}}<!--
   -->{{#var: all_pollution}}<!--
-->}}<!--
-->}}<!--


Line 310: Line 284:
   | Output3Qty  = -1
   | Output3Qty  = -1
   | Unreleased  = yes
   | Unreleased  = yes
}}
{{Recipe draw/sandbox
  | Building    =
  | Time        = 20
  | Output1Name = Oxygen
  | Output1Qty  = 12
  | Output2Name = Nitrogen
  | Output2Qty  = 12
}}
}}
</noinclude>
</noinclude>

Revision as of 01:48, 4 October 2022


Mining.png
Transform.png
Copper Ore.png
Rock.png
Transform.png
Dumping.png
Rotary Kiln.png
:
12
Limestone.png
72
Plus.png
2
Coal.png
12
10 Clock.png
Transform.png
60 Clock 60s.png
4
Cement.png
24
Plus.png
8
Exhaust.png
48
Air Separator.png
:
PROVIDES
12
Oxygen.png
36
Plus.png
12
Nitrogen.png
36
/ 20 Clock.png

/ 60 Clock 60s.png
Smoke Stack.png
:
ACCEPTS
200
Oxygen.png
600
/ 20 Clock.png

/ 60 Clock 60s.png
Liquid Dump.png
:
ACCEPTS
2
Waste Water.png
60
/ 2 Clock.png

/ 60 Clock 60s.png
2
Water Pollution.png
60
Low-pressure Turbine.png
:
4
Steam Lo.png
48
Clock.png
Transform.png
60 Clock 60s.png
 
Mechanical Power.png
1 MW
Plus.png
4
Steam Depleted.png
48
Power Generator.png
:
 
Mechanical Power.png
500 KW
Transform.png
 
Electricity.png
250 KW
Waste Sorting Plant.png
:
48
Recyclables.png
144
20 Clock.png
Transform.png
60 Clock 60s.png
?
Iron Scrap.png
?
Plus.png
?
Copper Scrap.png
?
Plus.png
?
Gold Scrap.png
?
Plus.png
?
Broken Glass.png
?
Exhaust Scrubber.png
:
30
Exhaust.png
180
Plus.png
4
Water.png
24
10 Clock.png
Transform.png
60 Clock 60s.png
1
Sulfur.png
6
Plus.png
12
Carbon Dioxide.png
72
Plus.png
4
Steam Lo.png
24
4
Air Pollution.png
24
18
Sand.png
54
Plus.png
4
Limestone.png
12
Plus.png
4
Salt.png
12
20 Clock.png
Transform.png
60 Clock 60s.png
14
Glass Mix.png
42
Air Separator.png
:
PROVIDES
12
Oxygen.png
36
Plus.png
12
Nitrogen.png
36
/ 20 Clock.png

/ 60 Clock 60s.png
-1
Water Pollution.png
-3
UNRELEASED
Building not defined