(58b5b8b6a) Fixed nullref exception when trying to spawn items with the "spawnitem" command when a round is not running
This commit is contained in:
@@ -791,7 +791,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
UpdateLimbAttack(deltaTime, AttackingLimb, attackSimPos, distance);
|
UpdateLimbAttack(deltaTime, AttackingLimb, attackSimPos, distance);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SteerThroughGap(Structure wall, WallSection section, Vector2 targetWorldPos, float deltaTime)
|
private bool SteerThroughGap(Structure wall, WallSection section, Vector2 targetWorldPos, float deltaTime)
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
string errorMsg = "Failed to spawn an item. Arguments: \"" + string.Join(" ", args) + "\".";
|
string errorMsg = "Failed to spawn an item. Arguments: \"" + string.Join(" ", args) + "\".";
|
||||||
ThrowError(errorMsg, e);
|
ThrowError(errorMsg, e);
|
||||||
GameAnalyticsManager.AddErrorEventOnce("DebugConsole.SpawnItem:Error", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
GameAnalyticsManager.AddErrorEventOnce("DebugConsole.SpawnItem:Error", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg + '\n' + e.Message + '\n' + e.StackTrace);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
() =>
|
() =>
|
||||||
@@ -1461,12 +1461,26 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (spawnPos != null)
|
if (spawnPos != null)
|
||||||
{
|
{
|
||||||
Entity.Spawner.AddToSpawnQueue(itemPrefab, (Vector2)spawnPos);
|
if (Entity.Spawner == null)
|
||||||
|
{
|
||||||
|
new Item(itemPrefab, spawnPos.Value, null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Entity.Spawner?.AddToSpawnQueue(itemPrefab, spawnPos.Value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (spawnInventory != null)
|
else if (spawnInventory != null)
|
||||||
{
|
{
|
||||||
Entity.Spawner.AddToSpawnQueue(itemPrefab, spawnInventory);
|
if (Entity.Spawner == null)
|
||||||
|
{
|
||||||
|
var spawnedItem = new Item(itemPrefab, Vector2.Zero, null);
|
||||||
|
spawnInventory.TryPutItem(spawnedItem, null, spawnedItem.AllowedSlots);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Entity.Spawner?.AddToSpawnQueue(itemPrefab, spawnInventory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -841,54 +841,6 @@ namespace Barotrauma
|
|||||||
VoiceSetting = voiceSetting;
|
VoiceSetting = voiceSetting;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!SelectedContentPackages.Any())
|
|
||||||
{
|
|
||||||
var availablePackage = ContentPackage.List.FirstOrDefault(cp => cp.IsCompatible() && cp.CorePackage);
|
|
||||||
if (availablePackage != null)
|
|
||||||
{
|
|
||||||
SelectedContentPackages.Add(availablePackage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//save to get rid of the invalid selected packages in the config file
|
|
||||||
if (missingPackagePaths.Count > 0 || incompatiblePackages.Count > 0) { SaveNewPlayerConfig(); }
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Save DefaultConfig
|
|
||||||
private void SaveNewDefaultConfig()
|
|
||||||
{
|
|
||||||
XDocument doc = new XDocument();
|
|
||||||
|
|
||||||
if (doc.Root == null)
|
|
||||||
{
|
|
||||||
doc.Add(new XElement("config"));
|
|
||||||
}
|
|
||||||
|
|
||||||
doc.Root.Add(
|
|
||||||
new XAttribute("language", TextManager.Language),
|
|
||||||
new XAttribute("masterserverurl", MasterServerUrl),
|
|
||||||
new XAttribute("autocheckupdates", AutoCheckUpdates),
|
|
||||||
new XAttribute("musicvolume", musicVolume),
|
|
||||||
new XAttribute("soundvolume", soundVolume),
|
|
||||||
new XAttribute("voicechatvolume", voiceChatVolume),
|
|
||||||
new XAttribute("verboselogging", VerboseLogging),
|
|
||||||
new XAttribute("savedebugconsolelogs", SaveDebugConsoleLogs),
|
|
||||||
new XAttribute("enablesplashscreen", EnableSplashScreen),
|
|
||||||
new XAttribute("usesteammatchmaking", useSteamMatchmaking),
|
|
||||||
new XAttribute("quickstartsub", QuickStartSubmarineName),
|
|
||||||
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
|
|
||||||
new XAttribute("aimassistamount", aimAssistAmount));
|
|
||||||
|
|
||||||
if (!ShowUserStatisticsPrompt)
|
|
||||||
{
|
|
||||||
doc.Root.Add(new XAttribute("senduserstatistics", sendUserStatistics));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (WasGameUpdated)
|
|
||||||
{
|
|
||||||
doc.Root.Add(new XAttribute("wasgameupdated", true));
|
|
||||||
}
|
|
||||||
|
|
||||||
useSteamMatchmaking = doc.Root.GetAttributeBool("usesteammatchmaking", useSteamMatchmaking);
|
useSteamMatchmaking = doc.Root.GetAttributeBool("usesteammatchmaking", useSteamMatchmaking);
|
||||||
requireSteamAuthentication = doc.Root.GetAttributeBool("requiresteamauthentication", requireSteamAuthentication);
|
requireSteamAuthentication = doc.Root.GetAttributeBool("requiresteamauthentication", requireSteamAuthentication);
|
||||||
@@ -968,22 +920,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
foreach (XElement subElement in doc.Root.Elements())
|
foreach (XElement subElement in doc.Root.Elements())
|
||||||
{
|
{
|
||||||
gSettings = new XElement("graphicssettings");
|
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||||
doc.Root.Add(gSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
gSettings.ReplaceAttributes(
|
|
||||||
new XAttribute("particlelimit", ParticleLimit),
|
|
||||||
new XAttribute("lightmapscale", LightMapScale),
|
|
||||||
new XAttribute("specularity", SpecularityEnabled),
|
|
||||||
new XAttribute("chromaticaberration", ChromaticAberrationEnabled),
|
|
||||||
new XAttribute("losmode", LosMode),
|
|
||||||
new XAttribute("hudscale", HUDScale),
|
|
||||||
new XAttribute("inventoryscale", InventoryScale));
|
|
||||||
|
|
||||||
foreach (ContentPackage contentPackage in SelectedContentPackages)
|
|
||||||
{
|
|
||||||
if (contentPackage.Path.Contains(vanillaContentPackagePath))
|
|
||||||
{
|
{
|
||||||
case "contentpackage":
|
case "contentpackage":
|
||||||
string path = System.IO.Path.GetFullPath(subElement.GetAttributeString("path", ""));
|
string path = System.IO.Path.GetFullPath(subElement.GetAttributeString("path", ""));
|
||||||
@@ -1096,7 +1033,6 @@ namespace Barotrauma
|
|||||||
new XAttribute("autocheckupdates", AutoCheckUpdates),
|
new XAttribute("autocheckupdates", AutoCheckUpdates),
|
||||||
new XAttribute("musicvolume", musicVolume),
|
new XAttribute("musicvolume", musicVolume),
|
||||||
new XAttribute("soundvolume", soundVolume),
|
new XAttribute("soundvolume", soundVolume),
|
||||||
new XAttribute("voicechatvolume", voiceChatVolume),
|
|
||||||
new XAttribute("verboselogging", VerboseLogging),
|
new XAttribute("verboselogging", VerboseLogging),
|
||||||
new XAttribute("savedebugconsolelogs", SaveDebugConsoleLogs),
|
new XAttribute("savedebugconsolelogs", SaveDebugConsoleLogs),
|
||||||
new XAttribute("enablesplashscreen", EnableSplashScreen),
|
new XAttribute("enablesplashscreen", EnableSplashScreen),
|
||||||
|
|||||||
@@ -1128,23 +1128,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
||||||
}
|
}
|
||||||
if (!broken)
|
|
||||||
{
|
|
||||||
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
|
||||||
}
|
|
||||||
if (!broken)
|
|
||||||
{
|
|
||||||
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
|
||||||
}
|
|
||||||
if (!broken)
|
|
||||||
{
|
|
||||||
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
|
||||||
}
|
|
||||||
if (!broken)
|
|
||||||
{
|
|
||||||
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
|
||||||
}
|
|
||||||
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
|
||||||
|
|
||||||
if (body == null || !body.Enabled || !inWater || ParentInventory != null || Removed) { return; }
|
if (body == null || !body.Enabled || !inWater || ParentInventory != null || Removed) { return; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user