v0.11.0.9

This commit is contained in:
Joonas Rikkonen
2020-12-09 16:34:16 +02:00
parent bbf06f0984
commit f433a7ba10
325 changed files with 13947 additions and 3652 deletions
@@ -11,6 +11,7 @@ using System.Globalization;
using Barotrauma.IO;
using System.Linq;
using System.Text;
using Barotrauma.MapCreatures.Behavior;
namespace Barotrauma
{
@@ -732,6 +733,11 @@ namespace Barotrauma
if (newEvent != null)
{
var @event = newEvent.CreateInstance();
if (newEvent == null)
{
NewMessage($"Could not initialize event {args[0]} because level did not meet requirements");
return;
}
GameMain.GameSession.EventManager.ActiveEvents.Add(@event);
@event.Init(true);
NewMessage($"Initialized event {newEvent.Identifier}", Color.Aqua);
@@ -815,7 +821,7 @@ namespace Barotrauma
NewMessage(Hull.EditFire ? "Fire spawning on" : "Fire spawning off", Color.White);
}, isCheat: true));
commands.Add(new Command("explosion", "explosion [range] [force] [damage] [structuredamage] [item damage] [emp strength]: Creates an explosion at the position of the cursor.", null, isCheat: true));
commands.Add(new Command("explosion", "explosion [range] [force] [damage] [structuredamage] [item damage] [emp strength] [ballast flora strength]: Creates an explosion at the position of the cursor.", null, isCheat: true));
commands.Add(new Command("showseed|showlevelseed", "showseed: Show the seed of the current level.", (string[] args) =>
{
@@ -1160,8 +1166,15 @@ namespace Barotrauma
{
foreach (Character c in Character.CharacterList)
{
if (!(c.AIController is EnemyAIController)) continue;
c.SetAllDamage(200.0f, 0.0f, 0.0f);
if (c.AIController is EnemyAIController enemyAI && enemyAI.PetBehavior == null)
{
c.SetAllDamage(200.0f, 0.0f, 0.0f);
}
}
foreach (Hull hull in Hull.hullList)
{
hull.BallastFlora?.Kill();
}
}, null, isCheat: true));
@@ -1259,6 +1272,75 @@ namespace Barotrauma
}
}
}, isCheat: true));
commands.Add(new Command("ballastflora", "infectballast [options]: Infect ballasts and control its growth.", args =>
{
if (args.Length == 0)
{
ThrowError("No action specified.");
return;
}
string primaryAction = args.Length > 0 ? args[0] : "";
string secondaryArgument = args.Length > 1 ? args[1] : "";
if (Submarine.MainSub == null)
{
ThrowError("No submarine loaded.");
return;
}
if (primaryAction.Equals("infect", StringComparison.OrdinalIgnoreCase))
{
List<Pump> pumps = new List<Pump>();
foreach (Item item in Submarine.MainSub.GetItems(true))
{
if (item.CurrentHull != null && item.HasTag("ballast") && item.GetComponent<Pump>() is { } pump)
{
pumps.Add(pump);
}
}
if (pumps.Any())
{
BallastFloraPrefab prefab = string.IsNullOrWhiteSpace(secondaryArgument) ? BallastFloraPrefab.Prefabs.First() : BallastFloraPrefab.Find(secondaryArgument);
if (prefab == null)
{
ThrowError($"No such behavior: {secondaryArgument}");
return;
}
Pump random = pumps.GetRandom();
random.InfectBallast(prefab.Identifier);
NewMessage($"Infected {random.Name} with {prefab.Identifier}.", Color.Green);
return;
}
ThrowError("No available pumps to infect on this submarine.");
}
if (primaryAction.Equals("growthwarp", StringComparison.OrdinalIgnoreCase))
{
if (int.TryParse(secondaryArgument, out int value))
{
foreach (Hull hull in Hull.hullList.Where(h => h.BallastFlora != null))
{
BallastFloraBehavior bs = hull.BallastFlora;
bs.GrowthWarps = value;
}
NewMessage("Accelerating growth...", Color.Green);
return;
}
ThrowError($"Invalid integer \"{secondaryArgument}\".");
}
}, isCheat: true, getValidArgs: () =>
{
string[] primaries = { "infect", "growthwarp" };
string[] identifiers = BallastFloraPrefab.Prefabs.Select(bfp => bfp.Identifier).Distinct().ToArray();
return new[] { primaries, identifiers };
}));
commands.Add(new Command("difficulty|leveldifficulty", "difficulty [0-100]: Change the level difficulty setting in the server lobby.", null));
@@ -1899,13 +1981,21 @@ namespace Barotrauma
{
if (e != null)
{
error += " {" + e.Message + "}\n" + e.StackTrace.CleanupStackTrace();
error += " {" + e.Message + "}\n";
if (e.StackTrace != null)
{
error += e.StackTrace.CleanupStackTrace();
}
if (e.InnerException != null)
{
error += "\n\nInner exception: " + e.InnerException.Message + "\n" + e.InnerException.StackTrace.CleanupStackTrace();
error += "\n\nInner exception: " + e.InnerException.Message + "\n";
if (e.InnerException.StackTrace != null)
{
error += e.InnerException.StackTrace.CleanupStackTrace(); ;
}
}
}
else if (appendStackTrace)
else if (appendStackTrace && Environment.StackTrace != null)
{
error += "\n" + Environment.StackTrace.CleanupStackTrace();
}