Delaying Astral spawn a bit + Flow's fix attempt (needs Testing)

This commit is contained in:
Shade committed 2024-10-15 12:49:54 -06:00
1 parent f5fe53aa09
commit dbcbac3e79
2 files changed
+23 -13

No files matched your search

+3 -1
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Threading;
using CalamityMod.Items.SummonItems;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.World;
@@ -362,7 +363,8 @@ namespace CalamityMod.Systems
// Insert the Astral biome generation right before the final hardmode announcement.
tasks.Insert(announceIndex, new PassLegacy("AstralMeteor", (progress, config) =>
{
AstralBiome.PlaceAstralMeteor();
//Delaying it a bit so that weaker pcs dont suffer - Shade
ThreadPool.QueueUserWorkItem(_ => World.AstralBiome.PlaceAstralMeteor());
}));
}
#endregion
+20 -12
View File
@@ -19,22 +19,30 @@ namespace CalamityMod
/// <returns>true If we successfully get GlobalNPC. otherwise false</returns>
public static bool TryGetGlobalNPCSafer<T>(this NPC npc, out T globalNPC) where T : GlobalNPC
{
if (npc is null)
try
{
if (npc is null)
{
globalNPC = null;
return false;
}
int slot = ModContent.GetInstance<T>()?.PerEntityIndex ?? -1;
int length = npc.EntityGlobals.Length;
if (slot < 0 || slot >= length)
{
globalNPC = null;
return false;
}
npc.TryGetGlobalNPC(out globalNPC);
return globalNPC != null;
}
catch
{
globalNPC = null;
return false;
}
int slot = ModContent.GetInstance<T>()?.PerEntityIndex ?? -1;
int length = npc.EntityGlobals.Length;
if (slot < 0 || slot >= length)
{
globalNPC = null;
return false;
}
npc.TryGetGlobalNPC(out globalNPC);
return globalNPC != null;
}
}
}