《泰拉瑞亚》Mechdusa 召唤失败报错且消耗召唤物品
Mechdusa spawn error and summoning items consumed on failed spawn
《泰拉瑞亚》中召唤 Mechdusa 因无合适实心块失败时报错并消耗了召唤物品。该问题同样复现于 Eye of Cthulhu 召唤,因生成位置校验晚于物品消耗。作者建议游戏在消耗召唤物前先验证生成条件。
Description
When attempting to summon Mechdusa without suitable solid blocks nearby, the summon fails because Skeletron Prime cannot find a valid spawn location. However, Mechdusa's spawning routine appears to continue processing the summon, resulting in an invalid NPC array index and the following error:
Code:
Invariant Failed: Error on message 61 @127.0.0.1:56618(Catena). System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Terraria.NPC.SpawnMechQueen (System.Int32 onWhichPlayer) [0x00091] in <60753b24bd9047648531826bf7e606f0>:0
at Terraria.MessageBuffer.GetData (System.Int32 start, System.Int32 length, System.Int32& messageType) [0x06422] in <60753b24bd9047648531826bf7e606f0>:0
at Terraria.NetMessage.CheckBytes (System.Int32 bufferIndex) [0x0011f] in <60753b24bd9047648531826bf7e606f0>:0The same underlying issue may affect other bosses when their spawn requirements are not met.
Problem
The main issue is not the error message itself, but the fact that the summoning item is consumed even though the boss never spawns.
For example, attempting to summon Mechdusa without a suitable spawn location consumes the summoning item and plays the summoning sound, but no boss appears. A similar behavior can be reproduced with the Eye of Cthulhu: the summoning sound plays and the item is consumed, but the boss does not spawn.
By contrast, attempting to summon a boss during daytime when it is not allowed to spawn, or attempting to summon a boss that is already alive, does not consume the summoning item.
This suggests that some spawn eligibility checks are performed before the summoning item is consumed, while other failure conditions — such as the inability to find a valid spawn location — are handled too late in the process.
Expected Behavior
If the game cannot find a valid spawn location, the summoning attempt should fail gracefully without consuming the summoning item.
Suggested Solution
Validate the spawn conditions before consuming the summoning item or committing to the summoning process. If a valid spawn location cannot be found, cancel the attempt without consuming the item.
Additionally, Mechdusa's spawning routine should handle the failure to spawn Skeletron Prime gracefully and avoid accessing an invalid NPC array index when the initial spawn fails.
来源:Terraria Forum · forums.terraria.org