Merge remote-tracking branch 'upstream/master' into develop
This commit is contained in:
@@ -2444,6 +2444,29 @@ namespace Barotrauma
|
||||
}
|
||||
}));
|
||||
|
||||
commands.Add(new Command("converttowreck", "", (string[] args) =>
|
||||
{
|
||||
if (Screen.Selected is not SubEditorScreen)
|
||||
{
|
||||
ThrowError("The command can only be used in the submarine editor.");
|
||||
return;
|
||||
}
|
||||
if (Submarine.MainSub == null)
|
||||
{
|
||||
ThrowError("Load a submarine first to convert it to a wreck.");
|
||||
return;
|
||||
}
|
||||
if (Submarine.MainSub.Info.SubmarineElement == null)
|
||||
{
|
||||
ThrowError("The submarine must be saved before you can convert it to a wreck.");
|
||||
return;
|
||||
}
|
||||
var wreckedSubmarineInfo = new SubmarineInfo(filePath: string.Empty, element: WreckConverter.ConvertToWreck(Submarine.MainSub.Info.SubmarineElement));
|
||||
wreckedSubmarineInfo.Name += "_Wrecked";
|
||||
wreckedSubmarineInfo.Type = SubmarineType.Wreck;
|
||||
GameMain.SubEditorScreen.LoadSub(wreckedSubmarineInfo);
|
||||
}));
|
||||
|
||||
commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
|
||||
{
|
||||
float defaultZoom = Screen.Selected.Cam.DefaultZoom;
|
||||
@@ -2495,6 +2518,49 @@ namespace Barotrauma
|
||||
}
|
||||
}));
|
||||
|
||||
commands.Add(new Command("listcontainertags", "Lists all container tags on the submarine.", (string[] args) =>
|
||||
{
|
||||
if (Screen.Selected != GameMain.SubEditorScreen)
|
||||
{
|
||||
ThrowError("This command can only be used in the sub editor.");
|
||||
return;
|
||||
}
|
||||
|
||||
HashSet<Identifier> allContainerTagsInTheGame = new();
|
||||
|
||||
foreach (var itemPrefab in ItemPrefab.Prefabs)
|
||||
{
|
||||
foreach (var pc in itemPrefab.PreferredContainers)
|
||||
{
|
||||
foreach (Identifier identifier in Enumerable.Union(pc.Primary, pc.Secondary))
|
||||
{
|
||||
allContainerTagsInTheGame.Add(identifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<Identifier, float> prefab = new();
|
||||
|
||||
foreach (Item it in Item.ItemList)
|
||||
{
|
||||
foreach (var tag in allContainerTagsInTheGame)
|
||||
{
|
||||
if (it.GetTags().All(t => tag != t)) { continue; }
|
||||
|
||||
prefab.TryAdd(tag, 0.0f);
|
||||
prefab[tag]++;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb = new();
|
||||
foreach (var (tag, amount) in prefab.OrderByDescending(kvp => kvp.Value))
|
||||
{
|
||||
sb.AppendLine($"{tag}: {amount}");
|
||||
}
|
||||
|
||||
NewMessage(sb.ToString());
|
||||
}, isCheat: false));
|
||||
|
||||
commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
|
||||
{
|
||||
//TODO: maybe do this automatically during loading when possible?
|
||||
@@ -3025,6 +3091,46 @@ namespace Barotrauma
|
||||
ContentPackageManager.EnabledPackages.ReloadCore();
|
||||
}));
|
||||
|
||||
commands.Add(new Command("reloadpackage", "reloapackage [name]: reloads a content package.", (string[] args) =>
|
||||
{
|
||||
if (args.Length < 1)
|
||||
{
|
||||
ThrowError("Please specify the name of the package to reload.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length < 2)
|
||||
{
|
||||
if (Screen.Selected == GameMain.GameScreen)
|
||||
{
|
||||
ThrowError("Reloading the package while in GameScreen may break things; to do it anyway, type 'reloadcorepackage [name] force'");
|
||||
return;
|
||||
}
|
||||
if (Screen.Selected == GameMain.SubEditorScreen)
|
||||
{
|
||||
ThrowError("Reloading the core package while in sub editor may break thingg; to do it anyway, type 'reloadcorepackage [name] force'");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (GameMain.NetworkMember != null)
|
||||
{
|
||||
ThrowError("Cannot change content packages while playing online");
|
||||
return;
|
||||
}
|
||||
|
||||
var package = ContentPackageManager.RegularPackages.FirstOrDefault(p => p.Name == args[0]);
|
||||
if (package == null)
|
||||
{
|
||||
ThrowError($"Could not find the package {args[0]}!");
|
||||
return;
|
||||
}
|
||||
ContentPackageManager.EnabledPackages.ReloadPackage(package);
|
||||
}, getValidArgs: () => new[]
|
||||
{
|
||||
ContentPackageManager.RegularPackages.Select(p => p.Name).ToArray()
|
||||
}));
|
||||
|
||||
#if WINDOWS
|
||||
commands.Add(new Command("startdedicatedserver", "", (string[] args) =>
|
||||
{
|
||||
@@ -3405,6 +3511,29 @@ namespace Barotrauma
|
||||
}
|
||||
character.AnimController.ResetRagdoll(forceReload: true);
|
||||
}, isCheat: true));
|
||||
|
||||
commands.Add(new Command("loadanimation", "Loads an animation variation by name for the controlled character. The animation file has to be in the correct animations folder. Note: the changes are not saved!", (string[] args) =>
|
||||
{
|
||||
var character = Character.Controlled;
|
||||
if (character == null)
|
||||
{
|
||||
ThrowError("Not controlling any character!");
|
||||
return;
|
||||
}
|
||||
if (args.Length < 2)
|
||||
{
|
||||
ThrowError("Insufficient parameters: Have to pass the type of animation (Walk, Run, SwimSlow, SwimFast, or Crouch) and the filename!");
|
||||
return;
|
||||
}
|
||||
string type = args[0];
|
||||
if (!Enum.TryParse(type, ignoreCase: true, out AnimationType animationType))
|
||||
{
|
||||
ThrowError($"Failed to parse animation type from {type}. Supported types are Walk, Run, SwimSlow, SwimFast, and Crouch!");
|
||||
return;
|
||||
}
|
||||
string fileName = args[1];
|
||||
character.AnimController.TryLoadAnimation(animationType, Path.GetFileNameWithoutExtension(fileName), out _, throwErrors: true);
|
||||
}, isCheat: true));
|
||||
|
||||
commands.Add(new Command("reloadwearables", "Reloads the sprites of all limbs and wearable sprites (clothing) of the controlled character. Provide id or name if you want to target another character.", args =>
|
||||
{
|
||||
@@ -3555,7 +3684,10 @@ namespace Barotrauma
|
||||
}
|
||||
try
|
||||
{
|
||||
var subInfo = SubmarineInfo.SavedSubmarines.FirstOrDefault(s => s.DisplayName.Equals(args[0], StringComparison.OrdinalIgnoreCase));
|
||||
var subInfo = SubmarineInfo.SavedSubmarines.FirstOrDefault(s =>
|
||||
//accept both the localized and the non-localized name of the sub
|
||||
s.DisplayName.Equals(args[0], StringComparison.OrdinalIgnoreCase) ||
|
||||
s.Name.Equals(args[0], StringComparison.OrdinalIgnoreCase));
|
||||
if (subInfo == null)
|
||||
{
|
||||
ThrowError($"Could not find a submarine with the name \"{args[0]}\".");
|
||||
|
||||
Reference in New Issue
Block a user