Advanced tags for building plugins

Learn here how to create and use plugins.

Moderator: Plugin Moderators

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Advanced tags for building plugins

#1

Post by Lobby »

Hi everyone, in this thread I present you some advanced properties that you may be set for your plugins. For basic information how to write a plugin, please have a look at the basics tutorial.

Attention: Do not use these information to reconstruct addons whose contents you found somewhere else. That's not how we want you to use the plugin system. Please use it only for your own graphics/graphics others explicitly provided you for usage in the game.

So here we present (almost) all tags which can be used in your plugin description file, and to which object you can put them in:

Plugins
Show
active
(optional)
If not set, plugin won't be loaded. Default is true.
Show
id
Unique identifier for each plugin.
Show
type
States the type of the plugin. Possible values are:
  • residential
  • commercial
  • industrial
  • farm
  • harbor ind
  • harbor pier
  • park
  • sport
  • public
  • religion
  • award
  • energy
  • water
  • medic
  • police
  • swat
  • fire brigade
  • education
  • bus depot
  • destroyed
  • decoration
  • buoy
  • railway station
  • waste disposal
  • body disposal
  • military
  • building
  • category
  • notification
  • ground
  • terrain
  • data
  • script
  • template
Show
title
(optional)
Title for the building. Should be English if distributed. Default is null.
Show
text
(optional)
Description for the building. Should be English if distributed. Default is null. If type is notification, it will set the notification text
Show
author
(optional)
Author name of the plugin.
Show
category
The ID of the category the plugin is in
Show
ordinal
Plugins with a lower ordinal will be listed first
Show
width
Tile width of the base of the building.
Show
height
Has to be the same as width.
Show
frames
Graphic frames definition of the plugin. Is an array of frames. Each frame has the form

Code: Select all

{"bmp":"image_name.png"}
At least one frame has to be given. If multiple frames are given, player may select one of them in the game (default).
Show
border frames
Ground only.
An array of 16 frames to use when the ground touches another one. The image has to be like this
wbck.png
wbck.png (13.63 KiB) Viewed 54898 times
Show
edge frames
2 16×48 frames to use when the ground is at the edge of the map. They have to be like this
world_0_0.png
world_0_0.png (3.03 KiB) Viewed 54897 times
Show
edge border frames
No idea. Everything I know is that they have to be 32 frames. Try using the same frames as the ones you used at "frames"
Show
frames winter
(optional)
Works as frames. If you define it you have to provide the same number of frames as in frames. These frames will be used when winter is enabled.
Show
random frame
Every time you place the building, a random frame from the frame array will be selected
Show
smoke
(optional)
List of smoke sources. Have a look at the listing of defined smoke types for more information. Position is relative to pivot point of the building.
Show
animation
(optional)
Similar to smoke, can be used to place smaller animations on your building. Position is relative to pivot point of the building. May look like

Code: Select all

"animation":[{"id":"$animationblinkingredlight3x3","x":70,"y":-107}],
to position a 3x3 pixel sized blinking red light at the specified relative position.
Show
level
(rci only)
For residential, commercial and industrial buildings only: Building level, should be 1, 2 or 3.
Show
needs road
(optional)
Determines whether a road connection is needed for this building. Default is true.
Show
needs land
(optional)
Determines whether building can only be built if at least one ground tile is land (not water). Default is true.
Show
needs water
(optional)
Determines whether building can only be built if at least one ground tile is water. Default is false.
Show
build time
(rci only, optional)
Build time in days. By default this value is inferred by height of the building.
Show
influence *
Sets the influence of the building
Possible keys are:
Show
"influence pollution"
"influence noise"
"influence health"
"influence police"
"influence fire department"
"influence park"
"influence sport"
"influence education low"
"influence education high"
"influence culture"
"influence management"
"influence religion"
"influence passenger bus"
"influence passenger train"
"influence residential"
"influence commercial"
"influence industrial"
"influence level0"
"influence level1"
"influence level2"
"influence radioactive"
"influence nature"
"influence waste disposal"
"influence body disposal"
Example

Code: Select all

"influence noise":82,
Show
provide aspect *
Can be used to set the student capacity of a school
Possible keys are:
"provide aspect education high"
"provide aspect education low"
"provide aspect health care"
For example:

Code: Select all

