Totems

From wiki
Revision as of 03:08, 17 November 2017 by DeamonHunter (Talk | contribs) ("code")

Jump to: navigation, search

Villagers in Staxel are fairly moddable, with many parts being able to be switched out, and new creations can add to the pool.

This page is about Totems, these are found in .totem files and contains information for;

  • What objects are needed to make a building
  • Size of the search area
  • What is needed to make higher tiers of building

This file actually doesn't have much to do with villagers. But this system is entirely made to allow villagers to take advantage of it. Villagers will know of totems and can speak about them in their dialogue. It also has a tier system which can also be taken advantage of.


Creating a *.totem file

Villager totems can actually be a somewhat complicated file to work with. But it can be simply broken down into separate parts. But first here is a typical .totem file.

{
  "code" : "staxel.totem.workplace.Patisserie",
  "region" : {
    "x" : 5,
    "y" : 5,
    "z" : 5
  },
  "centreOffset" : {
    "x" : -5,
    "y" : 5,
    "z" : 0
  },
  "tiers": 2,
  "requiresRoof" : true,
  "requiredCategories" : {
    "tier0": [
      {
        "category" : "stool",
        "count" : 3
      },
      {
        "category" : "table",
        "count" : 5
      }
    ],
    "tier1": [
      {
        "category" : "stool",
        "count" : 1
      }
    ]
  },
  "requiredObjects" : {
    "tier1": [
      {
        "code" : "staxel.tileObject.office.OfficeChair",
        "count" : 1
      }
    ]
  },
  "requiredBuildings" : {
    "tier1": [
      {
        "code" : "staxel.totem.workplace.Patisserie",
        "tier" : 1
      },
      {
        "code" : "staxel.totem.workplace.FishingSpot",
        "tier" : 0
      }
    ]
  },
}

The first five properties are fairly simple to understand. Code is just the unique identifier for this totem. Region is how many tiles in each direction, for example if you have an x of 3, it will stretch from -3 to 3 (7 tiles) with the totem as the centre. Centre offset moves the area that it searches away from the totem. And requires roof allows it to check if a roof has been built over the totem/area.

With that comes the more complicated looking bits. All of these parts rely on the property "tiers". Tiers that is greater than 0, numbering how many different tiers that this totem can have. This does not include the base "Broken" tier that you get just for placing down the totem. The first of the properties to use this is "requiredCategories". Required categories follows the following order;

"requiredCategories" : {
  "tier0": [
    {
      "category" : "stool",
      "count" : 3
    },
    {
      "category" : "table",
      "count" : 5
    }
  ],
  "tier1": [
    {
      "category" : "stool",
      "count" : 1
    }
  ]
},

Required categories is actually not a list but a blob. It contains properties for each tier of the totem is to be influenced. The first tier is "tier0", the second tier is "tier1" etc. In each of these tiers is a list of category names. It will look for a certain number of items that have the "category" specified in their name. If at least the number in "count" exist then this part succeeds. If all succeed then this tier is complete. Feel free to play around with this to get a feel for it.

The second one is required objects. This one acts pretty much the same as the required categories one, except that it looks for specific tiles and tileObjects, with a specific code. This is great for making sure a very specific object is included. It will normally look like;

"requiredObjects" : {
  "tier1": [
    {
      "code" : "staxel.tileObject.office.OfficeChair",
      "count" : 1
    }
  ]
}

This also shows off that you can completely skip tiers. Feel free to play around with this as well.

The last one for this tutorial is required Buildings. Required buildings is also fairly similar to required categories and required objects. This time the code points to another totem altogether. Alongside the code is a new property named "tier". This is a check that the building is this tier or higher.

"requiredBuildings" : {
  "tier1": [
    {
      "code" : "staxel.totem.workplace.Patisserie",
      "tier" : 1
    },
    {
      "code" : "staxel.totem.workplace.FishingSpot",
      "tier" : 0
    }
  ]
},

As with all others feel free to experiment.

With this, you have created a totem. Now all you need to do is let a tile have a totem component with this totem and your good to go.


Creating a Shop

[To be done when Treasures is complete]


Config Options

"code"

Valid options (String): A unique string which totem what this object is.

Default Value: No default value is specified. Always need to provide your own.


A string containing the code of the totem the blob will be referring to.

"centreOffset"

Valid options (Vector 3 - Integer): { "x": 0, "y": 0, "z":0 }

Default Value: If not specified, leaves the totem in the center of the area.


This is how many tiles it will offset the totem from the centre of the search area. So offsetting the totem by 1,1,1 will move it one tile upwards, one tile forwards and one tile to the side.


"region"

Valid options (Vector 3 - Integer): { "x": 0, "y": 0, "z":0 }

Default Value: No default value is specified. Always need to provide your own.


This is how large the area it will search. It extends the number in every direction, that is if you have an x of 3, it will go between -3 and 3 (Crossing 7 tiles).


"requiredBuildings"

This is a Blob that contains Blobs which are named "tier0", "tier1" etc. It can have any of the numbers up to but not including the number specified by "tiers". (i.e. If tiers is 2, then you can put "tier0" and "tier1" but not any other numbers). For each tier, the requirements must be met for this tier and lower.

