Alien ruins, some new alien items and a new monster

This commit is contained in:
Regalis
2016-05-01 18:46:17 +03:00
parent d3ab7946a8
commit 3114006d86
33 changed files with 1395 additions and 124 deletions
+2 -2
View File
@@ -28,10 +28,10 @@ namespace Barotrauma
DebugConsole.ThrowError("Error in SalvageMission: couldn't find an item prefab with the name "+itemName);
}
}
protected override void Start()
{
Vector2 position = Level.Loaded.GetRandomItemPos(30.0f);
Vector2 position = Level.Loaded.GetRandomItemPos(Level.PositionType.Cave, 30.0f);
item = new Item(itemPrefab, position, null);
item.MoveWithLevel = true;
@@ -27,7 +27,7 @@ namespace Barotrauma
public override void Start(Level level)
{
Vector2 position = level.GetRandomInterestingPosition(true, true);
Vector2 position = level.GetRandomInterestingPosition(true, Level.PositionType.MainPath);
monster = Character.Create(monsterFile, position, null, GameMain.Client != null);
monster.Enabled = false;
@@ -14,6 +14,8 @@ namespace Barotrauma
private Item item;
private Level.PositionType spawnPositionType;
private int state;
public override Vector2 RadarPosition
@@ -30,6 +32,14 @@ namespace Barotrauma
string itemName = ToolBox.GetAttributeString(element, "itemname", "");
itemPrefab = ItemPrefab.list.Find(ip => ip.Name == itemName) as ItemPrefab;
string spawnPositionTypeStr = ToolBox.GetAttributeString(element, "spawntype", "");
if (string.IsNullOrWhiteSpace(spawnPositionTypeStr) ||
!Enum.TryParse<Level.PositionType>(spawnPositionTypeStr, true, out spawnPositionType))
{
spawnPositionType = Level.PositionType.Cave | Level.PositionType.Ruin;
}
if (itemPrefab == null)
{
@@ -39,7 +49,7 @@ namespace Barotrauma
public override void Start(Level level)
{
Vector2 position = Level.Loaded.GetRandomItemPos(30.0f);
Vector2 position = Level.Loaded.GetRandomItemPos(spawnPositionType, 30.0f);
item = new Item(itemPrefab, position, null);
item.MoveWithLevel = true;
+17 -7
View File
@@ -14,6 +14,8 @@ namespace Barotrauma
private bool spawnDeep;
private Level.PositionType spawnPosType;
public override string ToString()
{
return "ScriptedEvent (" + characterFile + ")";
@@ -27,6 +29,14 @@ namespace Barotrauma
minAmount = ToolBox.GetAttributeInt(element, "minamount", 1);
maxAmount = Math.Max(ToolBox.GetAttributeInt(element, "maxamount", 1), minAmount);
var spawnPosTypeStr = ToolBox.GetAttributeString(element, "spawntype", "");
if (string.IsNullOrWhiteSpace(spawnPosTypeStr) ||
!Enum.TryParse<Level.PositionType>(spawnPosTypeStr, true, out spawnPosType))
{
spawnPosType = Level.PositionType.MainPath;
}
spawnDeep = ToolBox.GetAttributeBool(element, "spawndeep", false);
}
@@ -37,7 +47,9 @@ namespace Barotrauma
private void SpawnMonsters()
{
WayPoint randomWayPoint = WayPoint.GetRandom(SpawnType.Enemy);
//WayPoint randomWayPoint = WayPoint.GetRandom(SpawnType.Enemy);
Vector2 spawnPos = Level.Loaded.GetRandomInterestingPosition(true, spawnPosType);
int amount = Rand.Range(minAmount, maxAmount, false);
@@ -45,16 +57,14 @@ namespace Barotrauma
for (int i = 0; i < amount; i++)
{
Vector2 position = (randomWayPoint == null) ? Vector2.Zero : randomWayPoint.Position;
if (spawnDeep)
{
position.Y -= Level.Loaded.Size.Y;
spawnPos.Y -= Level.Loaded.Size.Y;
}
position.X += Rand.Range(-0.5f, 0.5f, false);
position.Y += Rand.Range(-0.5f, 0.5f, false);
monsters[i] = Character.Create(characterFile, position, null, GameMain.Client != null);
spawnPos.X += Rand.Range(-0.5f, 0.5f, false);
spawnPos.Y += Rand.Range(-0.5f, 0.5f, false);
monsters[i] = Character.Create(characterFile, spawnPos, null, GameMain.Client != null);
}
}