Questions about making buildings in json


#1

I’m rather confused about the x and y coordinates in the json. I’m probably just being stupid, but I keep having issues with figuring out how exactly it works. More to the point: Where is the point of origin on those 24x24 grids you make in the json?
I’m using fire_station.json as a reference and certain items are obviously meant to spawn in certain places:
{
“item”: “fireman_gear”,
“x”: [ 20, 20 ],
“y”: [ 21, 21 ],
“chance”: 70
}

So there is a 70% chance that an item with the flag ‘fireman_gear’ will spawn at the coordinates for x: [20,20] y: [21,21], correct?
I understand that inside the [ ] each number defines a range of where something will be. So if it was [10, 20] then something could be between the coordinate 10 and the coordinate 20. Check.

Now I just need to make it so stuff will spawn inside of lockers, which means that I need make specify that with the ‘x’ and ‘y’ coordinates.

Secondly, there is this weird thing happening with one of the mechanical winches.
Fire%20station1
Fire%20Station2
When I 'a’ctivate the winch to close the ‘garage’ doors (after opening them in the first place) it will spawn these three extra ones. When I activate it again to open the garage, they go away.

Does it have to do with the wall I added? It isn’t necessary but I’d like if I could keep it.


#2

In general in CDDA, [0,0] is the upper left hand corner of the screen, and the X axis increases to the right and the Y axis increases toward the bottom of the screen.


#3

I don’t know what I’m looking at in your screenshot because I don’t use that tileset. However, I do know that winches are finicky. There’s a post . . . Bah, couldn’t find it.

The ones I’ve used (t_gates_mech_control) requires that you place it next to a t_wall or it doesn’t work. And that t_wall has to be attached to the locked metal door. My guess is that they’re all pretty sensitive and I wouldn’t mess with them unless you’re patient and good at puzzling things out. Best I can say is to look at the default layout and work backwards, but you probably know that.

EDIT:
And yes, if a coordinate is represented by multiple numbers the object will spawn in one of those locations. So, an item at coordinate x: [ 21, 23 ], y: [ 7, 7 ] has a chance to spawn at 21,7 22,7 or 23, 7.

Also, y: [ 7, 7 ] is the same as y: 7. It’s written both ways throughout the game files and although the brackets make it look nicer I don’t think that’s a hard rule.