Template:Infobox material: Difference between revisions

From Captain of Industry Wiki
Jump to: navigation, search
NaK (talk | contribs)
Automate "Created in" and "Used in", and add "Radiation level" and some parameters
Sstew (talk | contribs)
Added a fallback for cases were an image naming omits a space instead of using an underscore
(8 intermediate revisions by 2 users not shown)
Line 7: Line 7:
   --><div class="inner-header"><!--
   --><div class="inner-header"><!--
     --><div class="title"><!--
     --><div class="title"><!--
       -->{{#if: {{{Name|}}}<!--
       -->{{#if: {{{Name|{{PAGENAME}}}}}<!--
         -->| {{{Name}}}<!--
         -->| {{{Name|{{PAGENAME}}}}}<!--
           ** This variable is used in footer template **
           ** This variable is used in footer template **
           -->{{#vardefine:game_object_type|material}}<!--
           -->{{#vardefine:game_object_type|material}}<!--
Line 15: Line 15:
   --></div><!--
   --></div><!--
    
    
<!--
   ** Image and Description **
   ** Image and Description **
   --><div class="inner-main"><!--
   --><div class="inner-main"><!--
     -->[[File:{{#if: {{{Image|}}} | {{{Image}}} | {{#if: {{{Name|}}} | {{{Name}}} | Placeholder material}}.png}}]]<br><!--
     -->[[File:{{#if: {{{Image|}}}<!--
      --> | {{{Image}}}<!--
      --> | {{#ifexist: File:{{{Name|{{PAGENAME}}}}}.png<!--
        --> | {{{Name|{{PAGENAME}}}}}.png<!--
        --> | {{#ifexist: File:{{#replace: {{{Name|{{PAGENAME}}}}} | | }}.png<!--
          --> | {{#replace: {{{Name|{{PAGENAME}}}}} | | }}.png<!--
          --> | Placeholder material.png<!--
        -->}}<!--
      -->}}<!--
    -->}}|128px]]<br><!--
     -->{{#if: {{{Description|}}} | <!--
     -->{{#if: {{{Description|}}} | <!--
       --><div class="description">{{{Description}}}</div><!--
       --><div class="description">{{{Description}}}</div><!--
     -->}}<!--
     -->}}<!--
   --></div><!--
   --></div><!--
-->


    
    
Line 61: Line 72:
             --><td class="table-td-left">Transported by</td><!--
             --><td class="table-td-left">Transported by</td><!--
             --><td class="table-td-right"><!--
             --><td class="table-td-right"><!--
               -->{{#if: {{{TransportedBy|}}} | {{{TransportedBy}}}[[Category:Cleanup1]] | <!--
               -->{{#if: {{{TransportedBy|}}} |<!--
                -->{{{TransportedBy}}}{{#if: {{NAMESPACE}} || [[Category:Items with unique transport or storage]] }} |<!--
                 -->{{#switch: {{lc:{{{State|}}}}} |<!--
                 -->{{#switch: {{lc:{{{State|}}}}} |<!--
                   -->| loose    = {{variants|U-shape Conveyor}}<!--
                   -->| loose    = {{variants|U-shape Conveyor}}<!--
Line 71: Line 83:
                   -->| molten  = [[Molten Channel]]<!--
                   -->| molten  = [[Molten Channel]]<!--
                   -->| virtual  = [[Virtual product|Magic]]<!--
                   -->| virtual  = [[Virtual product|Magic]]<!--
                   -->| #default = <span style="color: red;">Unknown <nowiki>{{{State}}}</nowiki>[[Category:Material redtext]]</span><!--
                   -->| #default = <span style="color: red;">Unknown <nowiki>{{{State}}}</nowiki></span><!--
                 -->}}<!--
                 -->}}<!--
                 -->{{#if: {{{OtherTransport|}}} | <br>{{{OtherTransport}}}}}<!--
                 -->{{#if: {{{OtherTransport|}}} | <br>{{{OtherTransport}}}}}<!--
Line 83: Line 95:
           --><td class="table-td-left">Stored in</td><!--
           --><td class="table-td-left">Stored in</td><!--
           --><td class="table-td-right"><!--
           --><td class="table-td-right"><!--
             -->{{#ifeq:{{lc:{{{StoredIn|}}}}} | none | None [[Category:Unstorable items]] | {{#if:{{{StoredIn|}}}{{{State|}}}|<!--
             -->{{#ifeq:{{lc:{{{StoredIn|}}}}} | none |<!--
              -->{{#if: {{{StoredIn|}}} | {{{StoredIn}}}[[Category:Cleanup1]] | <!--
              -->None {{#if: {{NAMESPACE}} || [[Category:Unstorable items]] }} |<!--
                -->{{#switch: {{lc:{{{State|}}}}} |<!--
              -->{{#if:{{{StoredIn|}}}{{{State|}}}|<!--
                  -->| loose    = {{variants|Loose Storage}}<!--
                -->{{#if: {{{StoredIn|}}} |<!--
                    -->{{#ifeq: {{{StoredInShipyard|yes}}} | no ||<br>[[Shipyard]]}}<!--
                  -->{{{StoredIn}}}{{#if: {{NAMESPACE}} || [[Category:Items with unique transport or storage]] }} |<!--
                    -->{{#ifeq: {{{StoredInCargoModules|no}}} | yes |<br>{{variants|Loose Module}}}}<!--
                  -->{{#switch: {{lc:{{{State|}}}}} |<!--
                  -->| fluid    = {{variants|Fluid Storage}}<!--
                    -->| loose    = {{variants|Loose Storage}}<!--
                    -->{{#ifeq: {{{StoredInShipyard|yes}}} | no ||<br>[[Shipyard]]}}<!--
                      -->{{#ifeq: {{{StoredInShipyard|yes}}} | no ||<br>[[Shipyard]]}}<!--
                    -->{{#ifeq: {{{StoredInCargoModules|no}}} | yes |<br>{{variants|Fluid Module}}}}<!--
                      -->{{#ifeq: {{{StoredInCargoModules|no}}} | yes |<br>{{variants|Loose Module}}}}<!--
                  -->| unit    = {{variants|Unit Storage}}<!--
                    -->| fluid    = {{variants|Fluid Storage}}<!--
                    -->{{#ifeq: {{{StoredInShipyard|yes}}} | no ||<br>[[Shipyard]]}}<!--
                      -->{{#ifeq: {{{StoredInShipyard|yes}}} | no ||<br>[[Shipyard]]}}<!--
                      -->{{#ifeq: {{{StoredInCargoModules|no}}} | yes |<br>{{variants|Fluid Module}}}}<!--
                    -->| unit    = {{variants|Unit Storage}}<!--
                      -->{{#ifeq: {{{StoredInShipyard|yes}}} | no ||<br>[[Shipyard]]}}<!--
                     -->{{#ifeq: {{{StoredInCargoModules|no}}} | yes |<br>{{variants|Unit Module}}}}<!--
                     -->{{#ifeq: {{{StoredInCargoModules|no}}} | yes |<br>{{variants|Unit Module}}}}<!--
                  -->| molten  = None<!--
                    -->| molten  = None<!--
                  -->| virtual  = [[Virtual product|Ethereal plane]]<!--
                    -->| virtual  = [[Virtual product|Ethereal plane]]<!--
                  -->| #default = <span style="color: red;">Unknown <nowiki>{{{State}}}</nowiki>[[Category:Material redtext]]</span><!--
                    -->| #default = <span style="color: red;">Unknown <nowiki>{{{State}}}</nowiki></span><!--
                -->}}<!--
                  -->}}<!--
                 -->{{#if: {{{OtherStorage|}}} | <br>{{{OtherStorage}}}}}<!--
                 -->{{#if: {{{OtherStorage|}}} | <br>{{{OtherStorage}}}}}<!--
               --></td><!--
               --></td><!--
Line 110: Line 125:
               | fields    = Building
               | fields    = Building
               | where    = Building != "" AND Building IS NOT NULL
               | where    = Building != "" AND Building IS NOT NULL
                               AND (    Output1Name = "{{{Name}}}" OR Output2Name = "{{{Name}}}"
                               AND (    Output1Name = "{{{Name|{{PAGENAME}}}}}" OR Output2Name = "{{{Name|{{PAGENAME}}}}}"
                                     OR Output3Name = "{{{Name}}}" OR Output4Name = "{{{Name}}}"
                                     OR Output3Name = "{{{Name|{{PAGENAME}}}}}" OR Output4Name = "{{{Name|{{PAGENAME}}}}}"
                                     OR Output5Name = "{{{Name}}}" OR Output6Name = "{{{Name}}}")
                                     OR Output5Name = "{{{Name|{{PAGENAME}}}}}" OR Output6Name = "{{{Name|{{PAGENAME}}}}}")
               | group by  = Building
               | group by  = Building
               | format    = template
               | format    = template
               | template  = {{{template|Format link}}}
               | template  = Format link list
              | delimiter = <br>
               | default  = {{#if:{{{CreatedIn|}}} || None }}
               | default  = {{#if:{{{CreatedIn|}}} || None }}
             }}<!--
             }}<!--
Line 123: Line 137:
           --><td class="table-td-left">Created in</td><!--
           --><td class="table-td-left">Created in</td><!--
           --><td class="table-td-right"><!--
           --><td class="table-td-right"><!--
             -->{{#var: CreatedInAuto}}<!--
             --><ul style="list-style-type: none !important; list-style-image: none !important; padding: 0 !important; margin: 0 !important;">{{#var: CreatedInAuto}}</ul><!--
            -->{{#if: {{#var: CreatedInAuto}} | {{#if: {{{CreatedIn|}}} | <br> }} }}<!--
             -->{{{CreatedIn|}}}<!--
             -->{{{CreatedIn|}}}<!--
           --></td><!--
           --></td><!--
Line 134: Line 147:
               | fields    = Building
               | fields    = Building
               | where    = Building != "" AND Building IS NOT NULL
               | where    = Building != "" AND Building IS NOT NULL
                               AND (    Input1Name = "{{{Name}}}" OR Input2Name = "{{{Name}}}"
                               AND (    Input1Name = "{{{Name|{{PAGENAME}}}}}" OR Input2Name = "{{{Name|{{PAGENAME}}}}}"
                                     OR Input3Name = "{{{Name}}}" OR Input4Name = "{{{Name}}}"
                                     OR Input3Name = "{{{Name|{{PAGENAME}}}}}" OR Input4Name = "{{{Name|{{PAGENAME}}}}}"
                                     OR Input5Name = "{{{Name}}}" OR Input6Name = "{{{Name}}}")
                                     OR Input5Name = "{{{Name|{{PAGENAME}}}}}" OR Input6Name = "{{{Name|{{PAGENAME}}}}}")
               | group by  = Building
               | group by  = Building
               | format    = template
               | format    = template
               | template  = {{{template|Format link}}}
               | template  = Format link list
              | delimiter = <br>
               | default  = {{#if:{{{UsedIn|}}} || None }}
               | default  = {{#if:{{{UsedIn|}}} || None }}
             }}<!--
             }}<!--
Line 147: Line 159:
           --><td class="table-td-left">Used in</td><!--
           --><td class="table-td-left">Used in</td><!--
           --><td class="table-td-right"><!--
           --><td class="table-td-right"><!--
             -->{{#var: UsedInAuto}}<!--
             --><ul style="list-style-type: none !important; list-style-image: none !important; padding: 0 !important; margin: 0 !important;">{{#var: UsedInAuto}}</ul><!--
            -->{{#if: {{#var: UsedInAuto}} | {{#if: {{{UsedIn|}}} | <br> }} }}<!--
             -->{{{UsedIn|}}}<!--
             -->{{{UsedIn|}}}<!--
           --></td><!--
           --></td><!--

Revision as of 01:10, 5 June 2025

Template documentation (for the above template, sometimes hidden or invisible) [view] [edit] [history] [refresh]
Construction Parts


-->
TypeCrafted material
StateUnit
Transported byFlat Conveyor [IIIII]
PickupTruck
Stored inUnit Storage [IIIIIIV]
Shipyard
Created in
    None
Used in
    None
Starting amountSailor: 987
Captain: 654
Admiral: 321
VariantsConstruction Parts II
Construction Parts III
Construction Parts IV

Usage and Parameters

This is a template to show basic information of items. The template accepts the following parameters:

Basic parameters
  • Name: Name of items. (Default: The name of the page.)
  • Type1, Type2: Types of items. It is used to categorize item in this wiki.
  • State: Loose, Fluid, Unit, Molten, or Virtual.
  • Variants: Variant of the items.
Parameters for transportation
Buildings and vehicles for transporting are automatically listed depending on State. But, it should be modified with the following parameters in some cases.
  • TrackTransport: Set no if tracks cannot transport the item (Default: yes).
  • TransportedBy(rare): Only if transport override is needed.
  • OtherTransport(rare): To add an extra transport to auto-generated list.
Parameters for storage
Buildings for storing are automatically listed depending on State. But, it should be modified with the following parameters in some cases.
  • StoredInShipyard: Set no if the shipyard cannot store the items (Default: yes).
  • StoredInCargoModules: Set yes if cargo modules can store the items (Default: no).
  • StoredIn: Only if storage override is needed. Set to "None" to suppress the field.
  • OtherStorage(rare): To add an extra storage to auto-generated list.
Parameters for buildings that creates/uses this item
Buildings that create/use the item are automatically listed from the table made by Template:Recipe define. But, it should be added with the following parameters in some cases.
  • CreatedIn: To add an extra buildings to auto-generated list.
  • UsedIn: To add an extra buildings to auto-generated list.
Miscellaneous parameters
  • Radiation: Radiation Level of the items.
  • StartingQty: The number of the items stored in the Shipyard on game start.
  • Image (rare): Only if image override is needed.
  • Description (rare): To add an in-game description, though not currently implemented in-game.

Categories set by this template

Examples

Example usage for standard item
Markup Renders as
  {{Infobox material
    | Name           = Electronics III
    | Type1          = Crafted material
    | State          = Unit
    | StartingQty    = Sailor: 987<br>Captain: 654<br>Admiral: 321
    | Variants       = [[Electronics]]<br>[[Electronics II]]
  }} 
Electronics III


-->
TypeCrafted material
StateUnit
Transported byFlat Conveyor [IIIII]
PickupTruck
Stored inUnit Storage [IIIIIIV]
Shipyard
Created in
    None
Used in
Starting amountSailor: 987
Captain: 654
Admiral: 321
VariantsElectronics
Electronics II
Example usage for items that tracks cannot transport or storage cannot store
Markup Renders as
  {{Infobox material
    | Name           = Chilled Water
    | State          = Fluid
    | TrackTransport = no
    | StoredIn       = none
  }} 
Chilled Water


-->
StateFluid
Transported byPipe [IIIII]
Stored inNone
Created in
Used in
    None
Example usage for items that the shipyard cannot store
Markup Renders as
  {{Infobox material
    | Name             = Seawater
    | Type1            = Natural resource
    | State            = Fluid
    | StoredInShipyard = no
  }} 
Example usage for items having Radiation Level
Markup Renders as
  {{Infobox material
    | Name             = Spent Fuel
    | Type1            = Radioactive waste
    | Radiation        = 2
    | State            = Unit
  }} 
Spent Fuel


-->
TypeRadioactive waste
StateUnit
Radiation Level2
Transported byFlat Conveyor [IIIII]
PickupTruck
Stored inUnit Storage [IIIIIIV]
Shipyard
Created in
Used in
Example usage for items stored in special storage
Markup Renders as
  {{Infobox material
    | Name             = Spent Fuel
    | Type1            = Radioactive waste
    | State            = Unit
    | StoredIn         = [[Radioactive Waste Storage]]
  }} 
Spent Fuel


-->
TypeRadioactive waste
StateUnit
Transported byFlat Conveyor [IIIII]
PickupTruck
Stored inRadioactive Waste Storage
Created in
Used in
Example usage for items stored in cargo modules
Markup Renders as
  {{Infobox material
    | Name                 = Uranium Ore
    | Type1                = Natural resources
    | State                = Loose
    | StoredInCargoModules = yes
  }} 
Uranium Ore


-->
TypeNatural resources
StateLoose
Transported byU-shape Conveyor [IIIII]
PickupTruck
Haul Truck (Dump)
Stored inLoose Storage [IIIIIIV]
Shipyard
Loose Module (S) [ML]
Created in
    None
Used in
Example usage for items created/used in non-production-machines
Markup Renders as
  {{Infobox material
    | Name             = Coal
    | Type1            = Natural resources
    | State            = Loose
    | CreatedIn        = [[Coal Mine]]
    | UsedIn           = Foo
  }} 
Coal


-->
The above text is transcluded from Template:Infobox material/doc; you can change it or view its history. (How does this work?)
If you're done making changes, please refresh the text. (Why?)
You can experiment in this template's sandbox (edit | diff) and testcases (create) pages.
Please add categories and interwikis to Template:Infobox material/doc. (View all subpages of this page.)