Question about .json item groups

I have a quick question about item groups. Is there a way to have a reference to another item group within a list of items. For example this:

{ "type" : "item_group", "id" : "forest", "items":[ ["rock", 40], ["stick", 95], ["pine_bough", 15], ["acorns", 15], ["pinecone", 5], ["one_year_old_newspaper", 2], ["months_old_newspaper", 3], ["weeks_old_newspaper", 4], ["newest_newspaper", 5], ["bottle_plastic", 1], ["bottle_glass", 1], ["syringe", 1], ["cig_butt", 1] ] }
…could be changed to something like this:

{ "type" : "item_group", "id" : "forest", "items":[ ["rock", 40], ["stick", 95], ["pine_bough", 15], ["acorns", 15], ["pinecone", 5], ["ITEM_GROUP":"trash", 5] ] }
Or something like that.

Basically a way to nest smaller, more focused item groups in larger ones.

I see that you can set a point and set a line, but is in there a way to set an area or fill a rectangle with terrain?

This works, but it seems kinda crappy.

"place_terrain": [ { "x": [ 12, 22 ], "y": [ 7, 14 ], "ter": "t_concrete", "repeat": 999 } ],

It looks like json has some support for using “square” instead of “set”, but I can’t find it mentioned except but for a couple places in the code. I don’t have my IDE right now though, just going off of github.

I wonder why people even bother to write documentation when apparently nobody reads them.

Basically a way to nest smaller, more focused item groups in larger ones.

Yes, and if you had looked at data/json/item_groups.json carefully (hint: search for “group” - with the [tt]"[/tt]), you would have found the item group “forage_summer” (search for it). It contains an example of what you want. Btw. the documentation for item groups is in doc/ITEM_SPAWN.md

I see that you can set a point and set a line, but is in there a way to set an area or fill a rectangle with terrain?

From doc/MAPGEN.md:

### 2.3.2 "square" **required** Define a square of things. Requires "x", "y", "x2", "y2", "id" (or "amount" for "radiation") > Value: "terrain", "furniture", "trap", "radiation"

Example: { “square”: “radiation”, “amount”: 10, “x:” [ 0, 5 ], “y”: [ 0, 5 ], “x2”: [ 18, 23 ], “y2”: [ 18, 23 ] }
The arguments are exactly the same as “line”, but “x”, “y” and “x2”, “y2” define opposite corners

Apparently this is currently not used in any mapgen, so no actual example.

However, why don’t you the other mapgen system where you draw a map in ASCII and link the characters to the furniture/items/terrain etc. - see data/json/mapgen/museum.json for an example. That format is far easier to read and understand than using explicit coordinates.

I didn’t read them because I didn’t even know they existed. Thanks for pointing those out. I was looking through the game files not on the git.

[quote=“BevapDin, post:4, topic:9956”]> Basically a way to nest smaller, more focused item groups in larger ones.

Yes, and if you had looked at data/json/item_groups.json carefully (hint: search for “group” - with the [tt]"[/tt]), you would have found the item group “forage_summer” (search for it). It contains an example of what you want. Btw. the documentation for item groups is in doc/ITEM_SPAWN.md

I see that you can set a point and set a line, but is in there a way to set an area or fill a rectangle with terrain?

From doc/MAPGEN.md:

### 2.3.2 "square" **required** Define a square of things. Requires "x", "y", "x2", "y2", "id" (or "amount" for "radiation") > Value: "terrain", "furniture", "trap", "radiation"

Example: { “square”: “radiation”, “amount”: 10, “x:” [ 0, 5 ], “y”: [ 0, 5 ], “x2”: [ 18, 23 ], “y2”: [ 18, 23 ] }
The arguments are exactly the same as “line”, but “x”, “y” and “x2”, “y2” define opposite corners

Apparently this is currently not used in any mapgen, so no actual example.

However, why don’t you the other mapgen system where you draw a map in ASCII and link the characters to the furniture/items/terrain etc. - see data/json/mapgen/museum.json for an example. That format is far easier to read and understand than using explicit coordinates.[/quote]

Awesome. Thanks.

I can’t use the ASCII method easily because I want several rooms on the same map with different floors but the same type furniture. And it would be weird if a player moved a dresser to find a different color of carpet from the rest of the room.