"provide aspect education high":5000,
Show
animated
(optional)
If true, multiple frames will be used for animation. Use may not select specific frame anymore. Default is false.
Show
price
(not rci, optional)
Price of the building in Ͳheos. Default is 0.
Show
monthly price
(optional)
Monthly price of the building in Ͳheos. Default is 0.
Show
power
(optional)
Produced amount of energy by this building in kWh. Default is estimated by building size.
Show
water
(optional)
Produced amount of water by this building in L/h (negative values for need). Default is estimated by building size.
Show
max count
(optional, not rci)
Max number of buildings of this type in the city. Default is -1 (no limitation).
Show
draw ground
(optional)
If set, ground tiles of the building will be drawn. Useful for buildings that are partly transparent on ground. Default is false.
Show
rotation aware
(optional)
If set, given frames will be used for rotation. In this case you have to provide a multiple of 4 frames. Default is false.
Show
map color
Only for terrain and zones. For example:

Code: Select all

"map color":{"r":255,"g":255,"b":0}
will make the terrain look yellow in the map
Show
map color winter
Like map color, but only displayed on winter
Show
habitants
(optional, r only)
Number if habitants in this building. Is inferred based on size of the building by default.
Show
workers
(optional, ci only)
Number of workers in this building. Is inferred based on size of the building by default.
Show
auto build
(optional, rci only)
If set, building can be built automaticially. Default is true.
Show
conductive
(optional)
If true, this building will conduct energy. Default is true.
Show
super conductive
(optional)
If true, this building will conduct high voltage energy like transmission lines. Default is false.
Show
destroyable
(optional)
If false, the building cannot burn. Default is true.
Show
removeable
(optional)
If false, the building is locked so that it cannot be removed by the player. Default is true.
Show
meta
Can be used, for example, in cars to set in which kind of building do they spawn

Code: Select all

"meta":{"tags":{"carres0":{}}}
Scroll down to see all tags appliable inside the "tags" node.
Show
fun
See this
Show
upgrades
Sets the upgrades the building can have
Value is an array of plugins.
Some additional notes:
  • price, monthly price, water, power and influences will be added to corresponding values of the building when the upgrade is applied
  • You can also provide animations as for regular buildings, but no smoke
  • You can set "only one":true in an upgrade to state that no other upgrade may be active at the same time. We use this for example for the radio station were you can have selected only one program at the same time.
Show
add prices
A single id or array of ids of other drafts whose building price should be added when building this plugin.
Show
supports shoreline
For buildings only. If set to false the building cannot be built if there is coast under it.

True by default.
Show
draw ground water
For buildings only. Draw water under the building like old versions of the game which did not use tile based water drawing. If your building does not rely on water being drawn underneath it setting this attribute to false can improve drawing performance of the game. If draw ground is active this setting will be ignored.

True by default for plugins for compatibility reasons.

Frames
Show
bmp
Sets the file to get the image from.
The file has to be in the same folder as your code
Default is the world texture
Show
x
The horizontal position of the frame in the graphic. Default is 0
Show
y
Like x, but vertically
Show
w
Sets the width of the frame to be selected
For example:

Code: Select all

"bmp":"jssj.png","w":32,
Will display only the left 32 pixels of the image
Show
h
Like w, but with height
Show
count
This will repeat the frame <value> times to the right

Code: Select all

"frames":[
{"bmp":"a.png","w":32,"h":16}
{"bmp":"b.png", "w":32,"h":16}
]
Is the same as

Code: Select all

"frames":[
{"bmp":"a_and_b_put_together.png",
"count":2,
"w":32,"h":16}
]

...
TODO: HANDLE X AND HANDLE Y
REASON: NO IDEA WHAT IT IS


Meta
Show
carres0
For level 1 residential cars
Show
carres1
For level 2 residential cars
Show
carres2
For level 3 residential cars
Show
carcom0
For level 1 commercial cars
Show
carcom1
For level 2 commercial cars
Show
carcom2
For level 3 commercial cars
Show
carind0
For level 1 industrial cars
Show
carind1
For level 2 industrial cars
Show
carind2
For level 3 industrial cars
Show
firework
See here
:66:
Show
supports slope
Determines whether this building handles slopes on it's own (graphically). Enabling this will not draw the concrete blocks under the building. Usually only recommended for decorations and in combination with "draw ground":true.
Usage:

Code: Select all

"supports slope":true"
false by default.
Show
supports terrain
Indicates whether this building can be placed on terrain in general (if not the building will only be placeable on flat areas).
Usage:

Code: Select all

