Ejemplo n.º 1
0
            public virtual void Generate(Stencil s)
            {
                var spacingX = this.spacingX > 0 ? this.spacingX : spacing;
                var spacingZ = this.spacingZ > 0 ? this.spacingZ : spacing;

                s.ClearThingsInBounds();
                if (!naturalFloor)
                {
                    s.FillTerrain(GenCity.RandomFloor(s.map));
                }
                if (roofed)
                {
                    var wallStuff = GenCity.RandomWallStuff(s.map);
                    s.Spawn(s.MinX, s.MinZ, ThingDefOf.Wall, wallStuff);
                    s.Spawn(s.MaxX, s.MinZ, ThingDefOf.Wall, wallStuff);
                    s.Spawn(s.MinX, s.MaxZ, ThingDefOf.Wall, wallStuff);
                    s.Spawn(s.MaxX, s.MaxZ, ThingDefOf.Wall, wallStuff);
                    s.FillRoof(RoofDefOf.RoofConstructed);
                }

                var stuff = thingStuff ?? GenCity.RandomStuff(thingDef, s.map);

                var paddingX = spacingX / 2 + 1;
                var paddingZ = spacingZ / 2 + 1;

                for (var x = s.MinX + paddingX; x <= s.MaxX - paddingX; x += spacingX)
                {
                    for (var z = s.MinZ + paddingZ; z <= s.MaxZ - paddingZ; z += spacingZ)
                    {
                        s.Spawn(x, z, thingDef, stuff);
                    }
                }
            }