Beispiel #1
0
        public void FindSpaceTiles()
        {
            // find borders to space and make negative pressure nodes there
            myGasManager.RemoveAllVoids();

            // a border to space is when a tile is touching a non-tile and doesn't have a wall on it
            for(int x = 0; x < 256; x++)
            {
                for(int y = 0; y < 256; y++)
                {
                    // not a floor
                    if(!IsFloorAt(x, y))
                    {
                        continue;
                    }

                    // check neighbours
                    if(y - 1 < 0 || x - 1 < 0 || x + 1 > 255 || y + 1 > 255)
                    {
                        continue;
                    }

                    if(IsWallAt(x, y))
                    {
                        continue;
                    }

                    // north
                    if(!IsFloorAt(x, y - 1) && !IsWallAt(x, y - 1))
                    {
                        Systems.Atmospherics.GasMixture newGas = new Systems.Atmospherics.GasMixture();
                        newGas.Void = true;
                        newGas.AddGasChange("Oxygen", -1);
                        myGasManager.SetGasMixture(x, y - 1, newGas);
                        myGasManager.NeedToRecalculateNeighbours = true;
                    }
                    //south
                    if (!IsFloorAt(x, y + 1) && !IsWallAt(x, y + 1))
                    {
                        Systems.Atmospherics.GasMixture newGas = new Systems.Atmospherics.GasMixture();
                        newGas.Void = true;
                        newGas.AddGasChange("Oxygen", -1);
                        myGasManager.SetGasMixture(x, y + 1, newGas);
                        myGasManager.NeedToRecalculateNeighbours = true;
                    }
                    //west
                    if (!IsFloorAt(x - 1, y) && !IsWallAt(x - 1, y))
                    {
                        Systems.Atmospherics.GasMixture newGas = new Systems.Atmospherics.GasMixture();
                        newGas.Void = true;
                        newGas.AddGasChange("Oxygen", -1);
                        myGasManager.SetGasMixture(x - 1, y, newGas);
                        myGasManager.NeedToRecalculateNeighbours = true;
                    }
                    //east
                    if (!IsFloorAt(x + 1, y) && !IsWallAt(x + 1, y))
                    {
                        Systems.Atmospherics.GasMixture newGas = new Systems.Atmospherics.GasMixture();
                        newGas.Void = true;
                        newGas.AddGasChange("Oxygen", -1);
                        myGasManager.SetGasMixture(x + 1, y, newGas);
                        myGasManager.NeedToRecalculateNeighbours = true;
                    }
                }
            }

            NeedUpdateSpace = false;
        }
Beispiel #2
0
        public void FloorFillTile(int x, int y, int tileID, bool air = false, bool zapwalls = false)
        {
            floorMap.SetTile(x, y, tileID);
            floorCol.SetTile(x, y, true);
            if(air)
            {
                Systems.Atmospherics.GasMixture gm = new Systems.Atmospherics.GasMixture();
                gm.AddGasChange("Oxygen", 0.2095f);
                gm.AddGasChange("Nitrogen", 0.7808f);
                gm.AddGasChange("CO2", 0.0040f);

                myGasManager.SetGasMixture(x, y, gm);
            }
            else
            {
                myGasManager.SetGasMixture(x, y, new Systems.Atmospherics.GasMixture());
            }

            if(zapwalls)
            {
                WallClearTile(x, y);
            }
        }