CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.33k stars 4.14k forks source link

Evac center NPCs spawning outside #15436

Closed ejseto closed 8 years ago

ejseto commented 8 years ago

Go to debug menu, overmap editor, place evac center. NPCs will randomly be outside the building or stuck in walls.

kevingranade commented 8 years ago

Does this happen with a regular spawn and it happens with debug also, or have you only seen it with the debug menu?

ejseto commented 8 years ago

It's happened pretty much every time I've come across an evac center. It's been happening for quite awhile, though when the evac center was first added, all the NPCs would all spawn in their appointed locations (e.g. merchant in the locked room, broker in the small office)

Nymall commented 8 years ago

What version are you using? I'm running windows Exp 4422 Curses and generation seems normal. I explored 5 overmap zones, and all 4 centers I came across generated normally.

John-Candlebury commented 8 years ago

IRC I think i've seen it happen when the center spawns with a not N-S orientation.

ejseto commented 8 years ago

Windows tiles compiled with MinGW64 gcc 4.9.0. It's been like this for months so it's not some recent thing.

joshburbrink commented 8 years ago

Man, I never ran into this before until recently. Annoying having them spawn outside - as zombies eventually come around, and the NPC reload bug causes there brain to explode.

Coolthulhu commented 8 years ago

Rotation code is a giant mess of special cases and coordinate conversions. It looks like the rotation cases of NPCs are labeled 3-2-1 while terrain ones are 1-2-3, but both contain the same code. But making the labels consistent breaks the rotations...

It is also possible that NPCs may not be rotated at all in some cases:

As a result, static NPCs created in the far away areas of the map will most likely not get rotated with the rest of the map.

mugling commented 8 years ago

Evac center has become rather rare as of recent?

Coolthulhu commented 8 years ago

I think I have another idea of what may be causing it: NPCs may be placed using functions that try to find a free space for them. Depending on function order, it may cause the NPC to be moved before rotation, thus changing the end point of the rotation.