Difference between revisions of "Template:Recipe draw/sandbox"
From Captain of Industry Wiki
(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: | ||
-->}}<!-- | -->}}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
Line 88: | Line 73: | ||
-->}}<!-- | -->}}<!-- | ||
** | ** Combine each of input, non-pollution output, and pollution ** | ||
-->{{# | -->{{#vardefine: all_inputs | <!-- | ||
-->{{ | -->{{Recipe item | Name = {{{Input1Name|}}} | Quantity = {{{Input1Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input1Unit|}}} }}<!-- | ||
-->{{Recipe item | Name = {{{Input2Name|}}} | Quantity = {{{Input2Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input2Unit|}}} | Plus = yes }}<!-- | |||
-->{{Recipe item | Name = {{{Input3Name|}}} | Quantity = {{{Input3Qty|}}} | Time = {{{Time|}}} | Unit = {{{Input3Unit|}}} | Plus = 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 }}<!-- | |||
-->{{ | -->{{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 = {{{ | -->{{#vardefine: all_pollution | <!-- | ||
-->{{Recipe item | Name = {{{ | -->{{Recipe item | Name = {{{Output1Name|}}} | Quantity = {{{Output1Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output1Unit|}}} | Pollution = only }}<!-- | ||
-->{{Recipe item | Name = {{{ | -->{{Recipe item | Name = {{{Output2Name|}}} | Quantity = {{{Output2Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output2Unit|}}} | Pollution = only }}<!-- | ||
-->{{Recipe item | Name = {{{ | -->{{Recipe item | Name = {{{Output3Name|}}} | Quantity = {{{Output3Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output3Unit|}}} | Pollution = only }}<!-- | ||
-->{{Recipe item | Name = {{{ | -->{{Recipe item | Name = {{{Output4Name|}}} | Quantity = {{{Output4Qty|}}} | Time = {{{Time|}}} | Unit = {{{Output4Unit|}}} | Pollution = only }}<!-- | ||
-->{{Recipe item | Name = {{{ | -->{{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 ** | |||
-->{{#if: {{#var: all_products}} || <div class="block accepts-provides">ACCEPTS</div> }}<!-- | |||
-->{{#if: {{#var: all_inputs}} <!-- | |||
-->| {{#var: all_inputs}} <!-- | |||
-->| <div class="block accepts-provides">PROVIDES</div> {{#var: all_products}} <!-- | |||
-->}}<!-- | |||
** 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 | -->{{#ifeq: {{{Time}}} | 0 | <div>{{#var: img_arrow}}</div> |<!-- | ||
--><div class="upper"><!-- | --><div class="upper"><!-- | ||
-->{{#ifeq: {{#var: | -->{{#ifeq: {{#var: draw_arrow}} | no | / }}<!-- | ||
-->{{{Time}}} [[File:Clock.png|link=Time|16x16px]]<!-- | -->{{{Time}}} [[File:Clock.png|link=Time|16x16px]]<!-- | ||
--></div><!-- | --></div><!-- | ||
--><div><!-- | --><div><!-- | ||
-->{{#ifeq: {{#var: | -->{{#ifeq: {{#var: draw_arrow}} | yes | {{#var: img_arrow}} | <br/> }}<!-- | ||
--></div><!-- | --></div><!-- | ||
--><div class="lower blue"><!-- | --><div class="lower blue"><!-- | ||
-->{{#ifeq: {{#var: | -->{{#ifeq: {{#var: draw_arrow}} | no | / }}<!-- | ||
-->60 [[File:Clock 60s.png|link=Time|16x16px]]<!-- | -->60 [[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` ** | ||
-->{{# | -->{{#if: {{#var: all_inputs}} | {{#var: all_products}} }}<!-- | ||
** Draw vertical line and pollution if pollution exists ** | ** Draw vertical line and pollution if pollution exists ** | ||
-->{{#if: {{#var: all_pollution}} |<!-- | |||
-->{{#if: {{#var: | |||
--> <!-- | --> <!-- | ||
--><div style="display: inline-block; | --><div style="display: inline-block; | ||
Line 174: | Line 148: | ||
margin-right: 11px" | margin-right: 11px" | ||
--></div><!-- | --></div><!-- | ||
-->{{#var: | -->{{#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> |