"supports terrain":false
true by default.
Show
budget item
Buildings that have monthly income or spendings usually appear in the budget view in the associated category, that is e.g. parks for buildings of type park. You can define your own type of budget, called budget item. That is a data object that will be used to provide a name for the item. To assign a building to that item add the "budget item" attribute to the building's code:

Code: Select all

"budget item":"$budgetitemid00"
That's how the definition of the budget item itself would look like:

Code: Select all    Reset

[ { "id":"$budgetitemid00", "type":"data", "title":"My item...", "meta":{ "tags":{ "budget item":{} } } } ]
JSON checker
Check
Order matters, so you will have to ensure that the budget item was loaded first.
Last edited by CommanderABab on 30 Mar 2020, 00:35, edited 15 times in total.

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

#2

Post by Lobby »

Since version 296 you may let buildings (e.g. decorations) automatically spawn in map creation. To do so, we added an object called "spawn" which contains probability p, main spawn height height and max deviation from it radius.

A small sample plugin that spawns grass in the ocean:

Code: Select all    Reset

[ { "id":"$myspawntest00", "type":"decoration", "width":1, "height":1, "frames":[{"x":0,"y":0,"w":32,"h":16}], "needs water":false, "needs land":false, "draw ground":true, "spawn": { "p":0.01, "height":-600, "radius":600 } } ]
JSON checker
Check
To give you some intuition about what height means I measured some height values in this map:
Image

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Advanced tags for building plugins

#3

Post by Lobby »

