Added a near-indestructible ruin wall variant that has a higher chance of being used in rooms further away from the ruin entrance

This commit is contained in:
Regalis
2016-10-11 22:46:24 +03:00
parent f9017d3cf9
commit 9540972db4
6 changed files with 50 additions and 11 deletions

View File

@@ -811,6 +811,9 @@
<Content Include="Content\Map\ruins2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Map\ruins3.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Map\shaft.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

View File

@@ -6,7 +6,12 @@
<structure prefab="RuinWallVertical" alignment="Left,Right" type="Wall"/>
<structure prefab="RuinWallVerticalSmall" alignment="Left,Right" type="CorridorWall"/>
<structure prefab="RuinWallHeavyHorizontal" alignment="Top, Bottom" type="HeavyWall"/>
<structure prefab="RuinWallHeavyVertical" alignment="Left,Right" type="HeavyWall"/>
<structure prefab="RuinBack" alignment="Center" type="Back" commonness="3"/>
<structure prefab="RuinBackFractal" alignment="Center" type="Back" commonness="2"/>
<structure prefab="RuinBackCarvings" alignment="Center" type="Back" commonness="1"/>
<item prefab="RuinBlock" alignment="Right,Top,Bottom,Left" type="Prop" commonness="5"/>
@@ -15,7 +20,6 @@
<item prefab="RuinClaw" alignment="Bottom" type="Prop" commonness="5"/>
<item prefab="Oxygenite Shard" alignment="Center,Right,Top,Bottom,Left" type="Prop" commonness="5"/>
<item prefab="Sulphurite Shard" alignment="Center,Right,Top,Bottom,Left" type="Prop" commonness="5"/>

View File

@@ -200,6 +200,18 @@
<sprite texture="Content/Map/ruins.png" sourcerect="896,192,128,832" depth ="0.061"/>
</RuinWallVertical>
<RuinWallHeavyHorizontal category="Alien" castshadow="true"
width="128" height="128" resizehorizontal="true" body="true" health="100000">
<sprite texture="Content/Map/ruins3.png" sourcerect="352,896,672,128" depth ="0.06"/>
</RuinWallHeavyHorizontal>
<RuinWallHeavyVertical category="Alien" castshadow="true"
width="128" height="128" resizevertical="true" body="true" health="100000">
<sprite texture="Content/Map/ruins3.png" sourcerect="896,0,128,672" depth ="0.061"/>
</RuinWallHeavyVertical>
<RuinWallHorizontalSmall category="Alien" castshadow="true"
width="128" height="54" resizehorizontal="true" body="true" health="500">
<sprite texture="Content/Map/ruins.png" sourcerect="0,842,832,54" depth ="0.062"/>
@@ -221,6 +233,11 @@
<sprite texture="Content/Map/ruins.png" sourcerect="512,0,233,512" depth ="0.981" />
</RuinBackCarvings>
<RuinBackFractal category="Alien"
width="64" height="64" resizehorizontal="true" resizevertical="true">
<sprite texture="Content/Map/ruins3.png" sourcerect="0,0,640,896" depth ="0.98"/>
</RuinBackFractal>
<RuinBlock category="Alien"
width="514" height="296">
<sprite texture="Content/Map/ruins.png" sourcerect="0,513,514,296" depth ="0.99" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@@ -301,17 +301,30 @@ namespace Barotrauma.RuinGeneration
{
List<RuinShape> shapes = new List<RuinShape>(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)
{

View File

@@ -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;