Exemplo n.º 1
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     CircuitPath = new Element[0][];
     base.Load(valuesDictionary);
     Utils.Load(Project);
     Path         = new HashSet <Device>();
     Table        = new Dictionary <Point3, Device>(valuesDictionary.GetValue("Count", 0));
     elementblock = BlocksManager.Blocks[ElementBlock.Index] as ElementBlock;
     Task.Run((Action)ThreadFunction);
 }
Exemplo n.º 2
0
        public override void Load(ValuesDictionary valuesDictionary)
        {
            base.Load(valuesDictionary);
            Utils.Load(Project);
            //Utils.SubsystemItemsScanner.ItemsScanned += GarbageCollectItems;
            var arr = valuesDictionary.GetValue("AlloysData", "0").Split(',');

            AlloysData = new DynamicArray <Metal>(arr.Length);
            int i;

            for (i = 0; i < arr.Length; i++)
            {
                if (short.TryParse(arr[i], NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out short value))
                {
                    AlloysData.Add((Metal)value);
                }
            }
            SmallBrushes = new TerrainBrush[16];
            PtBrushes    = new TerrainBrush[16];
            BBrushes     = new TerrainBrush[16];
            ABrushes     = new TerrainBrush[16];
            //NaruralGasBrushes = new TerrainBrush[16];
            OilPocketCells = new TerrainBrush.Cell[16][];
            //MinCounts = new int[12, 16];
            var          random = new Random(17034);
            TerrainBrush brush;
            int          j, k;

            for (i = 0; i < 16; i++)
            {
                brush = new TerrainBrush();
                Vector3 v, vec;
                for (j = random.Int() & 1; j-- != 0;)
                {
                    v   = 0.5f * Vector3.Normalize(new Vector3(random.UniformFloat(-1f, 1f), random.UniformFloat(-1f, 1f), random.UniformFloat(-1f, 1f)));
                    vec = Vector3.Zero;
                    for (k = random.UniformInt(2, 5); k-- != 0;)
                    {
                        brush.AddBox((int)MathUtils.Floor(vec.X), (int)MathUtils.Floor(vec.Y), (int)MathUtils.Floor(vec.Z), 1, 1, 1, 1);                         //Ag
                        vec += v;
                    }
                }
                brush.Compile();
                SmallBrushes[i] = brush;
                brush           = new TerrainBrush();
                for (j = random.UniformInt(1, 3); j-- != 0;)
                {
                    v   = 0.5f * Vector3.Normalize(new Vector3(random.UniformFloat(-1f, 1f), random.UniformFloat(-2f, 2f), random.UniformFloat(-1f, 1f)));
                    vec = Vector3.Zero;
                    for (k = random.UniformInt(2, 3); k-- != 0;)
                    {
                        brush.AddBox((int)MathUtils.Floor(vec.X), (int)MathUtils.Floor(vec.Y), (int)MathUtils.Floor(vec.Z), 1, 1, 1, 2);                         //Pt
                        vec += v;
                    }
                }
                brush.Compile();
                PtBrushes[i] = brush;
                brush        = new TerrainBrush();
                for (j = random.UniformInt(2, 4); j-- != 0;)
                {
                    v   = 0.5f * Vector3.Normalize(new Vector3(random.UniformFloat(-1f, 1f), random.UniformFloat(-0.25f, 0.25f), random.UniformFloat(-1f, 1f)));
                    vec = Vector3.Zero;
                    for (k = random.UniformInt(3, 5); k-- != 0;)
                    {
                        brush.AddBox((int)MathUtils.Floor(vec.X), (int)MathUtils.Floor(vec.Y), (int)MathUtils.Floor(vec.Z), 1, 1, 1, 8);                         //Ti
                        vec += v;
                    }
                }
                brush.Compile();
                ABrushes[i] = brush;
                brush       = new TerrainBrush();
                for (j = random.UniformInt(3, 5); j-- != 0;)
                {
                    v   = 0.5f * Vector3.Normalize(new Vector3(random.UniformFloat(-1f, 1f), random.UniformFloat(-1f, 1f), random.UniformFloat(-1f, 1f)));
                    vec = Vector3.Zero;
                    for (k = random.UniformInt(2, 5); k-- != 0;)
                    {
                        brush.AddBox((int)MathUtils.Floor(vec.X), (int)MathUtils.Floor(vec.Y), (int)MathUtils.Floor(vec.Z), 1, 1, 1, 5);                         //Sn
                        vec += v;
                    }
                }
                brush.Compile();
                BBrushes[i] = brush;
                var cells = TerrainContentsGenerator.m_basaltPocketBrushes[i].Cells;
                OilPocketCells[i] = new TerrainBrush.Cell[j = cells.Length];
                while (j-- != 0)
                {
                    if ((cells[j].Value & random.Int()) != 0)
                    {
                        OilPocketCells[i][j]       = cells[j];
                        OilPocketCells[i][j].Value = RottenMeatBlock.Index | 1 << 4 << 14;
                    }
                }
            }
        }