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
+3
View File
@@ -811,6 +811,9 @@
<Content Include="Content\Map\ruins2.png"> <Content Include="Content\Map\ruins2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\Map\ruins3.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Map\shaft.png"> <Content Include="Content\Map\shaft.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
+5 -1
View File
@@ -6,7 +6,12 @@
<structure prefab="RuinWallVertical" alignment="Left,Right" type="Wall"/> <structure prefab="RuinWallVertical" alignment="Left,Right" type="Wall"/>
<structure prefab="RuinWallVerticalSmall" alignment="Left,Right" type="CorridorWall"/> <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="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"/> <structure prefab="RuinBackCarvings" alignment="Center" type="Back" commonness="1"/>
<item prefab="RuinBlock" alignment="Right,Top,Bottom,Left" type="Prop" commonness="5"/> <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="RuinClaw" alignment="Bottom" type="Prop" commonness="5"/>
<item prefab="Oxygenite Shard" alignment="Center,Right,Top,Bottom,Left" 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"/> <item prefab="Sulphurite Shard" alignment="Center,Right,Top,Bottom,Left" type="Prop" commonness="5"/>
@@ -200,6 +200,18 @@
<sprite texture="Content/Map/ruins.png" sourcerect="896,192,128,832" depth ="0.061"/> <sprite texture="Content/Map/ruins.png" sourcerect="896,192,128,832" depth ="0.061"/>
</RuinWallVertical> </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" <RuinWallHorizontalSmall category="Alien" castshadow="true"
width="128" height="54" resizehorizontal="true" body="true" health="500"> width="128" height="54" resizehorizontal="true" body="true" health="500">
<sprite texture="Content/Map/ruins.png" sourcerect="0,842,832,54" depth ="0.062"/> <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" /> <sprite texture="Content/Map/ruins.png" sourcerect="512,0,233,512" depth ="0.981" />
</RuinBackCarvings> </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" <RuinBlock category="Alien"
width="514" height="296"> width="514" height="296">
<sprite texture="Content/Map/ruins.png" sourcerect="0,513,514,296" depth ="0.99" /> <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

@@ -302,16 +302,29 @@ namespace Barotrauma.RuinGeneration
List<RuinShape> shapes = new List<RuinShape>(rooms); List<RuinShape> shapes = new List<RuinShape>(rooms);
shapes.AddRange(corridors); shapes.AddRange(corridors);
//MapEntityPrefab hullPrefab = MapEntityPrefab.list.Find(m => m.Name == "Hull");
foreach (RuinShape leaf in shapes) 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) 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; 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( Rectangle rect = new Rectangle(
(int)(wall.A.X - radius), (int)(wall.A.X - radius),
@@ -331,7 +344,7 @@ namespace Barotrauma.RuinGeneration
structure.SetCollisionCategory(Physics.CollisionLevel); structure.SetCollisionCategory(Physics.CollisionLevel);
} }
//generate backgrounds --------------------------------------------------------------
var background = RuinStructure.GetRandom(RuinStructureType.Back, Alignment.Center); var background = RuinStructure.GetRandom(RuinStructureType.Back, Alignment.Center);
if (background == null) continue; if (background == null) continue;
@@ -341,6 +354,7 @@ namespace Barotrauma.RuinGeneration
} }
//generate props --------------------------------------------------------------
for (int i = 0; i < shapes.Count*2; i++ ) for (int i = 0; i < shapes.Count*2; i++ )
{ {
Alignment[] alignments = new Alignment[] { Alignment.Top, Alignment.Bottom, Alignment.Right, Alignment.Left, Alignment.Center }; Alignment[] alignments = new Alignment[] { Alignment.Top, Alignment.Bottom, Alignment.Right, Alignment.Left, Alignment.Center };
@@ -383,10 +397,12 @@ namespace Barotrauma.RuinGeneration
} }
} }
//generate doors & sensors that close them -------------------------------------------------------------
var sensorPrefab = ItemPrefab.list.Find(ip => ip.Name == "Alien Motion Sensor") as ItemPrefab; 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) foreach (Corridor corridor in corridors)
{ {
var doorPrefab = RuinStructure.GetRandom(corridor.IsHorizontal ? RuinStructureType.Door : RuinStructureType.Hatch, Alignment.Center); var doorPrefab = RuinStructure.GetRandom(corridor.IsHorizontal ? RuinStructureType.Door : RuinStructureType.Hatch, Alignment.Center);
@@ -10,7 +10,7 @@ namespace Barotrauma.RuinGeneration
[Flags] [Flags]
enum RuinStructureType 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 class RuinStructure
@@ -88,7 +88,6 @@ namespace Barotrauma.RuinGeneration
foreach (RuinStructure ruinStructure in matchingStructures) foreach (RuinStructure ruinStructure in matchingStructures)
{ {
if (randomNumber <= ruinStructure.commonness) if (randomNumber <= ruinStructure.commonness)
{ {
return ruinStructure; return ruinStructure;