Let me start by saying I hate regions. I have no idea why I have so many issues with them, but they always take a load of pratting around!

Anyway, I am trying to add a new Rectangle2D to the house region of an existing house. I have altered HouseRegion.cs to check if the building has the 'extension'. If it does then when it grabs the Rectangle2d[] of the house area, it'll also add the new rectangle to the end of the array (I have printed this to console and I can see the new rectangle is at the end of the array), but hey ho nothing happens!.

When the extension is added it runs BaseHouse's UpdateRegion(), which triggers it to unregister the old house area, calls HouseRegion (with my added area) and registers the new area... except my new area doesn't work!.

I even marked out the area with piles of gold to make the rectangle wasn't being sent to Kansas!

I'm at a loss! what am I missing here?
 
Mind posting your solution in case someone else stumbles across this post with the same issue?
 
Sure. Well it was partly down to lazy programming on my behalf. Each house can only have one extra room, so I just stored the exact coords of the new Rectangle, rather than an offset based off the house's center tile. What I failed to overlook (somehow) is that when the HouseRegion converts the houses Rectangle2D areas to Rectangle3D areas it also adds the start point X and Y coords of the house. So even though my Rectangle2D was turning up in the right place (show by my lovely gold piles) the conversion was sending the new house region half a map away.
 
Back