Ejemplo n.º 1
0
        IntGrid2Z?FindStartLocation(EnvironmentObject env)
        {
            const int size = 2;

            var center = env.StartLocation;

            foreach (var p in IntVector2.SquareSpiral(center.ToIntVector2(), env.Width / 2))
            {
                if (env.Size.Plane.Contains(p) == false)
                {
                    continue;
                }

                var z = env.GetSurfaceLevel(p);

                var r = new IntGrid2Z(p.X - size, p.Y - size, size * 2, size * 2, z);

                if (TestStartArea(env, r))
                {
                    return(r);
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
        static void CreateWorkbenches(EnvironmentObject env)
        {
            int posx = env.Width / 2 - 10;
            int posy = env.Height / 2 - 10;

            var surface = env.GetSurfaceLevel(new IntVector2(posx, posy));

            {
                var p = new IntVector3(posx, posy, surface);
                ClearFloor(env, p);
                var item = CreateItem(env, ItemID.SmithsWorkbench, MaterialID.Iron, p);
                item.IsInstalled = true;
            }

            posx += 4;

            {
                var p = new IntVector3(posx, posy, surface);
                ClearFloor(env, p);
                var item = CreateItem(env, ItemID.CarpentersWorkbench, MaterialID.Oak, p);
                item.IsInstalled = true;
            }

            posx += 4;

            {
                var p = new IntVector3(posx, posy, surface);
                ClearFloor(env, p);
                var item = CreateItem(env, ItemID.MasonsWorkbench, MaterialID.Iron, p);
                item.IsInstalled = true;
            }

            posx = env.Width / 2 - 10;

            posy += 4;

            {
                var p = new IntVector3(posx, posy, surface);
                ClearFloor(env, p);
                var item = CreateItem(env, ItemID.SmelterWorkbench, MaterialID.Iron, p);
                item.IsInstalled = true;
            }

            posx += 4;

            {
                var p = new IntVector3(posx, posy, surface);
                ClearFloor(env, p);
                var item = CreateItem(env, ItemID.GemcuttersWorkbench, MaterialID.Iron, p);
                item.IsInstalled = true;
            }
        }