ATTENTION! The process of updating WiKi to version Eco 10.x has begun. Those wishing to participate can find out more Information on our ECO Contribution Wiki Discord.

Ecopedia Modding

From Eco - English Wiki
Revision as of 21:07, 1 August 2021 by Thetestgame (talk | contribs) (Added custom pages example)

NOTE: The modding system is under heavy development. APIs are expected to change, which may break existing mods! Feel free to update any information on this wiki that is out of date.

Adding Custom Items to Ecopedia

Using the same tools used by items and blocks created by Strange Loop Games modded objects can be automatically added to the Ecopedia. Ecopedia automatically generates pages for items and blocks using the EcopediaAttribute class. More information about this class can be found here.

Example Usage

In the following example we add a Flag item to Eco. The Ecopedia attribute adds a new sub category called "Flags" under "House Objects" and places our new item inside it.

    [Serialized]
    [LocDisplayName("Test Flag")]
    [Ecopedia("Housing Objects", "Flags", createAsSubPage: true, display: InPageTooltip.DynamicTooltip)]
    [Weight(10)]
    public partial class FlagItem : WorldObjectItem<FlagObject>
    {
        public override LocString DisplayDescription { get { return Localizer.DoStr("A piece of fabric with something on it. can be used for decorating."); } }

        static FlagItem()
        {
            WorldObject.AddOccupancy<FlagObject>(new List<BlockOccupancy>(){
            new BlockOccupancy(new Vector3i(0, 0, 0)),
            new BlockOccupancy(new Vector3i(0, 1, 0)),
            });
        }
    }

Custom Ecopedia Pages

It is possible to add custom Ecopedia pages that are hand written using XML files in your Eco server mod directory. These files support all tags available in Eco such as <ecoicon> as well as some custom tags only used by the Ecopedia UI.

Modifying Existing Pages

Starting with Eco 9.4 custom pages created by Strange Loop Games can be found in your server's mod directory under Mods/__core__/Ecopedia. Editing the XML files found in this directory will effect the pages found in the Ecopedia in game.

Adding Custom Ecopedia Pages

It is possible to add your own custom pages to the Ecopedia by creating XML files under Mods/UserCode/Ecopedia. These files must follow the same XML file layout as those found under Mods/__core__/Ecopedia. An example custom page can be found here.


The example mod is comprised of three parts.

  • Rules.xml - The root page file for the Ecopedia chapter.
  • Rules;Server Rules.xml - The Server Rules sub page.
  • ServerInfo.xml - The root Ecopedia chapter that shows up in the left navigation.


Example Chapter

A chapter file contains only the ecopediachapter tag used to define the chapter on the left navigation bar. The priority is used to sort where it will be placed in the list.

<ecopediachapter priority="0" />

Example Root Page In the root page XML document we define our ecopedia tag which contains the Icon we would like to display and the chapter file that owns this page. The chapter field must match the name used in the chapter file minus the extension. Inside the ecopedia tag we define our summary text used in the Ecopedia page.

<ecopedia icon="PaperItem" chapter="ServerInfo">
  <summary>Summary of Server Rules</summary>
</ecopedia>

Example Sub Page In the sub example page we define another page using the ecopedia tag and icon however we do not define a parent field as this is defined by the file name which follows the rule of "OwningPage;SubPageName.xml". Inside this file we again define our summary text we would like to display as well as our custom content. In this case a section defining our server rules. All tags supported by Eco such as the ecoicon as well as some custom tags relating to sections are supported on in this file.

<ecopedia icon="PaperItem">
  <summary>Welcome to our Eco Server!</summary>
  <section>
1. Don't be an jerk.
2. Don't game the game, IE: Use waterwheels without a watersource.
3. All Structures must be supported, IE: no floating stockpile platforms.
3.1. Bridges can still float, but must have "support" columns for aesthetic purposes. 

We hope you enjoy your stay!
  </section>
</ecopedia>