Multiple people have reported errors for this despite content being unlisted from the game so this deals with some of those don't feel like including renames also some of them were literally fine
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using CalamityMod.Projectiles.Environment;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.CalPlayer
|
|
{
|
|
public partial class CalamityPlayer : ModPlayer
|
|
{
|
|
public void DoEnvironmentalEffects()
|
|
{
|
|
CreateLilyglowInFloralParadise();
|
|
}
|
|
|
|
public void CreateLilyglowInFloralParadise()
|
|
{
|
|
// Don't do anything if the player is not in the floral paradise of if this code is called by anyone other than the player.
|
|
if (!ZoneFloralParadise || Main.myPlayer != Player.whoAmI)
|
|
return;
|
|
|
|
if (!Main.rand.NextBool(12))
|
|
return;
|
|
|
|
for (int tries = 0; tries < 50; tries++)
|
|
{
|
|
Vector2 potentialSpawnPosition = Player.Center + new Vector2(Main.rand.NextFloat(-1000f, 1000f), Main.rand.NextFloat(-300f, 300f));
|
|
if (Collision.SolidCollision(potentialSpawnPosition, 1, 1))
|
|
continue;
|
|
|
|
Vector2 spawnVelocity = -Vector2.UnitY.RotatedByRandom(0.82f) * Main.rand.NextFloat(0.5f, 1.35f);
|
|
Projectile.NewProjectile(new EntitySource_WorldEvent(), potentialSpawnPosition, spawnVelocity, ModContent.ProjectileType<Lilyglow>(), 0, 0f, Player.whoAmI);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|