Unstable 0.17.0.0
This commit is contained in:
@@ -159,7 +159,7 @@ namespace Barotrauma
|
||||
return new string[][]
|
||||
{
|
||||
commands.SelectMany(c => c.names).ToArray(),
|
||||
new string[0]
|
||||
Array.Empty<string>()
|
||||
};
|
||||
}));
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace Barotrauma
|
||||
NewMessage("***************", Color.Cyan);
|
||||
foreach (ItemPrefab itemPrefab in ItemPrefab.Prefabs)
|
||||
{
|
||||
if (string.IsNullOrEmpty(itemPrefab.Name)) continue;
|
||||
if (itemPrefab.Name.IsNullOrEmpty()) { continue; }
|
||||
string text = $"- {itemPrefab.Name}";
|
||||
if (itemPrefab.Tags.Any())
|
||||
{
|
||||
@@ -194,20 +194,14 @@ namespace Barotrauma
|
||||
commands.Add(new Command("spawn|spawncharacter", "spawn [creaturename/jobname] [near/inside/outside/cursor] [team (0-3)]: Spawn a creature at a random spawnpoint (use the second parameter to only select spawnpoints near/inside/outside the submarine). You can also enter the name of a job (e.g. \"Mechanic\") to spawn a character with a specific job and the appropriate equipment.", null,
|
||||
() =>
|
||||
{
|
||||
List<string> characterFiles = GameMain.Instance.GetFilesOfType(ContentType.Character).Select(f => f.Path).ToList();
|
||||
for (int i = 0; i < characterFiles.Count; i++)
|
||||
{
|
||||
characterFiles[i] = Path.GetFileNameWithoutExtension(characterFiles[i]).ToLowerInvariant();
|
||||
}
|
||||
|
||||
foreach (JobPrefab jobPrefab in JobPrefab.Prefabs)
|
||||
{
|
||||
characterFiles.Add(jobPrefab.Name);
|
||||
}
|
||||
string[] creatureAndJobNames =
|
||||
CharacterPrefab.Prefabs.Select(p => p.Identifier.Value)
|
||||
.Concat(JobPrefab.Prefabs.Select(p => p.Identifier.Value))
|
||||
.ToArray();
|
||||
|
||||
return new string[][]
|
||||
{
|
||||
characterFiles.ToArray(),
|
||||
creatureAndJobNames.ToArray(),
|
||||
new string[] { "near", "inside", "outside", "cursor" }
|
||||
};
|
||||
}, isCheat: true));
|
||||
@@ -239,9 +233,9 @@ namespace Barotrauma
|
||||
List<string> itemNames = new List<string>();
|
||||
foreach (ItemPrefab itemPrefab in ItemPrefab.Prefabs)
|
||||
{
|
||||
if (!itemNames.Contains(itemPrefab.Name))
|
||||
if (!itemNames.Contains(itemPrefab.Name.Value))
|
||||
{
|
||||
itemNames.Add(itemPrefab.Name);
|
||||
itemNames.Add(itemPrefab.Name.Value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +324,7 @@ namespace Barotrauma
|
||||
return new string[][]
|
||||
{
|
||||
GameMain.NetworkMember.ConnectedClients.Select(c => c.Name).ToArray(),
|
||||
PermissionPreset.List.Select(pp => pp.Name).ToArray()
|
||||
PermissionPreset.List.Select(pp => pp.Name.Value).ToArray()
|
||||
};
|
||||
}));
|
||||
|
||||
@@ -521,7 +515,7 @@ namespace Barotrauma
|
||||
if (targetCharacter == null) { return; }
|
||||
|
||||
targetCharacter.GodMode = !targetCharacter.GodMode;
|
||||
NewMessage((targetCharacter.GodMode ? "Enabled godmode on " : "Disabled godmode on " + targetCharacter.Name), Color.White);
|
||||
NewMessage((targetCharacter.GodMode ? "Enabled godmode on " : "Disabled godmode on ") + targetCharacter.Name, Color.White);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
@@ -599,7 +593,7 @@ namespace Barotrauma
|
||||
}
|
||||
foreach (Character character in Character.CharacterList)
|
||||
{
|
||||
if (character.Name.Equals(args[0], StringComparison.OrdinalIgnoreCase) || character.SpeciesName.Equals(args[0], StringComparison.OrdinalIgnoreCase))
|
||||
if (character.Name.Equals(args[0], StringComparison.OrdinalIgnoreCase) || character.SpeciesName == args[0])
|
||||
{
|
||||
ThrowError(character.ID + ": " + character.Name.ToString());
|
||||
}
|
||||
@@ -612,7 +606,7 @@ namespace Barotrauma
|
||||
|
||||
AfflictionPrefab afflictionPrefab = AfflictionPrefab.List.FirstOrDefault(a =>
|
||||
a.Name.Equals(args[0], StringComparison.OrdinalIgnoreCase) ||
|
||||
a.Identifier.Equals(args[0], StringComparison.OrdinalIgnoreCase));
|
||||
a.Identifier == args[0]);
|
||||
if (afflictionPrefab == null)
|
||||
{
|
||||
ThrowError("Affliction \"" + args[0] + "\" not found.");
|
||||
@@ -650,7 +644,7 @@ namespace Barotrauma
|
||||
{
|
||||
return new string[][]
|
||||
{
|
||||
AfflictionPrefab.List.Select(a => a.Name).ToArray(),
|
||||
AfflictionPrefab.Prefabs.Select(a => a.Name.Value).ToArray(),
|
||||
new string[] { "1" },
|
||||
Character.CharacterList.Select(c => c.Name).ToArray(),
|
||||
Enum.GetNames(typeof(LimbType)).ToArray()
|
||||
@@ -751,10 +745,10 @@ namespace Barotrauma
|
||||
|
||||
commands.Add(new Command("triggerevent", "triggerevent [identifier]: Created a new event.", (string[] args) =>
|
||||
{
|
||||
List<EventPrefab> eventPrefabs = EventSet.GetAllEventPrefabs().Where(prefab => !string.IsNullOrWhiteSpace(prefab.Identifier)).ToList();
|
||||
List<EventPrefab> eventPrefabs = EventSet.GetAllEventPrefabs().Where(prefab => prefab.Identifier != Identifier.Empty).ToList();
|
||||
if (GameMain.GameSession?.EventManager != null && args.Length > 0)
|
||||
{
|
||||
EventPrefab eventPrefab = eventPrefabs.Find(prefab => string.Equals(prefab.Identifier, args[0], StringComparison.InvariantCultureIgnoreCase));
|
||||
EventPrefab eventPrefab = eventPrefabs.Find(prefab => prefab.Identifier == args[0]);
|
||||
|
||||
if (eventPrefab != null)
|
||||
{
|
||||
@@ -776,11 +770,11 @@ namespace Barotrauma
|
||||
NewMessage("Failed to trigger event", Color.Red);
|
||||
}, isCheat: true, getValidArgs: () =>
|
||||
{
|
||||
List<EventPrefab> eventPrefabs = EventSet.GetAllEventPrefabs().Where(prefab => !string.IsNullOrWhiteSpace(prefab.Identifier)).ToList();
|
||||
List<EventPrefab> eventPrefabs = EventSet.GetAllEventPrefabs().Where(prefab => prefab.Identifier != Identifier.Empty).ToList();
|
||||
|
||||
return new[]
|
||||
{
|
||||
eventPrefabs.Select(prefab => prefab.Identifier).Distinct().ToArray()
|
||||
eventPrefabs.Select(prefab => prefab.Identifier).Distinct().Select(id => id.Value).ToArray()
|
||||
};
|
||||
}));
|
||||
|
||||
@@ -792,7 +786,7 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
string skillIdentifier = args[0];
|
||||
Identifier skillIdentifier = args[0].ToIdentifier();
|
||||
string levelString = args[1];
|
||||
Character character = args.Length >= 3 ? FindMatchingCharacter(args.Skip(2).ToArray(), false) : Character.Controlled;
|
||||
|
||||
@@ -807,7 +801,7 @@ namespace Barotrauma
|
||||
if (float.TryParse(levelString, NumberStyles.Number, CultureInfo.InvariantCulture, out float level) || isMax)
|
||||
{
|
||||
if (isMax) { level = 100; }
|
||||
if (skillIdentifier.Equals("all", StringComparison.OrdinalIgnoreCase))
|
||||
if (skillIdentifier == "all")
|
||||
{
|
||||
foreach (Skill skill in character.Info.Job.Skills)
|
||||
{
|
||||
@@ -829,7 +823,7 @@ namespace Barotrauma
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
Character.Controlled?.Info?.Job?.Skills?.Select(skill => skill.Identifier).ToArray() ?? new string[0],
|
||||
Character.Controlled?.Info?.Job?.Skills?.Select(skill => skill.Identifier.Value).ToArray() ?? Array.Empty<string>(),
|
||||
new[]{ "max" },
|
||||
Character.CharacterList.Select(c => c.Name).Distinct().ToArray(),
|
||||
};
|
||||
@@ -848,7 +842,7 @@ namespace Barotrauma
|
||||
if (character != null)
|
||||
{
|
||||
TalentPrefab talentPrefab = TalentPrefab.TalentPrefabs.Find(c =>
|
||||
c.Identifier.Equals(args[0], StringComparison.OrdinalIgnoreCase) ||
|
||||
c.Identifier == args[0] ||
|
||||
c.DisplayName.Equals(args[0], StringComparison.OrdinalIgnoreCase));
|
||||
if (talentPrefab == null)
|
||||
{
|
||||
@@ -864,12 +858,12 @@ namespace Barotrauma
|
||||
List<string> talentNames = new List<string>();
|
||||
foreach (TalentPrefab talent in TalentPrefab.TalentPrefabs)
|
||||
{
|
||||
talentNames.Add(talent.DisplayName);
|
||||
talentNames.Add(talent.DisplayName.Value);
|
||||
}
|
||||
|
||||
return new string[][]
|
||||
{
|
||||
talentNames.ToArray(),
|
||||
talentNames.Select(id => id).ToArray(),
|
||||
Character.CharacterList.Select(c => c.Name).Distinct().ToArray()
|
||||
};
|
||||
}, isCheat: true));
|
||||
@@ -892,7 +886,7 @@ namespace Barotrauma
|
||||
ThrowError($"Failed to find the job \"{args[0]}\".");
|
||||
return;
|
||||
}
|
||||
if (!TalentTree.JobTalentTrees.TryGetValue(job.Identifier, out TalentTree talentTree))
|
||||
if (!TalentTree.JobTalentTrees.TryGet(job.Identifier, out TalentTree talentTree))
|
||||
{
|
||||
ThrowError($"No talents configured for the job \"{args[0]}\".");
|
||||
return;
|
||||
@@ -918,7 +912,7 @@ namespace Barotrauma
|
||||
() =>
|
||||
{
|
||||
List<string> availableArgs = new List<string>() { "All" };
|
||||
availableArgs.AddRange(JobPrefab.Prefabs.Select(j => j.Name));
|
||||
availableArgs.AddRange(JobPrefab.Prefabs.Select(j => j.Name.Value));
|
||||
return new string[][]
|
||||
{
|
||||
availableArgs.ToArray(),
|
||||
@@ -979,7 +973,7 @@ namespace Barotrauma
|
||||
{
|
||||
NewMessage("Level seed: " + Level.Loaded.Seed);
|
||||
NewMessage("Level generation params: " + Level.Loaded.GenerationParams.Identifier);
|
||||
NewMessage("Adjacent locations: " + (Level.Loaded.StartLocation?.Type.Identifier ?? "none") + ", " + (Level.Loaded.StartLocation?.Type.Identifier ?? "none"));
|
||||
NewMessage("Adjacent locations: " + (Level.Loaded.StartLocation?.Type.Identifier ?? "none".ToIdentifier()) + ", " + (Level.Loaded.StartLocation?.Type.Identifier ?? "none".ToIdentifier()));
|
||||
NewMessage("Mirrored: " + Level.Loaded.Mirrored);
|
||||
NewMessage("Level size: " + Level.Loaded.Size.X + "x" + Level.Loaded.Size.Y);
|
||||
NewMessage("Minimum main path width: " + (Level.Loaded.LevelData?.MinMainPathWidth?.ToString() ?? "unknown"));
|
||||
@@ -1066,7 +1060,7 @@ namespace Barotrauma
|
||||
Character character = FindMatchingCharacter(args, false);
|
||||
if (character == null) { return; }
|
||||
|
||||
Entity.Spawner?.AddToRemoveQueue(character);
|
||||
Entity.Spawner?.AddEntityToRemoveQueue(character);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
@@ -1096,17 +1090,17 @@ namespace Barotrauma
|
||||
IEnumerable<CoroutineStatus> TestLevels()
|
||||
{
|
||||
SubmarineInfo selectedSub = null;
|
||||
string subName = GameMain.Config.QuickStartSubmarineName;
|
||||
if (!string.IsNullOrEmpty(subName))
|
||||
Identifier subName = GameSettings.CurrentConfig.QuickStartSub;
|
||||
if (subName != Identifier.Empty)
|
||||
{
|
||||
selectedSub = SubmarineInfo.SavedSubmarines.FirstOrDefault(s => s.Name.Equals(subName, StringComparison.OrdinalIgnoreCase));
|
||||
selectedSub = SubmarineInfo.SavedSubmarines.FirstOrDefault(s => s.Name == subName);
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
while (true)
|
||||
{
|
||||
var gamesession = new GameSession(
|
||||
SubmarineInfo.SavedSubmarines.GetRandom(s => s.Type == SubmarineType.Player && !s.HasTag(SubmarineTag.HideInMenus)),
|
||||
SubmarineInfo.SavedSubmarines.GetRandomUnsynced(s => s.Type == SubmarineType.Player && !s.HasTag(SubmarineTag.HideInMenus)),
|
||||
GameModePreset.DevSandbox);
|
||||
string seed = ToolBox.RandomSeed(16);
|
||||
gamesession.StartRound(seed);
|
||||
@@ -1188,7 +1182,7 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.GameSession?.GameMode is CampaignMode campaign)
|
||||
{
|
||||
if (campaign.Factions.FirstOrDefault(f => f.Prefab.Identifier.Equals(args[0], StringComparison.OrdinalIgnoreCase)) is { } faction)
|
||||
if (campaign.Factions.FirstOrDefault(f => f.Prefab.Identifier == args[0]) is { } faction)
|
||||
{
|
||||
if (float.TryParse(args[1], NumberStyles.Any, CultureInfo.InvariantCulture, out float reputation))
|
||||
{
|
||||
@@ -1210,7 +1204,7 @@ namespace Barotrauma
|
||||
}
|
||||
}, () =>
|
||||
{
|
||||
return new[] { FactionPrefab.Prefabs.Select(f => f.Identifier).ToArray() };
|
||||
return new[] { FactionPrefab.Prefabs.Select(f => f.Identifier.Value).ToArray() };
|
||||
}, true));
|
||||
|
||||
commands.Add(new Command("fixitems", "fixitems: Repairs all items and restores them to full condition.", (string[] args) =>
|
||||
@@ -1266,7 +1260,7 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
var upgradePrefab = UpgradePrefab.Find(args[0]);
|
||||
var upgradePrefab = UpgradePrefab.Find(args[0].ToIdentifier());
|
||||
|
||||
if (upgradePrefab == null)
|
||||
{
|
||||
@@ -1301,7 +1295,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (MapEntity targetItem in targetItems)
|
||||
{
|
||||
Upgrade existingUpgrade = targetItem.GetUpgrade(args[0]);
|
||||
Upgrade existingUpgrade = targetItem.GetUpgrade(args[0].ToIdentifier());
|
||||
|
||||
if (!(targetItem is ISerializableEntity sEntity)) { continue; }
|
||||
|
||||
@@ -1333,7 +1327,7 @@ namespace Barotrauma
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
UpgradePrefab.Prefabs.Select(c => c.Identifier).Distinct().ToArray()
|
||||
UpgradePrefab.Prefabs.Select(c => c.Identifier).Distinct().Select(i => i.Value).ToArray()
|
||||
};
|
||||
}, true));
|
||||
|
||||
@@ -1362,11 +1356,11 @@ namespace Barotrauma
|
||||
|
||||
foreach (UpgradeCategory category in UpgradeCategory.Categories)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(categoryIdentifier) && !category.Identifier.Equals(categoryIdentifier, StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (!string.IsNullOrWhiteSpace(categoryIdentifier) && category.Identifier != categoryIdentifier) { continue; }
|
||||
foreach (UpgradePrefab prefab in UpgradePrefab.Prefabs)
|
||||
{
|
||||
if (!prefab.UpgradeCategories.Contains(category)) { continue; }
|
||||
if (!string.IsNullOrWhiteSpace(prefabIdentifier) && !prefab.Identifier.Equals(prefabIdentifier, StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (!string.IsNullOrWhiteSpace(prefabIdentifier) && prefab.Identifier != prefabIdentifier) { continue; }
|
||||
|
||||
int targetLevel = prefab.MaxLevel - upgradeManager.GetRealUpgradeLevel(prefab, category);
|
||||
for (int i = 0; i < targetLevel; i++)
|
||||
@@ -1382,8 +1376,8 @@ namespace Barotrauma
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
UpgradeCategory.Categories.Select(c => c.Identifier).Distinct().ToArray(),
|
||||
UpgradePrefab.Prefabs.Select(c => c.Identifier).Distinct().ToArray()
|
||||
UpgradeCategory.Categories.Select(c => c.Identifier).Distinct().Select(i => i.Value).ToArray(),
|
||||
UpgradePrefab.Prefabs.Select(c => c.Identifier).Distinct().Select(i => i.Value).ToArray()
|
||||
};
|
||||
}, true));
|
||||
|
||||
@@ -1404,7 +1398,7 @@ namespace Barotrauma
|
||||
|
||||
commands.Add(new Command("oxygen|air", "oxygen/air: Replenishes the oxygen levels in every room to 100%.", (string[] args) =>
|
||||
{
|
||||
foreach (Hull hull in Hull.hullList)
|
||||
foreach (Hull hull in Hull.HullList)
|
||||
{
|
||||
hull.OxygenPercentage = 100.0f;
|
||||
}
|
||||
@@ -1432,7 +1426,7 @@ namespace Barotrauma
|
||||
c.SetAllDamage(200.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
foreach (Hull hull in Hull.hullList)
|
||||
foreach (Hull hull in Hull.HullList)
|
||||
{
|
||||
hull.BallastFlora?.Kill();
|
||||
}
|
||||
@@ -1597,14 +1591,14 @@ namespace Barotrauma
|
||||
|
||||
if (pumps.Any())
|
||||
{
|
||||
BallastFloraPrefab prefab = string.IsNullOrWhiteSpace(secondaryArgument) ? BallastFloraPrefab.Prefabs.First() : BallastFloraPrefab.Find(secondaryArgument);
|
||||
BallastFloraPrefab prefab = string.IsNullOrWhiteSpace(secondaryArgument) ? BallastFloraPrefab.Prefabs.First() : BallastFloraPrefab.Find(secondaryArgument.ToIdentifier());
|
||||
if (prefab == null)
|
||||
{
|
||||
ThrowError($"No such behavior: {secondaryArgument}");
|
||||
return;
|
||||
}
|
||||
|
||||
Pump random = pumps.GetRandom();
|
||||
Pump random = pumps.GetRandomUnsynced();
|
||||
random.InfectBallast(prefab.Identifier, allowMultiplePerShip: true);
|
||||
NewMessage($"Infected {random.Name} with {prefab.Identifier} in {random.Item.CurrentHull.DisplayName}.", Color.Green);
|
||||
return;
|
||||
@@ -1617,7 +1611,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (int.TryParse(secondaryArgument, out int value))
|
||||
{
|
||||
foreach (Hull hull in Hull.hullList.Where(h => h.BallastFlora != null))
|
||||
foreach (Hull hull in Hull.HullList.Where(h => h.BallastFlora != null))
|
||||
{
|
||||
BallastFloraBehavior bs = hull.BallastFlora;
|
||||
bs.GrowthWarps = value;
|
||||
@@ -1632,7 +1626,7 @@ namespace Barotrauma
|
||||
}, isCheat: true, getValidArgs: () =>
|
||||
{
|
||||
string[] primaries = { "infect", "growthwarp" };
|
||||
string[] identifiers = BallastFloraPrefab.Prefabs.Select(bfp => bfp.Identifier).Distinct().ToArray();
|
||||
string[] identifiers = BallastFloraPrefab.Prefabs.Select(bfp => bfp.Identifier).Distinct().Select(i => i.Value).ToArray();
|
||||
return new[] { primaries, identifiers };
|
||||
}));
|
||||
|
||||
@@ -1660,8 +1654,10 @@ namespace Barotrauma
|
||||
|
||||
commands.Add(new Command("verboselogging", "verboselogging: Toggle verbose console logging on/off. When on, additional debug information is written to the debug console.", (string[] args) =>
|
||||
{
|
||||
GameSettings.VerboseLogging = !GameSettings.VerboseLogging;
|
||||
NewMessage((GameSettings.VerboseLogging ? "Enabled" : "Disabled") + " verbose logging.", Color.White);
|
||||
var config = GameSettings.CurrentConfig;
|
||||
config.VerboseLogging = !GameSettings.CurrentConfig.VerboseLogging;
|
||||
GameSettings.SetCurrentConfig(config);
|
||||
NewMessage((GameSettings.CurrentConfig.VerboseLogging ? "Enabled" : "Disabled") + " verbose logging.", Color.White);
|
||||
}, isCheat: false));
|
||||
|
||||
commands.Add(new Command("listtasks", "listtasks: Lists all asynchronous tasks currently in the task pool.", (string[] args) => { TaskPool.ListTasks(); }));
|
||||
@@ -1671,7 +1667,7 @@ namespace Barotrauma
|
||||
if (args.Length > 0)
|
||||
{
|
||||
string packageName = string.Join(" ", args);
|
||||
var package = GameMain.Config.AllEnabledPackages.FirstOrDefault(p => p.Name.Equals(packageName, StringComparison.OrdinalIgnoreCase));
|
||||
var package = ContentPackageManager.EnabledPackages.All.FirstOrDefault(p => p.Name.Equals(packageName, StringComparison.OrdinalIgnoreCase));
|
||||
if (package == null)
|
||||
{
|
||||
ThrowError("Content package \"" + packageName + "\" not found.");
|
||||
@@ -1683,14 +1679,14 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMain.Config.AllEnabledPackages.First().CalculateHash(logging: true);
|
||||
ContentPackageManager.EnabledPackages.Core.CalculateHash(logging: true);
|
||||
}
|
||||
},
|
||||
() =>
|
||||
{
|
||||
return new string[][]
|
||||
{
|
||||
GameMain.Config.AllEnabledPackages.Select(cp => cp.Name).ToArray()
|
||||
ContentPackageManager.EnabledPackages.All.Select(cp => cp.Name).ToArray()
|
||||
};
|
||||
}));
|
||||
|
||||
@@ -1776,9 +1772,9 @@ namespace Barotrauma
|
||||
msg += "\nBalance: " + location.StoreCurrentBalance;
|
||||
msg += "\nPrice modifier: " + location.StorePriceModifier + "%";
|
||||
msg += "\nDaily specials:";
|
||||
location.DailySpecials.ForEach(i => msg += "\n - " + i.Name);
|
||||
location.DailySpecials.ForEach(i => msg += "\n - " + i.Name.Value);
|
||||
msg += "\nRequested goods:";
|
||||
location.RequestedGoods.ForEach(i => msg += "\n - " + i.Name);
|
||||
location.RequestedGoods.ForEach(i => msg += "\n - " + i.Name.Value);
|
||||
NewMessage(msg);
|
||||
}
|
||||
else
|
||||
@@ -2051,7 +2047,7 @@ namespace Barotrauma
|
||||
switch (args[1].ToLowerInvariant())
|
||||
{
|
||||
case "inside":
|
||||
spawnPoint = WayPoint.GetRandom(SpawnType.Human, null, Submarine.MainSub);
|
||||
spawnPoint = WayPoint.GetRandom(SpawnType.Human, job, Submarine.MainSub);
|
||||
break;
|
||||
case "outside":
|
||||
spawnPoint = WayPoint.GetRandom(SpawnType.Enemy);
|
||||
@@ -2098,7 +2094,7 @@ namespace Barotrauma
|
||||
}
|
||||
catch
|
||||
{
|
||||
DebugConsole.ThrowError($"\"{args[2]}\" is not a valid team id.");
|
||||
ThrowError($"\"{args[2]}\" is not a valid team id.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2106,8 +2102,8 @@ namespace Barotrauma
|
||||
|
||||
if (human)
|
||||
{
|
||||
var variant = job != null ? Rand.Range(0, job.Variants, Rand.RandSync.Server) : 0;
|
||||
CharacterInfo characterInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobPrefab: job, variant: variant);
|
||||
var variant = job != null ? Rand.Range(0, job.Variants, Rand.RandSync.ServerAndClient) : 0;
|
||||
CharacterInfo characterInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: job, variant: variant);
|
||||
spawnedCharacter = Character.Create(characterInfo, spawnPosition, ToolBox.RandomSeed(8));
|
||||
if (GameMain.GameSession != null)
|
||||
{
|
||||
@@ -2121,7 +2117,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CharacterPrefab.FindBySpeciesName(args[0]) != null)
|
||||
if (CharacterPrefab.FindBySpeciesName(args[0].ToIdentifier()) != null)
|
||||
{
|
||||
Character.Create(args[0], spawnPosition, ToolBox.RandomSeed(8));
|
||||
}
|
||||
@@ -2143,7 +2139,7 @@ namespace Barotrauma
|
||||
if (itemPrefab == null)
|
||||
{
|
||||
errorMsg = "Item \"" + itemNameOrId + "\" not found!";
|
||||
var matching = ItemPrefab.Prefabs.Find(me => me.Name.ToLowerInvariant().StartsWith(itemNameOrId) && me is ItemPrefab);
|
||||
var matching = ItemPrefab.Prefabs.Find(me => me.Name.StartsWith(itemNameOrId, StringComparison.OrdinalIgnoreCase) && me is ItemPrefab);
|
||||
if (matching != null)
|
||||
{
|
||||
errorMsg += $" Did you mean \"{matching.Name}\"?";
|
||||
@@ -2204,7 +2200,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
Entity.Spawner?.AddToSpawnQueue(itemPrefab, spawnPos.Value);
|
||||
Entity.Spawner?.AddItemToSpawnQueue(itemPrefab, spawnPos.Value);
|
||||
}
|
||||
}
|
||||
else if (spawnInventory != null)
|
||||
@@ -2217,7 +2213,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
Entity.Spawner?.AddToSpawnQueue(itemPrefab, spawnInventory, onSpawned: onItemSpawned);
|
||||
Entity.Spawner?.AddItemToSpawnQueue(itemPrefab, spawnInventory, onSpawned: onItemSpawned);
|
||||
}
|
||||
|
||||
static void onItemSpawned(Item item)
|
||||
@@ -2246,6 +2242,9 @@ namespace Barotrauma
|
||||
NewMessage(command, color.Value, isCommand: true, isError: false);
|
||||
}
|
||||
|
||||
public static void NewMessage(LocalizedString msg, Color? color = null, bool debugOnly = false)
|
||||
=> NewMessage(msg.Value, color, debugOnly);
|
||||
|
||||
public static void NewMessage(string msg, Color? color = null, bool debugOnly = false)
|
||||
{
|
||||
color ??= Color.White;
|
||||
@@ -2284,7 +2283,7 @@ namespace Barotrauma
|
||||
|
||||
#if CLIENT
|
||||
activeQuestionText = new GUITextBlock(new RectTransform(new Point(listBox.Content.Rect.Width, 0), listBox.Content.RectTransform),
|
||||
" >>" + question, font: GUI.SmallFont, wrap: true)
|
||||
" >>" + question, font: GUIStyle.SmallFont, wrap: true)
|
||||
{
|
||||
CanBeFocused = false,
|
||||
TextColor = Color.Cyan
|
||||
@@ -2352,14 +2351,21 @@ namespace Barotrauma
|
||||
|
||||
public static Command FindCommand(string commandName) => commands.Find(c => c.names.Any(n => n.Equals(commandName, StringComparison.OrdinalIgnoreCase)));
|
||||
|
||||
public static void Log(LocalizedString message) => Log(message?.Value);
|
||||
|
||||
public static void Log(string message)
|
||||
{
|
||||
if (GameSettings.VerboseLogging)
|
||||
if (GameSettings.CurrentConfig.VerboseLogging)
|
||||
{
|
||||
NewMessage(message, Color.Gray);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ThrowError(LocalizedString error, Exception e = null, bool createMessageBox = false, bool appendStackTrace = false)
|
||||
{
|
||||
ThrowError(error.Value);
|
||||
}
|
||||
|
||||
public static void ThrowError(string error, Exception e = null, bool createMessageBox = false, bool appendStackTrace = false)
|
||||
{
|
||||
if (e != null)
|
||||
@@ -2383,7 +2389,7 @@ namespace Barotrauma
|
||||
{
|
||||
error += "\n" + Environment.StackTrace.CleanupStackTrace();
|
||||
}
|
||||
System.Diagnostics.Debug.WriteLine(error);
|
||||
System.Diagnostics.Debug.WriteLine($"ThrowError: {error}");
|
||||
|
||||
#if CLIENT
|
||||
if (createMessageBox)
|
||||
@@ -2408,11 +2414,6 @@ namespace Barotrauma
|
||||
#if CLIENT
|
||||
private static IEnumerable<CoroutineStatus> CreateMessageBox(string errorMsg)
|
||||
{
|
||||
while (GUI.Style == null)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
new GUIMessageBox(TextManager.Get("Error"), errorMsg);
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user