diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj index b3a31c6df..220638680 100644 --- a/Subsurface/Barotrauma.csproj +++ b/Subsurface/Barotrauma.csproj @@ -811,6 +811,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/Subsurface/Content/Map/RuinConfig.xml b/Subsurface/Content/Map/RuinConfig.xml index 1b97eb801..f843d1829 100644 --- a/Subsurface/Content/Map/RuinConfig.xml +++ b/Subsurface/Content/Map/RuinConfig.xml @@ -6,7 +6,12 @@ + + + + + @@ -15,7 +20,6 @@ - diff --git a/Subsurface/Content/Map/StructurePrefabs.xml b/Subsurface/Content/Map/StructurePrefabs.xml index bf1c8422e..92442cdf6 100644 --- a/Subsurface/Content/Map/StructurePrefabs.xml +++ b/Subsurface/Content/Map/StructurePrefabs.xml @@ -200,6 +200,18 @@ + + + + + + + + + + @@ -221,6 +233,11 @@ + + + + diff --git a/Subsurface/Content/Map/ruins3.png b/Subsurface/Content/Map/ruins3.png new file mode 100644 index 000000000..b19e91419 Binary files /dev/null and b/Subsurface/Content/Map/ruins3.png differ diff --git a/Subsurface/Source/Map/Levels/Ruins/RuinGenerator.cs b/Subsurface/Source/Map/Levels/Ruins/RuinGenerator.cs index 64b3e1823..b905d2e88 100644 --- a/Subsurface/Source/Map/Levels/Ruins/RuinGenerator.cs +++ b/Subsurface/Source/Map/Levels/Ruins/RuinGenerator.cs @@ -301,17 +301,30 @@ namespace Barotrauma.RuinGeneration { List shapes = new List(rooms); shapes.AddRange(corridors); - - //MapEntityPrefab hullPrefab = MapEntityPrefab.list.Find(m => m.Name == "Hull"); - + foreach (RuinShape leaf in shapes) { + RuinStructureType wallType = RuinStructureType.Wall; + + if (!(leaf is BTRoom)) + { + wallType = RuinStructureType.CorridorWall; + } + //rooms further from the entrance are more likely to have hard-to-break walls + else if (Rand.Range(0.0f, leaf.DistanceFromEntrance, false) > 1.5f) + { + wallType = RuinStructureType.HeavyWall; + } + + //generate walls -------------------------------------------------------------- foreach (Line wall in leaf.Walls) { - var structurePrefab = RuinStructure.GetRandom(leaf is BTRoom ? RuinStructureType.Wall : RuinStructureType.CorridorWall, leaf.GetLineAlignment(wall)); + var structurePrefab = RuinStructure.GetRandom(wallType, leaf.GetLineAlignment(wall)); if (structurePrefab == null) continue; - float radius = (wall.A.X == wall.B.X) ? (structurePrefab.Prefab as StructurePrefab).Size.X * 0.5f : (structurePrefab.Prefab as StructurePrefab).Size.Y * 0.5f; + float radius = (wall.A.X == wall.B.X) ? + (structurePrefab.Prefab as StructurePrefab).Size.X * 0.5f : + (structurePrefab.Prefab as StructurePrefab).Size.Y * 0.5f; Rectangle rect = new Rectangle( (int)(wall.A.X - radius), @@ -331,7 +344,7 @@ namespace Barotrauma.RuinGeneration structure.SetCollisionCategory(Physics.CollisionLevel); } - + //generate backgrounds -------------------------------------------------------------- var background = RuinStructure.GetRandom(RuinStructureType.Back, Alignment.Center); if (background == null) continue; @@ -341,6 +354,7 @@ namespace Barotrauma.RuinGeneration } + //generate props -------------------------------------------------------------- for (int i = 0; i < shapes.Count*2; i++ ) { Alignment[] alignments = new Alignment[] { Alignment.Top, Alignment.Bottom, Alignment.Right, Alignment.Left, Alignment.Center }; @@ -383,9 +397,11 @@ namespace Barotrauma.RuinGeneration } } + + //generate doors & sensors that close them ------------------------------------------------------------- + var sensorPrefab = ItemPrefab.list.Find(ip => ip.Name == "Alien Motion Sensor") as ItemPrefab; - var wirePrefab = ItemPrefab.list.Find(ip => ip.Name == "Wire") as ItemPrefab; - + var wirePrefab = ItemPrefab.list.Find(ip => ip.Name == "Wire") as ItemPrefab; foreach (Corridor corridor in corridors) { diff --git a/Subsurface/Source/Map/Levels/Ruins/RuinStructure.cs b/Subsurface/Source/Map/Levels/Ruins/RuinStructure.cs index 24fd71ea0..cf16af530 100644 --- a/Subsurface/Source/Map/Levels/Ruins/RuinStructure.cs +++ b/Subsurface/Source/Map/Levels/Ruins/RuinStructure.cs @@ -10,7 +10,7 @@ namespace Barotrauma.RuinGeneration [Flags] enum RuinStructureType { - Wall = 1, CorridorWall = 2, Prop = 4, Back = 8, Door=16, Hatch=32 + Wall = 1, CorridorWall = 2, Prop = 4, Back = 8, Door=16, Hatch=32, HeavyWall=64 } class RuinStructure @@ -88,7 +88,6 @@ namespace Barotrauma.RuinGeneration foreach (RuinStructure ruinStructure in matchingStructures) { - if (randomNumber <= ruinStructure.commonness) { return ruinStructure;