1 - Fixed Vine issues?

2 - Gave Astral Vines a name on the map and made them emit some light that shifts between cyan and orange.
This commit is contained in:
mountaindrew10 committed 2022-12-17 19:32:58 -06:00
1 parent c1f3967f4b
commit e937ca7dff
3 files changed
+32 -14

No files matched your search

+13 -3
View File
@@ -12,13 +12,14 @@ namespace CalamityMod.Tiles.Astral
{
public override void SetStaticDefaults()
{
Main.tileLighted[Type] = true;
Main.tileCut[Type] = true;
Main.tileBlockLight[Type] = true;
Main.tileLavaDeath[Type] = true;
Main.tileNoFail[Type] = true;
TileID.Sets.IsVine[Type] = true;
TileID.Sets.ReplaceTileBreakDown[Type] = true;
TileID.Sets.VineThreads[Type] = true;
TileID.Sets.VineThreads[Type] = true;
TileID.Sets.DrawFlipMode[Type] = 1;
TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]);
@@ -26,16 +27,25 @@ namespace CalamityMod.Tiles.Astral
HitSound = SoundID.Grass;
AddMapEntry(new Color(65, 56, 83));
ModTranslation name = CreateMapEntryName();
name.SetDefault("Astral Vines");
AddMapEntry(new Color(65, 56, 83), name);
}
public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem)
{
//GIVE VINE ROPE IF SPECIAL VINE BOOK
if (WorldGen.genRand.Next(2) == 0 && Main.player[(int)Player.FindClosest(new Vector2((float)(i * 16), (float)(j * 16)), 16, 16)].cordage)
if (WorldGen.genRand.NextBool() && Main.player[(int)Player.FindClosest(new Vector2((float)(i * 16), (float)(j * 16)), 16, 16)].cordage)
{
Item.NewItem(new EntitySource_TileBreak(i, j), new Vector2(i * 16 + 8f, j * 16 + 8f), ItemID.VineRope);
}
}
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
{
r = Main.DiscoR / 255f * 0.5f;
g = 0.5f;
b = (255 - Main.DiscoR) / 255f * 0.5f;
}
}
}
+5 -3
View File
@@ -69,18 +69,18 @@ namespace CalamityMod.Tiles
{
// Custom plant framing
for (int k = 0; k < PlantTypes.Length; k++)
{
if (type == PlantTypes[k])
{
TileFraming.PlantFrame(i, j);
return false;
}
}
// Custom vine framing
if (type == TileID.Vines || type == TileID.CrimsonVines || type == TileID.HallowedVines || type == ModContent.TileType<AstralVines>())
{
TileFraming.VineFrame(i, j);
return false;
}
return base.TileFrame(i, j, type, ref resetFrame, ref noBreak);
}
@@ -142,6 +142,7 @@ namespace CalamityMod.Tiles
{
if (xPos < 0 || xPos >= Main.maxTilesX || yPos < 0 || yPos >= Main.maxTilesY)
return;
Tile t = Main.tile[xPos, yPos];
if (t.HasTile && (t.TileType == ModContent.TileType<LumenylCrystals>() || (t.TileType == ModContent.TileType<SeaPrismCrystals>() && DownedBossSystem.downedDesertScourge)))
{
@@ -232,6 +233,7 @@ namespace CalamityMod.Tiles
if (player.breath > player.breathMax)
player.breath = player.breathMax;
}
// Mining set gives a chance for additional ore. This can be abused for infinite ore but it has a cooldown to prevent too much abuse
if (player.Calamity().miningSet && player.Calamity().miningSetCooldown <= 0 && !fail)
{
+14 -8
View File
@@ -265,6 +265,7 @@ namespace CalamityMod
return;
if (y < 0 || y >= Main.maxTilesY)
return;
Tile tile = Main.tile[x, y];
int myType = tile.TileType;
@@ -284,25 +285,30 @@ namespace CalamityMod
return;
}
}
// If the tile above is an identical vine, nothing else needs to be done.
if (northType == myType)
return;
// If the tile above isn't sloped correctly or otherwise isn't a valid anchor for this vine, check whether the vine must die.
bool tileMustDie = northType == -1;
if(northType != -1)
if (northType != -1)
{
// Vanilla vines can hang from vanilla grass and vanilla leaf blocks.
if (myType == TileID.Vines && northType != TileID.Grass && northType != TileID.LeafBlock)
tileMustDie = true;
else for (int i = 0; i < vines.Length; ++i)
{
// Not matching grass? Die.
if (myType == vines[i] && northType != VineToGrass[vines[i]])
tileMustDie = true;
}
else
{
for (int i = 0; i < vines.Length; ++i)
{
tileMustDie = true;
break;
// Not matching grass? Die.
if (myType == vines[i] && northType != VineToGrass[vines[i]])
{
tileMustDie = true;
break;
}
}
}
}