"requiredBuildings" : {
  "tier1": [
    {
      "code" : "staxel.totem.workplace.Patisserie",
      "tier" : 1
    },
    {
      "code" : "staxel.totem.workplace.FishingSpot",
      "tier" : 0
    }
  ]
},

As a note, this is note needed. You do not need to tie any tiers to any other buildings, but doing so can be a good way to force progress. (A smelter could need a mine for example.)

"code"

Valid options (String): A string which contains the code of another item.

Default Value: No default value is specified. Always need to provide your own.


This is the totem that it will search for in the village.


"tier"

Valid options (Integer): A positive integer value.

Default Value: No default value is specified. Always need to provide your own.


This is the minimum tier the totem must be before this totem's tier can be met.


"requiredCategories"

This is a Blob that contains Blobs which are named "tier0", "tier1" etc. It can have any of the numbers up to but not including the number specified by "tiers". (i.e. If tiers is 2, then you can put "tier0" and "tier1" but not any other numbers). For each tier, the requirements must be met for this tier and lower.

"requiredCategories" : {
  "tier0": [
    {
      "category" : "stool",
      "count" : 3
    },
    {
      "category" : "table",
      "count" : 5
    }
  ],
  "tier1": [
    {
      "category" : "stool",
      "count" : 1
    }
  ]
},

You do not need to tie any tiers to any categories, but this will be the most used property in tiles. (You don't care what table is place, just that a table is placed for example.)

"category"

Valid options (String): Any valid string.

Default Value: No default value is specified. Always need to provide your own.


This is the category it will search for in all the tiles in the area.


"count"

Valid options (Integer): A positive integer value.

Default Value: No default value is specified. Always need to provide your own.


This is the number of these tiles it must have before allowing the tier goals to be met.


"requiredObjects"

This is a Blob that contains Blobs which are named "tier0", "tier1" etc. It can have any of the numbers up to but not including the number specified by "tiers". (i.e. If tiers is 2, then you can put "tier0" and "tier1" but not any other numbers). For each tier, the requirements must be met for this tier and lower.

"requiredObjects" : {
  "tier0": [
    {
      "code" : "staxel.tile.glass",
      "count" : 3
    },
    {
      "category" : "staxel.tile.wood",
      "count" : 5
    }
  ],
  "tier1": [
    {
      "category" : "staxel.tile.stool",
      "count" : 1
    }
  ]
},

You do not need to tie any tiers to any objects, but this is useful for making sure a very specific object is placed. (You want to make sure a baking station is placed for example.)


"code"

Valid options (String): A string which contains the code to a Tile.

Default Value: No default value is specified. Always need to provide your own.


This is the exact tile it will search for in all the tiles in the area.


"count"

Valid options (Integer): A positive integer value.

Default Value: No default value is specified. Always need to provide your own.


This is the number of these tiles it must have before allowing the tier goals to be met.


"requiresRoof"

Valid options (Bool): True or False

Default Value: False.


Whether the totem requires a roof before any tier can be reached.


"shopGoods"

This is a Blob that contains Blobs which are named "tier0", "tier1" etc. It can have any of the numbers up to but not including the number specified by "tiers". (i.e. If tiers is 2, then you can put "tier0" and "tier1" but not any other numbers). For each tier, the requirements must be met for this tier and lower.

"shopGoods" : {
  "tier0": [
    {
      "dock": "staxel.tileObject.shop.ShopShelfMerchant",
      "treasures": [
        {
          "code": "staxel.treasure.storeShelf.BuildingStoreCarpet",
          "count": 1
        },
        {
          "code": "staxel.treasure.storeShelf.BuildingStoreHappyBricks",
          "count": 2
        }
      ],
    }
  ]
},

These are the shop goods that will be available after the tier has been met.


"dock"

Valid options (String): A string which contains the code to a Tile.

Default Value: No default value is specified. Always need to provide your own.


This is the tile needed in order to store the treasures listed below.


"treasures"

This is a List of Blobs that contain the Treasure Pools for the selected dock. This commonly looks like;

"treasures": [
  {
    "code": "staxel.treasure.storeShelf.BuildingStoreCarpet",
    "count": 1
  },
  {
    "code": "staxel.treasure.storeShelf.BuildingStoreHappyBricks",
    "count": 2
  }
],

"code"

Valid options (String): A string which contains the code to a Treasure Pool.

Default Value: No default value is specified. Always need to provide your own.


This is the treasure to be used in order to fill the selected dock.

"count"

Valid options (Integer): A positive integer value.

Default Value: No default value is specified. Always need to provide your own.


How many tiles should contain this treasure.


"tiers"

Valid options (Integer): A number that is 0 or greater

Default Value: No default value. Must be specified.


This is how many tiers the totem will have. It will not check for tiers higher than this number. (i.e. If you have tiers = 2, it will check for "tier0","tier1" but will not check "tier2" etc.)


"villagerSpawner"

Valid options (Integer): A code that points to a [Tiles|Tile] that is a villager spawner.

Default Value: Can be omitted. Will not spawn any villagers.


This will place the tile in question and spawn villagers on a night transition or at some other times.