예제 #1
0
        public static void AfterStaticGridSpawn(MyCubeGrid grid)
        {
            Debug.Assert(grid.IsStatic);

            MySlimBlock block = grid.GetCubeBlock(Vector3I.Zero);
            if (block != null)
            {
                MyCubeGrid mainGrid = grid.DetectMerge(block);
                if (mainGrid == null)
                    mainGrid = grid;
                mainGrid.AdditionalModelGenerators.ForEach(g => g.UpdateAfterGridSpawn(block));

                if (MyFakes.ENABLE_SMALL_BLOCK_TO_LARGE_STATIC_CONNECTIONS)
                {
                    MyCubeGridSmallToLargeConnection.Static.CheckBlockSmallToLargeConnect(block);
                }
            }
            else
                Debug.Fail("Block not created");
        }
예제 #2
0
        protected static void AfterGridBuild(MyEntity builder, MyCubeGrid grid, bool instantBuild)
        {
            if (grid != null)
            {
                MySlimBlock block = grid.GetCubeBlock(Vector3I.Zero);
                if (block != null)
                {
                    if (grid.IsStatic)
                    {
                        MyCompoundCubeBlock compoundBlock = block.FatBlock as MyCompoundCubeBlock;
                        MySlimBlock blockInCompound = compoundBlock != null && compoundBlock.GetBlocksCount() > 0 ? compoundBlock.GetBlocks()[0] : null;

                        MyCubeGrid mainGrid = grid.DetectMerge(block);
                        if (mainGrid == null)
                            mainGrid = grid;

                        MySlimBlock mainBlock = block;
                        if (blockInCompound != null)
                        {
                            Debug.Assert(blockInCompound.CubeGrid == mainGrid);
                            mainBlock = mainGrid.GetCubeBlock(blockInCompound.Position);
                        }

                        mainGrid.AdditionalModelGenerators.ForEach(g => g.UpdateAfterGridSpawn(mainBlock));

                        if (MyCubeGridSmallToLargeConnection.Static != null)
                        {
                            if (Sync.IsServer && !MyCubeGridSmallToLargeConnection.Static.AddBlockSmallToLargeConnection(block) && grid.GridSizeEnum == MyCubeSize.Small)
                                block.CubeGrid.TestDynamic = true;
                        }
                    }

                    if (Sync.IsServer)
                    {
                        MyCubeBuilder.BuildComponent.AfterSuccessfulBuild(builder, instantBuild);
                    }

                    if (block.FatBlock != null)
                        block.FatBlock.OnBuildSuccess(builder.EntityId);
                }
                else
                    Debug.Fail("Block not created");

                
            }
        }
예제 #3
0
        public static void AfterGridBuild(MyEntity builder, MyCubeGrid grid)
        {
            if (grid != null)
            {
                MySlimBlock block = grid.GetCubeBlock(Vector3I.Zero);
                if (block != null)
                {
                    if (grid.IsStatic)
                    {
                        MyCubeGrid mainGrid = grid.DetectMerge(block);
                        if (mainGrid == null)
                            mainGrid = grid;
                        mainGrid.AdditionalModelGenerators.ForEach(g => g.UpdateAfterGridSpawn(block));

                        if (MyFakes.ENABLE_SMALL_BLOCK_TO_LARGE_STATIC_CONNECTIONS)
                        {
                            MyCubeGridSmallToLargeConnection.Static.AddBlockSmallToLargeConnection(block);
                        }
                    }

                    if (Sync.IsServer)
                    {
                        MyCubeBuilder.BuildComponent.AfterGridCreated(grid, builder);
                    }
                }
                else
                    Debug.Fail("Block not created");
            }
        }
예제 #4
0
        public static void AfterGridBuild(MyEntity builder, MyCubeGrid grid)
        {
            if (grid != null)
            {
                MySlimBlock block = grid.GetCubeBlock(Vector3I.Zero);
                if (block != null)
                {
                    if (grid.IsStatic)
                    {
                        MyCompoundCubeBlock compoundBlock = block.FatBlock as MyCompoundCubeBlock;
                        MySlimBlock blockInCompound = compoundBlock != null && compoundBlock.GetBlocksCount() > 0 ? compoundBlock.GetBlocks()[0] : null;

                        MyCubeGrid mainGrid = grid.DetectMerge(block);
                        if (mainGrid == null)
                            mainGrid = grid;

                        MySlimBlock mainBlock = block;
                        if (blockInCompound != null)
                        {
                            Debug.Assert(blockInCompound.CubeGrid == mainGrid);
                            mainBlock = mainGrid.GetCubeBlock(blockInCompound.Position);
                        }

                        mainGrid.AdditionalModelGenerators.ForEach(g => g.UpdateAfterGridSpawn(mainBlock));

                        if (MyFakes.ENABLE_SMALL_BLOCK_TO_LARGE_STATIC_CONNECTIONS)
                        {
                            if (!MyCubeGridSmallToLargeConnection.Static.AddBlockSmallToLargeConnection(block) && grid.GridSizeEnum == MyCubeSize.Small)
                                block.CubeGrid.TestDynamic = true;
                        }
                    }

                    if (Sync.IsServer)
                    {
                        MyCubeBuilder.BuildComponent.AfterGridCreated(grid, builder);
                    }
                }
                else
                    Debug.Fail("Block not created");
            }
        }