What is this "Could not register region" error?

Started by Latta, August 23, 2015, 08:12:03 AM

Previous topic - Next topic

Latta

When I try to spawn a door using Scatterer(MapGen), some doors make this kind of errors for a few times, repeatedly, about 5~7 times:


Could not register region Region(id=4213, center=(102, 0, 56), links=0, cells=42) in link (span=(root=(96, 0, 52), dir=North + length=7) hash=1970324837187680, regions=4190 and 4197): > 2 regions on link!


I don't have any clue about this. How can a region link have more than two regions, because I built a door?

isistoy

Hello Latta,

I dunno if it can help, 'cause the video is quite old but this is Tynan giving hints about regions.
This passage talks about doors, with regions:

https://youtu.be/RMBQn_sg7DA?t=1058
<Stay on the scene like a State machine>

Latta

This might be the case, if multiple doors spawn following a region link...
Even if it's not, I didn't know about this video. Thanks!

Tynan

It's possible that you're either doing something wrong or just doing something that exposes a bug in the region system. Probably #2. Theoretically it should be impossible to see this message almost no matter what you do.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Latta

#4
That makes me even more confused.


        private Thing MakeDoor(IntVec2 loc, ThingDef wallStuff)
        {
            Common.DebugLog("LT: Making door.");
            var edifice = loc.ToIntVec3.GetEdifice();
            edifice?.Destroy();

            var door = ThingMaker.MakeThing(ThingDef.Named("Door"), wallStuff);
            door.SetFaction(Faction.OfMechanoids); //MECHANOID!

            return GenSpawn.Spawn(door, loc.ToIntVec3);
        }


This is my code responsible for spawning individual door, which is called from...


for (var i = 1; i < count; i++)
            {
                for (var j = 0; j < MaxTries; j++)
                {

                    ...

                    /*
                    =====================Filling Phase=====================
                    */
                    MakeShed(_roomList[i].rect, wallStuff, false);

                    if (!RoleFiller.Fill(ref _roomList[i].rect, _roomList[i].Role))
                        Log.Warning("LT: Could not fill " + _roomList[i].Role + " room.");

                    if (MakeDoor(_roomList[i].Location, wallStuff) == null)
                        Log.Warning("Scatterer " + this.ToString() + " could not place a door.");

                    break;
                }
            }


...this part. MakeShed is not different, making box shaped room. Please ignore RoleFiller here, as they just spawn some mechs and items. Would making a wall and then immediately delete it, replacing with door cause regions or region links to go mad?

Tynan

Sounds like there may be a bug in the region system. I'll move this to Bugs.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Tynan

Can you post your mod that reproduces this bug?

I'll investigate.

ison leave this to me.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Tynan

No mod posted :(

PM me if you get this later Latta.

Locking.
Tynan Sylvester - @TynanSylvester - Tynan's Blog