1.) fixed big hive/jungle planetoid chests not containing bars

2.) various world items now may or may not be prefixed
This commit is contained in:
Altixal committed 2025-07-10 21:52:25 +07:00
1 parent 2e859c2551
commit 12e4df9098
12 files changed
+24 -8

No files matched your search

+1
View File
@@ -7,6 +7,7 @@ using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.Furniture
{
[LegacyName("AbyssTorch")]
public class VoidTorch : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
+4 -4
View File
@@ -305,7 +305,7 @@ namespace CalamityMod.Tiles
// Drop Evil Smasher on every 12 alter smashed
if (WorldGen.altarCount > 1 && WorldGen.altarCount % 12 == 0)
DropItem(i, j, ItemType<EvilSmasher>(), quantity: 1, asStack: true);
DropItem(i, j, ItemType<EvilSmasher>(), quantity: 1, asStack: true, prefix: true);
}
// Drop Golden Bombs at a 0.33% chance from Pots
@@ -356,7 +356,7 @@ namespace CalamityMod.Tiles
}
}
private static void DropItem(int i, int j, int itemType, int quantity, bool asStack, Vector2 spreadMinMax = default)
private static void DropItem(int i, int j, int itemType, int quantity, bool asStack, Vector2 spreadMinMax = default, bool prefix = false)
{
// Multiplayer Client should not spawn item themselves
if (Main.netMode == NetmodeID.MultiplayerClient)
@@ -366,14 +366,14 @@ namespace CalamityMod.Tiles
if (asStack)
{
Vector2 spawnOffset = Main.rand.NextVector2Unit(spreadMinMax.X, spreadMinMax.Y);
Item.NewItem(new EntitySource_TileBreak(i, j), worldPos + spawnOffset, itemType, Stack: quantity);
Item.NewItem(new EntitySource_TileBreak(i, j), worldPos + spawnOffset, itemType, Stack: quantity, prefixGiven: prefix ? -1 : 0);
}
else
{
for (int k = 0; k < quantity; k += 1)
{
Vector2 spawnOffset = Main.rand.NextVector2Unit(spreadMinMax.X, spreadMinMax.Y);
Item.NewItem(new EntitySource_TileBreak(i, j), worldPos + spawnOffset, itemType, Stack: 1);
Item.NewItem(new EntitySource_TileBreak(i, j), worldPos + spawnOffset, itemType, Stack: 1, prefixGiven: prefix ? -1 : 0);
}
}
}
+1
View File
@@ -1119,6 +1119,7 @@ namespace CalamityMod.World
if (ChestIndex != -1)
{
Main.chest[ChestIndex].item[0].SetDefaults(itemChoice);
Main.chest[ChestIndex].item[0].Prefix(-1);
Main.chest[ChestIndex].item[1].SetDefaults(WorldGen.genRand.Next(Potions1));
Main.chest[ChestIndex].item[1].stack = WorldGen.genRand.Next(1, 3);
+2
View File
@@ -2185,6 +2185,7 @@ namespace CalamityMod.World
for (int i = 0; i < contents.Count; i++)
{
chest.item[i].SetDefaults(contents[i].Type);
chest.item[i].Prefix(-1);
chest.item[i].stack = contents[i].Stack;
}
}
@@ -2215,6 +2216,7 @@ namespace CalamityMod.World
for (int i = 0; i < contents.Count; i++)
{
chest.item[i].SetDefaults(contents[i].Type);
chest.item[i].Prefix(-1);
chest.item[i].stack = contents[i].Stack;
}
}
+1
View File
@@ -246,6 +246,7 @@ namespace CalamityMod.World
for (int i = 0; i < contents.Count; i++)
{
chest.item[i].SetDefaults(contents[i].Type);
chest.item[i].Prefix(-1);
chest.item[i].stack = contents[i].Stack;
}
}
+1
View File
@@ -135,6 +135,7 @@ namespace CalamityMod.World
else
{
chest.item[i].SetDefaults(contents2[i].Type);
chest.item[i].Prefix(-1);
chest.item[i].stack = contents2[i].Stack;
}
}
+3 -2
View File
@@ -831,12 +831,13 @@ namespace CalamityMod.World
int index = 0;
chest.item[index++].SetDefaults(random.Next(FocusLootHoney));
chest.item[index].SetDefaults(random.Next(FocusLootHoney));
chest.item[index++].Prefix(-1);
if (random.Next(3) <= 1)
{
chest.item[index].SetDefaults(random.Next(BarLootHoney));
chest.item[index].SetDefaults(random.Next(7, 15));
chest.item[index++].stack = random.Next(7, 15);
}
else
{
+1
View File
@@ -130,6 +130,7 @@ namespace CalamityMod.World
for (int i = 0; i < contents.Count; i++)
{
chest.item[i].SetDefaults(contents[i].Type);
chest.item[i].Prefix(-1);
chest.item[i].stack = contents[i].Stack;
}
}
+1
View File
@@ -63,6 +63,7 @@ namespace CalamityMod.World
return;
c.item[itemIndex].SetDefaults(id, false);
c.item[itemIndex].Prefix(-1);
// Don't set quantity unless quantity is specified
if (minQuantity > 0)
+3 -2
View File
@@ -222,13 +222,14 @@ namespace CalamityMod.World.Planets
int index = 0;
//Focus loot
chest.item[index++].SetDefaults(_random.Next(FocusLoot));
chest.item[index].SetDefaults(_random.Next(FocusLoot));
chest.item[index++].Prefix(-1);
//Bars
if (_random.Next(3) <= 1)
{
chest.item[index].SetDefaults(_random.Next(BarLoot));
chest.item[index].SetDefaults(_random.Next(7, 15));
chest.item[index++].stack = _random.Next(7, 15);
}
else
{
+5
View File
@@ -272,6 +272,7 @@ namespace CalamityMod.World
for (int i = 0; i < contents.Count; i++)
{
chest.item[i].SetDefaults(contents[i].Type);
chest.item[i].Prefix(-1);
chest.item[i].stack = contents[i].Stack;
}
}
@@ -341,6 +342,7 @@ namespace CalamityMod.World
for (int i = 0; i < contents.Count; i++)
{
chest.item[i].SetDefaults(contents[i].Type);
chest.item[i].Prefix(-1);
chest.item[i].stack = contents[i].Stack;
}
}
@@ -534,6 +536,7 @@ namespace CalamityMod.World
for (int i = 0; i < contents.Count; i++)
{
chest.item[i].SetDefaults(contents[i].Type);
chest.item[i].Prefix(-1);
chest.item[i].stack = contents[i].Stack;
}
}
@@ -670,6 +673,7 @@ namespace CalamityMod.World
for (int i = 0; i < contents.Count; i++)
{
chest.item[i].SetDefaults(contents[i].Type);
chest.item[i].Prefix(-1);
chest.item[i].stack = contents[i].Stack;
}
}
@@ -761,6 +765,7 @@ namespace CalamityMod.World
for (int i = 0; i < contents.Count; i++)
{
chest.item[i].SetDefaults(contents[i].Type);
chest.item[i].Prefix(-1);
chest.item[i].stack = contents[i].Stack;
}
}
+1
View File
@@ -86,6 +86,7 @@ namespace CalamityMod.World
for (int i = 0; i < contents.Count; i++)
{
chest.item[i].SetDefaults(contents[i].Type);
chest.item[i].Prefix(-1);
chest.item[i].stack = contents[i].Stack;
}
}