Added attribute sound click to provide a sound file (from within your plugin's directory) which will be played when user taps on your building.

Example:

Code: Select all

"sound click":{"file":"sound.ogg"}
A variety of audio formats is supported, see this listing for more information.

User avatar
CommanderABab
AB
Posts: 11185
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

#4

Post by CommanderABab »

Additional flags for ground only (we have no thread for ground, yet) that specify color in the minimap:

map color (default={"r":72,"g":93,"b":96} for water and {"r":68,"g":96,"b":48} otherwise)
Color of this ground type in the minimap if it's not winter.

map color winter (default={"r":72,"g":93,"b":96} for water and {"r":239,"g":239,"b":239} otherwise)
Colors of this ground type in the minimap in winter.

Usage:

Code: Select all

"map color":{"r":72,"g":93,"b":96},

User avatar
Barky
TheoTown Cartographer
Posts: 2056
Joined: 17 Apr 2017, 22:13
Location: Ireland
Plugins: Showcase Store

Platform

Re: Advanced tags for building plugins

#5

Post by Barky »

Isnt Influence a tag?

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Advanced tags for building plugins

#6

Post by Lobby »

You're right, influences aren't covered, yet.

User avatar
mdk_813
Inhabitant of a Country
Posts: 857
Joined: 16 Dec 2016, 02:38
Location: Germany
Plugins: Showcase Store

Platform

Re: Advanced tags for building plugins

#7

Post by mdk_813 »

Lobby wrote:
23 Feb 2017, 00:20
[*]animation (optional)
Similar to smoke, can be used to place smaller animations on your building. Position is relative to pivot point of the building. May look like

Code: Select all

"animation":[{"id":"$animationblinkingredlight3x3","x":70,"y":-107}],
to position a 3x3 pixel sized blinking red light at the specified relative position.
Hi Lobby,
I would like to make my own blinking light, that is an animated version of the red lights which you can see on my TV tower for example. Could you please provide the png of "$animationblinkingredlight3x3" here, so that I can see what it looks like?
Thanks!

User avatar
malsa
Inhabitant of a Multiverse
Posts: 5085
Joined: 10 Feb 2017, 17:40
Location: Malaysia
Plugins: Showcase Store
Version: Beta

Platform

Re: Advanced tags for building plugins

#8

Post by malsa »

What is RCI mean?

User avatar
Kulche
Pluche
Posts: 1177
Joined: 07 Jun 2017, 20:28
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

#9

Post by Kulche »

Fireout wrote:
21 Aug 2017, 06:34
What is RCI mean?
:bb

Residential, Commercial, Industrial

User avatar
malsa
Inhabitant of a Multiverse
Posts: 5085
Joined: 10 Feb 2017, 17:40
Location: Malaysia
Plugins: Showcase Store
Version: Beta

Platform

Re: Advanced tags for building plugins

#10

Post by malsa »

Kulche wrote:
21 Aug 2017, 09:39
Fireout wrote:
21 Aug 2017, 06:34
What is RCI mean?
:bb

Residential, Commercial, Industrial
Oh i see ._.

User avatar
Brody Craft
Inhabitant of a Infinity
Posts: 8034
Joined: 24 Jan 2017, 11:15
Location: SE Asia
Plugins: Showcase Store
Version: Beta

Platform

Re: Advanced tags for building plugins

#11

Post by Brody Craft »

Fireout wrote:
21 Aug 2017, 09:47
Kulche wrote:
21 Aug 2017, 09:39
Fireout wrote:
21 Aug 2017, 06:34
What is RCI mean?
:bb

Residential, Commercial, Industrial
Oh i see ._.
Since when you didnt knwo about that

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Advanced tags for building plugins

#12

Post by Lobby »

mdk_813 wrote:
20 Aug 2017, 19:03
Could you please provide the png of "$animationblinkingredlight3x3"
Of course, it's not a secret.
redlights.png
redlights.png (208 Bytes) Viewed 57227 times
greenlights.png
greenlights.png (212 Bytes) Viewed 57227 times
bluelights.png
bluelights.png (212 Bytes) Viewed 57227 times
whitelights.png
whitelights.png (213 Bytes) Viewed 57227 times
These animations are all built into the game as $animationblinkingredlight3x3, $animationblinkinggreenlight3x3, $animationblinkingbluelight3x3 and $animationblinkingwhitelight3x3

The definition looks just like

Code: Select all

[
  {
    "id":"$animationblinkingredlight3x3",
    "type":"animation",
    "frames":[{"bmp":"redlights.png","w":3,"h":3,"count":8}]
  }
]

User avatar
JustAnyone
Developer
Posts: 3534
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: Advanced tags for building plugins

#13

Post by JustAnyone »

Could I get all of rank ids in PM? Thanks.

User avatar
mdk_813
Inhabitant of a Country
Posts: 857
Joined: 16 Dec 2016, 02:38
Location: Germany
Plugins: Showcase Store

Platform

Re: Advanced tags for building plugins

#14

Post by mdk_813 »

Lobby wrote:
22 Aug 2017, 10:11
mdk_813 wrote:
20 Aug 2017, 19:03
Could you please provide the png of "$animationblinkingredlight3x3"
Of course, it's not a secret.
redlights.pnggreenlights.pngbluelights.pngwhitelights.png

These animations are all built into the game as $animationblinkingredlight3x3, $animationblinkinggreenlight3x3, $animationblinkingbluelight3x3 and $animationblinkingwhitelight3x3

The definition looks just like

Code: Select all

[
  {
    "id":"$animationblinkingredlight3x3",
    "type":"animation",
    "frames":[{"bmp":"redlights.png","w":3,"h":3,"count":8}]
  }
]

Cool, thank you!
One more question, though, would it be possible to add animation and make the building rotation aware at the same time? I assume, I would have to define the coordinates of the animation for every frame then?

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Advanced tags for building plugins

#15

Post by Lobby »

Yes, you can do that by using animation indices. With them you can say which animations should be visible for which frames (in this case different frames represent different rotations, but that's just a special case of having multiple frames).

Here an example to outline how it works for a simple animation like the blinking red light:

Code: Select all

[
  {
    "id":"$random_plugin",
    "type":"deco",
    "width":2,
    "height":2,
    "frames":[{...}], // 4 frames
    "rotation aware":true,
    "animation":[
      {"id":"$animationblinkingredlight3x3","x":52,"y":-10}, // this is animation 0
      {"id":"$animationblinkingredlight3x3","x":52,"y":-20}, // animation 1
      {"id":"$animationblinkingredlight3x3","x":12,"y":-20}, // and so on
      {"id":"$animationblinkingredlight3x3","x":12,"y":-10}  // ...
    ],
    "frame animation indices":[
      [0], // animations to show in first frame: 0
      [1], // animations to show in second frame: 1
      [2], // and so on
      [3]  // ...
    ]
  }
]

Another solution would be using rotation aware animations, but I think that's not a good solution because the animation shouldn't "know" about your building so it can be reused more easily.

User avatar
KINGTUT10101
1,000,000 inhabitants
Posts: 2226
Joined: 07 Jul 2016, 22:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta
Contact:

Plugin Creator

Platform

Re:

#16

Post by KINGTUT10101 »

Lobby wrote:
31 May 2017, 00:37
Since version 296 you may let buildings (e.g. decorations) automatically spawn in map creation. To do so, we added an object called "spawn" which contains probability p, main spawn height height and max deviation from it radius.

A small sample plugin that spawns grass in the ocean:

Code: Select all

[
  {
    "id":"$myspawntest00",
    "type":"decoration",
    "width":1,
    "height":1,
    "frames":[{"x":0,"y":0,"w":32,"h":16}],
    "needs water":false,
    "needs land":false,
    "draw ground":true,
    "spawn":
    {
      "p":0.01,
      "height":-600,
      "radius":600
    }
  }
]
To give you some intuition about what height means I measured some height values in this map:
Image
@Lobby

Is it possible to make a decoration spawn past a certain height. Ex: I want my decoration to spawn at heights lower than -350. A few examples of heights that would work for this could be -360, -477, -2234, etc. Heights that wouldn't work could be -220, 300, etc.

User avatar
CommanderABab
AB
Posts: 11185
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Re:

#17

Post by CommanderABab »

KINGTUT10101 wrote:
03 Sep 2017, 20:43
Lobby wrote:
31 May 2017, 00:37
Press to uncollapse...Since version 296 you may let buildings (e.g. decorations) automatically spawn in map creation. To do so, we added an object called "spawn" which contains probability p, main spawn height height and max deviation from it radius.

...A small sample plugin that spawns grass in the ocean:[code][
{
"id":"$myspawntest00",
"type":"decoration",
"width":1,
"height":1,
"frames":[{"x":0,"y":0,"w":32,"h":16}],
"needs water":false,
"needs land":false,
"draw ground":true,
"spawn":
{
"p":0.01,
"height":-600,
"radius":600
}
}
][/code]


To give you some intuition about what height means I measured some height values in this map:
...Image
@Lobby

Is it possible to make a decoration spawn past a certain height. Ex: I want my decoration to spawn at heights lower than -350. A few examples of heights that would work for this could be -360, -477, -2234, etc. Heights that wouldn't work could be -220, 300, etc.
Not pretending to be Lobby, but couldn't you do this?

Code: Select all

[
  { 
    "id":"$myspawntest00",
    "type":"decoration",
    "width":1,
    "height":1,
    "frames":[{"x":0,"y":0,"w":32,"h":16}],
    "needs water":false,
    "needs land":false,
    "draw ground":true,
    "spawn":
    {
      "p":0.01,
      "height":-360,
      "radius":10
    }
  },
  { 
    "id":"$myspawntest01",
    "hidden":true,
    "type":"decoration",
    "width":1,
    "height":1,
    "frames":[{"x":0,"y":0,"w":32,"h":16}],
    "needs water":false,
    "needs land":false,
    "draw ground":true,
    "spawn":
    {
      "p":0.01,
      "height":-450,
      "radius":25
    }
  },
  { 
    "id":"$myspawntest02",
    "hidden":true,
    "type":"decoration",
    "width":1,
    "height":1,
    "frames":[{"x":0,"y":0,"w":32,"h":16}],
    "needs water":false,
    "needs land":false,
    "draw ground":true,
    "spawn":
    {
      "p":0.01,
      "height":-2250,
      "radius":100
    }
  }
]

User avatar
KINGTUT10101
1,000,000 inhabitants
Posts: 2226
Joined: 07 Jul 2016, 22:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta
Contact:

Plugin Creator

Platform

Re: Advanced tags for building plugins

#18

Post by KINGTUT10101 »

Yes, but that's not exactly what I was asking about. Those numbers I provided in the example were heights that a decoration could spawn at if I wanted heights below -350. I didn't want it to spawn at those specific heights, they were just examples of where they could spawn.

User avatar
CommanderABab
AB
Posts: 11185
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Advanced tags for building plugins

#19

Post by CommanderABab »

:lol:
Ok, so make it

Code: Select all

 "spawn":
    {
      "p":0.01,
      "height":-1350,
      "radius":1000
    }

User avatar
Ahmad Nur Aizat
TheoTown Veteran
Posts: 8260
Joined: 25 Oct 2016, 15:20
Location: Johor Bahru
Plugins: Showcase Store
Version: Beta
Contact:

Plugin Creator

Platform

#20

Post by Ahmad Nur Aizat »

Can I get a full list of plugin building types? Just to make sure...

Post Reply Previous topicNext topic

Return to “Tutorials and Documentation”