Difference between revisions of "Template:Recipe draw/sandbox"
From Captain of Industry Wiki
(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 73: | Line 88: | ||
-->}}<!-- | -->}}<!-- | ||
** | ** Draw "ACCEPTS" or "PROVIDES", if appropriate ** | ||
-->{{# | -->{{#ifeq: {{#var: accepts}} | yes | <div class="block accepts-provides">ACCEPTS</div> }}<!-- | ||
-->{{#ifeq: {{#var: provides}} | yes | <div class="block accepts-provides">PROVIDES</div> }}<!-- | |||
** Draw outputs except pollution if {{#var: provides}} is `yes`. ** | |||
** Draw input unless {{#var: provides}} is `yes`. ** | |||
-->{{#ifeq: {{#var: provides}} | yes |<!-- | |||
-->{{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 90: | Line 103: | ||
-->{{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|}}} }} <!-- | |||
-->{{Recipe item | Name = {{{ | -->{{Recipe item | Name = {{{Input2Name|}}} | Quantity = {{{Input2Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input2Unit|}}} | Plus = yes }}<!-- | ||
-->{{Recipe item | Name = {{{ | -->{{Recipe item | Name = {{{Input3Name|}}} | Quantity = {{{Input3Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input3Unit|}}} | Plus = yes }}<!-- | ||
-->{{Recipe item | Name = {{{ | -->{{Recipe item | Name = {{{Input4Name|}}} | Quantity = {{{Input4Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input4Unit|}}} | Plus = yes }}<!-- | ||
-->{{Recipe item | Name = {{{ | -->{{Recipe item | Name = {{{Input5Name|}}} | Quantity = {{{Input5Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input5Unit|}}} | Plus = yes }}<!-- | ||
-->{{Recipe item | Name = {{{ | -->{{Recipe item | Name = {{{Input6Name|}}} | Quantity = {{{Input6Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input6Unit|}}} | Plus = yes }}<!-- | ||
-->{{Recipe item | Name = {{{ | |||
-->}}<!-- | -->}}<!-- | ||
** Draw the recipe times unless it has a unit defined (KW, MW, etc). ** | |||
** Use the "/ 60 🕓" format if: ** | |||
** {{#var: provides}} is `yes` OR {{#var: accepts}} is `yes` ** | |||
** Draw an arrow unless: ** | |||
** {{#var: provides}} is `yes` OR {{#var: accepts}} is `yes` ** | |||
** e.g., pumping groundwater, dumping brine ** | |||
-->{{#if: {{{Time|}}} |<!-- | -->{{#if: {{{Time|}}} |<!-- | ||
--><div class="block time"><!-- | --><div class="block time"><!-- | ||
-->{{#ifeq: {{{Time}}} | 0 | <div>{{#var: img_arrow}}</div> |<!-- | -->{{#ifeq: {{lc:{{{Time}}}}} | <!-- instant --> 0 | <div>{{#var: img_arrow}}</div> |<!-- | ||
--><div class="upper"><!-- | --><div class="upper"><!-- | ||
-->{{#ifeq: {{#var: | -->{{#ifeq: {{#var: provides}} | yes | / }}<!-- | ||
-->{{#ifeq: {{#var: accepts}} | yes | / }}<!-- | |||
-->{{{Time}}} [[File:Clock.png|link=Time|16x16px]]<!-- | -->{{{Time}}} [[File:Clock.png|link=Time|16x16px]]<!-- | ||
--></div><!-- | --></div><!-- | ||
--><div><!-- | --><div><!-- | ||
-->{{#ifeq: {{#var: | -->{{#ifeq: {{#var: provides}} | yes | <br/> |<!-- | ||
-->{{#ifeq: {{#var: accepts}} | yes | <br/> |<!-- | |||
-->{{#var: img_arrow}}<!-- | |||
-->}}<!-- | |||
-->}}<!-- | |||
--></div><!-- | --></div><!-- | ||
--><div class="lower blue"><!-- | --><div class="lower blue"><!-- | ||
-->{{#ifeq: {{#var: | -->{{#ifeq: {{#var: provides}} | yes | / }}<!-- | ||
-->{{#ifeq: {{#var: accepts}} | yes | / }}<!-- | |||
-->60 [[File:Clock 60s.png|link=Time|16x16px]]<!-- | -->60 [[File:Clock 60s.png|link=Time|16x16px]]<!-- | ||
--></div><!-- | --></div><!-- | ||
Line 137: | Line 147: | ||
** Draw outputs except pollution unless {{#var: provides}} is `yes` ** | ** Draw outputs except pollution unless {{#var: provides}} is `yes` ** | ||
-->{{# | -->{{#ifeq: {{#var: provides}} | yes ||<!-- | ||
-->{{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: | |||
-->{{#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}} |<!-- | |||
--> <!-- | --> <!-- | ||
--><div style="display: inline-block; | --><div style="display: inline-block; | ||
Line 148: | Line 174: | ||
margin-right: 11px" | margin-right: 11px" | ||
--></div><!-- | --></div><!-- | ||
-->{{#var: | -->{{#var: all_pollutions}}<!-- | ||
-->}}<!-- | -->}}<!-- | ||