Decimation_Mod/Content/Tiles/ShrineoftheMoltenOne/ShrineAltar.cs
FyloZ 57423952bf Fixed items were always consumed.
Added possibility to add light to tiles.
Updated Shrine Altar's sprite.
2020-07-09 15:47:54 -04:00

84 lines
2.9 KiB
C#

using Decimation.Content.Items.Boss.Arachnus;
using Decimation.Content.NPCs.Arachnus;
using Decimation.Lib.Tiles;
using Decimation.Lib.Util;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
namespace Decimation.Content.Tiles.ShrineoftheMoltenOne
{
class ShrineAltar : DecimationMultiTile
{
public override Color MapColor => new Color(33, 28, 25);
public override int TileItem => ModContent.ItemType<Items.Placeable.ShrineoftheMoltenOne.ShrineAltar>();
public override TileObjectData Style => TileObjectData.Style5x4;
public override int? Height => 3;
public override Point16 Origin => new Point16(2, 1);
public override string Name => "Shrine Altar";
public override int DustType => DustID.LavaMoss;
public override int? AnimationFrameCount => 6;
public override int? AnimationFrameHeight => 54;
public override bool HasLight => true;
private readonly Vector3 _lightColor = LightingUtils.Rgb255ToRgb1(255, 155, 48);
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
{
r = _lightColor.X;
g = _lightColor.Y;
b = _lightColor.Z;
}
public override bool NewRightClick(int i, int j)
{
Player player = Main.LocalPlayer;
Item[] inventory = player.inventory;
bool inventoryContainAmulet = false;
for (int k = 0; k < inventory.Length; k++)
if (inventory[k].type == ModContent.ItemType<MoltenArachnidsAmulet>())
{
inventoryContainAmulet = true;
inventory[k].TurnToAir();
break;
}
if (inventoryContainAmulet)
{
if (Main.netMode == 1)
{
ModPacket packet = mod.GetPacket();
packet.Write((byte) DecimationModMessageType.SpawnBoss);
packet.Write(ModContent.NPCType<Arachnus>());
packet.Write(player.whoAmI);
packet.Send();
}
else if (Main.netMode == 0)
{
Main.PlaySound(15, (int) player.position.X, (int) player.position.Y, 0);
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<Arachnus>());
}
}
return inventoryContainAmulet;
}
public override void MouseOver(int i, int j)
{
Player player = Main.LocalPlayer;
player.noThrow = 2;
player.showItemIcon = true;
player.showItemIcon2 = ModContent.ItemType<MoltenArachnidsAmulet>();
}
public override bool CanKillTile(int i, int j, ref bool blockDamaged)
{
return DecimationWorld.downedArachnus;
}
}
}