Networking stuff for the Dune Wyrm.
Changed Crystal Skull and Red Hot Shackle's sprites
This commit is contained in:
parent
16b387b796
commit
15d2947c33
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using Decimation.Content.NPCs.Arachnus;
|
using Decimation.Content.NPCs.Arachnus;
|
||||||
using Decimation.Content.NPCs.DuneWyrm;
|
using Decimation.Content.NPCs.DuneWyrm;
|
||||||
|
using Decimation.Content.NPCs.DuneWyrm.AncientTombCrawler;
|
||||||
using Decimation.Content.UI;
|
using Decimation.Content.UI;
|
||||||
using Decimation.Lib.Util;
|
using Decimation.Lib.Util;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
@ -15,8 +16,6 @@ namespace Decimation.Content
|
|||||||
{
|
{
|
||||||
public class Decimation : Mod
|
public class Decimation : Mod
|
||||||
{
|
{
|
||||||
public static Decimation Instance { set; get; }
|
|
||||||
|
|
||||||
public static AmuletSlotState amuletSlotState;
|
public static AmuletSlotState amuletSlotState;
|
||||||
private UserInterface amuletSlotInterface;
|
private UserInterface amuletSlotInterface;
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ namespace Decimation.Content
|
|||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
|
||||||
Properties = new ModProperties()
|
Properties = new ModProperties
|
||||||
{
|
{
|
||||||
Autoload = true,
|
Autoload = true,
|
||||||
AutoloadGores = true,
|
AutoloadGores = true,
|
||||||
@ -36,6 +35,8 @@ namespace Decimation.Content
|
|||||||
References.mod = this;
|
References.mod = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Decimation Instance { set; get; }
|
||||||
|
|
||||||
public override void Load()
|
public override void Load()
|
||||||
{
|
{
|
||||||
if (!Main.dedServ)
|
if (!Main.dedServ)
|
||||||
@ -104,22 +105,11 @@ namespace Decimation.Content
|
|||||||
|
|
||||||
public override void AddRecipeGroups()
|
public override void AddRecipeGroups()
|
||||||
{
|
{
|
||||||
RecipeGroup gems = new RecipeGroup(() => Lang.misc[37] + " Gem", new int[]
|
RecipeGroup gems = new RecipeGroup(() => Lang.misc[37] + " Gem", ItemID.Amethyst, ItemID.Topaz,
|
||||||
{
|
ItemID.Emerald, ItemID.Sapphire, ItemID.Ruby, ItemID.Diamond);
|
||||||
ItemID.Amethyst,
|
|
||||||
ItemID.Topaz,
|
|
||||||
ItemID.Emerald,
|
|
||||||
ItemID.Sapphire,
|
|
||||||
ItemID.Ruby,
|
|
||||||
ItemID.Diamond,
|
|
||||||
});
|
|
||||||
|
|
||||||
RecipeGroup threads = new RecipeGroup(() => Lang.misc[37] + " Thread", new int[]
|
RecipeGroup threads = new RecipeGroup(() => Lang.misc[37] + " Thread", ItemID.BlackThread,
|
||||||
{
|
ItemID.GreenThread, ItemID.PinkThread);
|
||||||
ItemID.BlackThread,
|
|
||||||
ItemID.GreenThread,
|
|
||||||
ItemID.PinkThread
|
|
||||||
});
|
|
||||||
|
|
||||||
RecipeGroup.RegisterGroup("AnyGem", gems);
|
RecipeGroup.RegisterGroup("AnyGem", gems);
|
||||||
RecipeGroup.RegisterGroup("AnyThread", threads);
|
RecipeGroup.RegisterGroup("AnyThread", threads);
|
||||||
@ -133,20 +123,15 @@ namespace Decimation.Content
|
|||||||
{
|
{
|
||||||
case DecimationModMessageType.Arachnus:
|
case DecimationModMessageType.Arachnus:
|
||||||
Arachnus arachnus = (Arachnus) Main.npc[reader.ReadInt32()].modNPC;
|
Arachnus arachnus = (Arachnus) Main.npc[reader.ReadInt32()].modNPC;
|
||||||
if (arachnus != null && arachnus.npc.active)
|
if (arachnus != null && arachnus.npc.active) arachnus.HandlePacket(reader);
|
||||||
{
|
|
||||||
arachnus.HandlePacket(reader);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case DecimationModMessageType.DuneWorm:
|
case DecimationModMessageType.DuneWyrm:
|
||||||
DuneWyrmHead duneWyrm = (DuneWyrmHead) Main.npc[reader.ReadInt32()].modNPC;
|
DuneWyrmHead duneWyrm = (DuneWyrmHead) Main.npc[reader.ReadInt32()].modNPC;
|
||||||
if (duneWyrm != null && duneWyrm.npc.active)
|
if (duneWyrm != null && duneWyrm.npc.active) duneWyrm.HandlePacket(reader);
|
||||||
{
|
break;
|
||||||
// TODO multiplayer
|
case DecimationModMessageType.AncientTombCrawler:
|
||||||
// duneWyrm.HandlePacket(reader);
|
AncientTombCrawler tombCrawler = (AncientTombCrawler) Main.npc[reader.ReadInt32()].modNPC;
|
||||||
}
|
if (tombCrawler != null && tombCrawler.npc.active) tombCrawler.HandlePacket(reader);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case DecimationModMessageType.SpawnBoss:
|
case DecimationModMessageType.SpawnBoss:
|
||||||
int type = reader.ReadInt32();
|
int type = reader.ReadInt32();
|
||||||
@ -155,17 +140,15 @@ namespace Decimation.Content
|
|||||||
if (Main.netMode != 1)
|
if (Main.netMode != 1)
|
||||||
NPC.SpawnOnPlayer(player, type);
|
NPC.SpawnOnPlayer(player, type);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
ErrorLogger.Log("DecimationMod: Unknown Message type: " + msgType);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum DecimationModMessageType : byte
|
internal enum DecimationModMessageType : byte
|
||||||
{
|
{
|
||||||
Arachnus,
|
Arachnus,
|
||||||
DuneWorm,
|
DuneWyrm,
|
||||||
|
AncientTombCrawler,
|
||||||
SpawnBoss
|
SpawnBoss
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -15,11 +15,11 @@ namespace Decimation.Content.Items.Accessories
|
|||||||
|
|
||||||
protected override void InitAccessory()
|
protected override void InitAccessory()
|
||||||
{
|
{
|
||||||
item.width = 24;
|
item.width = 35;
|
||||||
item.height = 24;
|
item.height = 22;
|
||||||
item.rare = Rarity.Green.GetRarityValue();
|
item.rare = Rarity.Green.GetRarityValue();
|
||||||
this.item.value = Item.buyPrice(0, 0, 0, 10);
|
item.value = Item.buyPrice(0, 0, 0, 10);
|
||||||
this.item.defense = 2;
|
item.defense = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override List<ModRecipe> GetAdditionalRecipes()
|
protected override List<ModRecipe> GetAdditionalRecipes()
|
||||||
@ -39,7 +39,5 @@ namespace Decimation.Content.Items.Accessories
|
|||||||
player.AddBuff(BuffID.Thorns, 1);
|
player.AddBuff(BuffID.Thorns, 1);
|
||||||
Lighting.AddLight(player.Center, new Vector3(0.9f * 0.6f, 0.9f * 0.1f, 0.9f));
|
Lighting.AddLight(player.Center, new Vector3(0.9f * 0.6f, 0.9f * 0.1f, 0.9f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 524 B After Width: | Height: | Size: 549 B |
@ -23,6 +23,7 @@ namespace Decimation.Content.Items.Accessories
|
|||||||
item.value = Item.buyPrice(0, 0, 2);
|
item.value = Item.buyPrice(0, 0, 2);
|
||||||
item.defense = 1;
|
item.defense = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override List<ModRecipe> GetAdditionalRecipes()
|
protected override List<ModRecipe> GetAdditionalRecipes()
|
||||||
{
|
{
|
||||||
ModRecipe recipe = GetNewModRecipe(this, 1, new List<int>() { TileID.Furnaces }, true);
|
ModRecipe recipe = GetNewModRecipe(this, 1, new List<int>() { TileID.Furnaces }, true);
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 315 B After Width: | Height: | Size: 381 B |
@ -54,9 +54,9 @@ namespace Decimation.Content.NPCs.Arachnus
|
|||||||
|
|
||||||
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
|
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
|
||||||
{
|
{
|
||||||
npc.lifeMax = (int)(npc.lifeMax * 0.625f * bossLifeScale);
|
npc.lifeMax = (int) (npc.lifeMax * 0.625f * bossLifeScale);
|
||||||
npc.damage = (int)(npc.damage * 0.6f);
|
npc.damage = (int) (npc.damage * 0.6f);
|
||||||
npc.defense = (int)(npc.defense + numPlayers * 2);
|
npc.defense = (int) (npc.defense + numPlayers * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckDispawn()
|
private bool CheckDispawn()
|
||||||
@ -77,19 +77,20 @@ namespace Decimation.Content.NPCs.Arachnus
|
|||||||
{
|
{
|
||||||
// Rotate to player
|
// Rotate to player
|
||||||
Vector2 moveTo = Main.player[npc.target].Center - npc.Center;
|
Vector2 moveTo = Main.player[npc.target].Center - npc.Center;
|
||||||
float angle = (float)Math.Atan2(moveTo.Y, moveTo.X);
|
float angle = (float) Math.Atan2(moveTo.Y, moveTo.X);
|
||||||
npc.rotation = (float)(angle + Math.PI * 0.5f);
|
npc.rotation = (float) (angle + Math.PI * 0.5f);
|
||||||
|
|
||||||
// Move
|
// Move
|
||||||
Vector2 move = moveTo;
|
Vector2 move = moveTo;
|
||||||
float magnitude = (float)Math.Sqrt(move.X * move.X + move.Y * move.Y);
|
float magnitude = (float) Math.Sqrt(move.X * move.X + move.Y * move.Y);
|
||||||
if (magnitude > speed)
|
if (magnitude > speed)
|
||||||
{
|
{
|
||||||
move *= speed / magnitude;
|
move *= speed / magnitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
float turnResistance = 50f;
|
float turnResistance = 50f;
|
||||||
move = (npc.velocity * turnResistance + move) / (turnResistance + 1f);
|
move = (npc.velocity * turnResistance + move) / (turnResistance + 1f);
|
||||||
magnitude = (float)Math.Sqrt(move.X * move.X + move.Y * move.Y);
|
magnitude = (float) Math.Sqrt(move.X * move.X + move.Y * move.Y);
|
||||||
if (magnitude > speed)
|
if (magnitude > speed)
|
||||||
{
|
{
|
||||||
move *= speed / magnitude;
|
move *= speed / magnitude;
|
||||||
@ -104,17 +105,23 @@ namespace Decimation.Content.NPCs.Arachnus
|
|||||||
if (counter % 60 == 0)
|
if (counter % 60 == 0)
|
||||||
{
|
{
|
||||||
int validBlockCount = 0;
|
int validBlockCount = 0;
|
||||||
for (int i = (int)(-50 + npc.Center.X / 16f); i <= (int)(50 + npc.Center.X / 16f); i++)
|
for (int i = (int) (-50 + npc.Center.X / 16f); i <= (int) (50 + npc.Center.X / 16f); i++)
|
||||||
{
|
{
|
||||||
for (int j = (int)(-50 + npc.Center.Y / 16f); j <= (int)(50 + npc.Center.Y / 16f); j++)
|
for (int j = (int) (-50 + npc.Center.Y / 16f); j <= (int) (50 + npc.Center.Y / 16f); j++)
|
||||||
{
|
{
|
||||||
if (i >= 0 && i <= Main.maxTilesX && j >= 0 && j <= Main.maxTilesY)
|
if (i >= 0 && i <= Main.maxTilesX && j >= 0 && j <= Main.maxTilesY)
|
||||||
{
|
{
|
||||||
if (Main.tile[i, j].type == ModContent.TileType<ShrineBrick>() || (Main.tile[i, j].type == ModContent.TileType<LockedShrineDoor>() || Main.tile[i, j].type == ModContent.TileType<ShrineDoorClosed>() || Main.tile[i, j].type == ModContent.TileType<ShrineDoorOpened>()) || Main.tile[i, j].type == ModContent.TileType<RedHotSpike>() || Main.tile[i, j].type == ModContent.TileType<ShrineAltar>())
|
if (Main.tile[i, j].type == ModContent.TileType<ShrineBrick>() ||
|
||||||
|
(Main.tile[i, j].type == ModContent.TileType<LockedShrineDoor>() ||
|
||||||
|
Main.tile[i, j].type == ModContent.TileType<ShrineDoorClosed>() ||
|
||||||
|
Main.tile[i, j].type == ModContent.TileType<ShrineDoorOpened>()) ||
|
||||||
|
Main.tile[i, j].type == ModContent.TileType<RedHotSpike>() ||
|
||||||
|
Main.tile[i, j].type == ModContent.TileType<ShrineAltar>())
|
||||||
validBlockCount++;
|
validBlockCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (validBlockCount < 15)
|
if (validBlockCount < 15)
|
||||||
tooFarFromShrine = true;
|
tooFarFromShrine = true;
|
||||||
else
|
else
|
||||||
@ -130,7 +137,10 @@ namespace Decimation.Content.NPCs.Arachnus
|
|||||||
|
|
||||||
private void CheckEnraged()
|
private void CheckEnraged()
|
||||||
{
|
{
|
||||||
npc.ai[2] = !Main.player[npc.target].ZoneUnderworldHeight || !Collision.CanHit(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || CheckForShrine() ? 1 : 0;
|
npc.ai[2] = !Main.player[npc.target].ZoneUnderworldHeight ||
|
||||||
|
!Collision.CanHit(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || CheckForShrine()
|
||||||
|
? 1
|
||||||
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AI()
|
public override void AI()
|
||||||
@ -152,8 +162,8 @@ namespace Decimation.Content.NPCs.Arachnus
|
|||||||
// Normal ai
|
// Normal ai
|
||||||
if (npc.ai[0] == 0)
|
if (npc.ai[0] == 0)
|
||||||
{
|
{
|
||||||
float mouthX = (float)(((npc.height) / 2) * Math.Cos(npc.rotation - Math.PI * 0.5f)) + npc.Center.X;
|
float mouthX = (float) (((npc.height) / 2) * Math.Cos(npc.rotation - Math.PI * 0.5f)) + npc.Center.X;
|
||||||
float mouthY = (float)(((npc.height) / 2) * Math.Sin(npc.rotation - Math.PI * 0.5f)) + npc.Center.Y;
|
float mouthY = (float) (((npc.height) / 2) * Math.Sin(npc.rotation - Math.PI * 0.5f)) + npc.Center.Y;
|
||||||
|
|
||||||
//Counter
|
//Counter
|
||||||
if (npc.life <= npc.lifeMax / 2) counterMax = 1500;
|
if (npc.life <= npc.lifeMax / 2) counterMax = 1500;
|
||||||
@ -172,32 +182,39 @@ namespace Decimation.Content.NPCs.Arachnus
|
|||||||
npc.ai[1] = 1;
|
npc.ai[1] = 1;
|
||||||
}
|
}
|
||||||
// Increase speed
|
// Increase speed
|
||||||
else if (counter > 1320 && counter <= 1500 || (Main.expertMode && counter > 600 && counter < 800 && npc.life <= npc.lifeMax / 4))
|
else if (counter > 1320 && counter <= 1500 ||
|
||||||
|
(Main.expertMode && counter > 600 && counter < 800 && npc.life <= npc.lifeMax / 4))
|
||||||
{
|
{
|
||||||
if (counter == 1321)
|
if (counter == 1321)
|
||||||
{
|
{
|
||||||
Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0);
|
if (Main.netMode == NetmodeID.SinglePlayer)
|
||||||
if (Main.netMode == 2)
|
Main.PlaySound(SoundID.Roar, (int) npc.position.X, (int) npc.position.Y, 0);
|
||||||
GetPacket(ArachnusMessageType.RoarSound).Send();
|
if (Main.netMode == NetmodeID.Server) GetPacket(ArachnusMessageType.RoarSound).Send();
|
||||||
}
|
}
|
||||||
|
|
||||||
npc.ai[1] = 2;
|
npc.ai[1] = 2;
|
||||||
}
|
}
|
||||||
else npc.ai[1] = 99;
|
else npc.ai[1] = 99;
|
||||||
|
|
||||||
if (counter % 40 == 0 && npc.ai[1] == 0 && Main.netMode != 1)
|
if (counter % 40 == 0 && npc.ai[1] == 0 && Main.netMode != 1)
|
||||||
{
|
{
|
||||||
float speedX = (float)(6 * Math.Cos(npc.rotation - Math.PI * 0.5f)) * 2;
|
float speedX = (float) (6 * Math.Cos(npc.rotation - Math.PI * 0.5f)) * 2;
|
||||||
float speedY = (float)(6 * Math.Sin(npc.rotation - Math.PI * 0.5f)) * 2;
|
float speedY = (float) (6 * Math.Sin(npc.rotation - Math.PI * 0.5f)) * 2;
|
||||||
Projectile.NewProjectile(new Vector2(mouthX, mouthY), new Vector2(speedX, speedY), ModContent.ProjectileType<ArachnusFireball>(), 30, 0f);
|
Projectile.NewProjectile(new Vector2(mouthX, mouthY), new Vector2(speedX, speedY),
|
||||||
|
ModContent.ProjectileType<ArachnusFireball>(), 30, 0f);
|
||||||
}
|
}
|
||||||
else if (counter % 5 == 0 && npc.ai[1] == 1)
|
else if (counter % 5 == 0 && npc.ai[1] == 1)
|
||||||
{
|
{
|
||||||
if (Main.netMode != 1)
|
if (Main.netMode != 1)
|
||||||
{
|
{
|
||||||
float speedX = (float)(7 * Math.Cos(npc.rotation - Math.PI * 0.5f));
|
float speedX = (float) (7 * Math.Cos(npc.rotation - Math.PI * 0.5f));
|
||||||
float speedY = (float)(7 * Math.Sin(npc.rotation - Math.PI * 0.5f));
|
float speedY = (float) (7 * Math.Sin(npc.rotation - Math.PI * 0.5f));
|
||||||
Projectile.NewProjectile(new Vector2(mouthX, mouthY), new Vector2(speedX, speedY), npc.ai[2] == 1 ? ModContent.ProjectileType<BlastofShadowFlame>() : ModContent.ProjectileType<BlastofHeat>(), 30, 0f, 255);
|
Projectile.NewProjectile(new Vector2(mouthX, mouthY), new Vector2(speedX, speedY),
|
||||||
|
npc.ai[2] == 1
|
||||||
|
? ModContent.ProjectileType<BlastofShadowFlame>()
|
||||||
|
: ModContent.ProjectileType<BlastofHeat>(), 30, 0f, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
Main.PlaySound(SoundID.Item34, npc.position);
|
Main.PlaySound(SoundID.Item34, npc.position);
|
||||||
if (Main.netMode == 2)
|
if (Main.netMode == 2)
|
||||||
GetPacket(ArachnusMessageType.FlamesSound).Send();
|
GetPacket(ArachnusMessageType.FlamesSound).Send();
|
||||||
@ -245,6 +262,7 @@ namespace Decimation.Content.NPCs.Arachnus
|
|||||||
writer.Write(counterMax);
|
writer.Write(counterMax);
|
||||||
writer.Write(speed);
|
writer.Write(speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ReceiveExtraAI(BinaryReader reader)
|
public override void ReceiveExtraAI(BinaryReader reader)
|
||||||
{
|
{
|
||||||
counter = reader.ReadInt32();
|
counter = reader.ReadInt32();
|
||||||
@ -255,18 +273,19 @@ namespace Decimation.Content.NPCs.Arachnus
|
|||||||
private ModPacket GetPacket(ArachnusMessageType type)
|
private ModPacket GetPacket(ArachnusMessageType type)
|
||||||
{
|
{
|
||||||
ModPacket packet = mod.GetPacket();
|
ModPacket packet = mod.GetPacket();
|
||||||
packet.Write((byte)DecimationModMessageType.Arachnus);
|
packet.Write((byte) DecimationModMessageType.Arachnus);
|
||||||
packet.Write(npc.whoAmI);
|
packet.Write(npc.whoAmI);
|
||||||
packet.Write((byte)type);
|
packet.Write((byte) type);
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandlePacket(BinaryReader reader)
|
public void HandlePacket(BinaryReader reader)
|
||||||
{
|
{
|
||||||
ArachnusMessageType type = (ArachnusMessageType)reader.ReadByte();
|
ArachnusMessageType type = (ArachnusMessageType) reader.ReadByte();
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case ArachnusMessageType.RoarSound:
|
case ArachnusMessageType.RoarSound:
|
||||||
Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0);
|
Main.PlaySound(SoundID.Roar, (int) npc.position.X, (int) npc.position.Y, 0);
|
||||||
break;
|
break;
|
||||||
case ArachnusMessageType.FlamesSound:
|
case ArachnusMessageType.FlamesSound:
|
||||||
Main.PlaySound(SoundID.Item34, npc.position);
|
Main.PlaySound(SoundID.Item34, npc.position);
|
||||||
@ -280,6 +299,7 @@ namespace Decimation.Content.NPCs.Arachnus
|
|||||||
{
|
{
|
||||||
target.AddBuff(ModContent.BuffType<Hyperthermic>(), 900);
|
target.AddBuff(ModContent.BuffType<Hyperthermic>(), 900);
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnHitPlayer(target, damage, crit);
|
base.OnHitPlayer(target, damage, crit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +308,7 @@ namespace Decimation.Content.NPCs.Arachnus
|
|||||||
npc.frameCounter += 3f;
|
npc.frameCounter += 3f;
|
||||||
if (npc.frameCounter >= 40)
|
if (npc.frameCounter >= 40)
|
||||||
npc.frameCounter = 0;
|
npc.frameCounter = 0;
|
||||||
npc.frame.Y = ((int)npc.frameCounter / 10) * frameHeight;
|
npc.frame.Y = ((int) npc.frameCounter / 10) * frameHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void NPCLoot()
|
public override void NPCLoot()
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
using System.IO;
|
||||||
using Decimation.Content.Items.Misc.Souls;
|
using Decimation.Content.Items.Misc.Souls;
|
||||||
using Decimation.Lib.NPCs;
|
using Decimation.Lib.NPCs;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
@ -142,5 +143,35 @@ namespace Decimation.Content.NPCs.DuneWyrm.AncientTombCrawler
|
|||||||
npc.HitSound = SoundID.NPCHit1;
|
npc.HitSound = SoundID.NPCHit1;
|
||||||
undergroundSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Earthquake");
|
undergroundSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Earthquake");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void SendSoundPacket()
|
||||||
|
{
|
||||||
|
GetPacket(AncientTombCrawlerMessageType.UndergroundSound).Send();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ModPacket GetPacket(AncientTombCrawlerMessageType type)
|
||||||
|
{
|
||||||
|
ModPacket packet = mod.GetPacket();
|
||||||
|
packet.Write((byte) DecimationModMessageType.AncientTombCrawler);
|
||||||
|
packet.Write(npc.whoAmI);
|
||||||
|
packet.Write((byte) type);
|
||||||
|
return packet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HandlePacket(BinaryReader reader)
|
||||||
|
{
|
||||||
|
AncientTombCrawlerMessageType type = (AncientTombCrawlerMessageType) reader.ReadByte();
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case AncientTombCrawlerMessageType.UndergroundSound:
|
||||||
|
Main.PlaySound(undergroundSound, npc.Center);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum AncientTombCrawlerMessageType
|
||||||
|
{
|
||||||
|
UndergroundSound
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -15,7 +15,6 @@ namespace Decimation.Content.NPCs.DuneWyrm
|
|||||||
[AutoloadBossHead]
|
[AutoloadBossHead]
|
||||||
internal class DuneWyrmHead : DuneWyrm
|
internal class DuneWyrmHead : DuneWyrm
|
||||||
{
|
{
|
||||||
private int _attackCounter;
|
|
||||||
private int _previousTile = -1;
|
private int _previousTile = -1;
|
||||||
private bool _spawnedAncientTombCrawler;
|
private bool _spawnedAncientTombCrawler;
|
||||||
|
|
||||||
@ -65,12 +64,14 @@ namespace Decimation.Content.NPCs.DuneWyrm
|
|||||||
|
|
||||||
public override void SendExtraAI(BinaryWriter writer)
|
public override void SendExtraAI(BinaryWriter writer)
|
||||||
{
|
{
|
||||||
writer.Write(_attackCounter);
|
writer.Write(_previousTile);
|
||||||
|
writer.Write(_spawnedAncientTombCrawler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ReceiveExtraAI(BinaryReader reader)
|
public override void ReceiveExtraAI(BinaryReader reader)
|
||||||
{
|
{
|
||||||
_attackCounter = reader.ReadInt32();
|
_previousTile = reader.ReadInt32();
|
||||||
|
_spawnedAncientTombCrawler = reader.ReadBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void CustomBehavior()
|
public override void CustomBehavior()
|
||||||
@ -289,5 +290,35 @@ namespace Decimation.Content.NPCs.DuneWyrm
|
|||||||
npc.HitSound = SoundID.NPCHit1;
|
npc.HitSound = SoundID.NPCHit1;
|
||||||
undergroundSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Earthquake");
|
undergroundSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Earthquake");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void SendSoundPacket()
|
||||||
|
{
|
||||||
|
GetPacket(DuneWyrmMessageType.UndergroundSound).Send();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ModPacket GetPacket(DuneWyrmMessageType type)
|
||||||
|
{
|
||||||
|
ModPacket packet = mod.GetPacket();
|
||||||
|
packet.Write((byte) DecimationModMessageType.DuneWyrm);
|
||||||
|
packet.Write(npc.whoAmI);
|
||||||
|
packet.Write((byte) type);
|
||||||
|
return packet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HandlePacket(BinaryReader reader)
|
||||||
|
{
|
||||||
|
DuneWyrmMessageType type = (DuneWyrmMessageType) reader.ReadByte();
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case DuneWyrmMessageType.UndergroundSound:
|
||||||
|
Main.PlaySound(undergroundSound, npc.Center);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum DuneWyrmMessageType
|
||||||
|
{
|
||||||
|
UndergroundSound
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,12 +6,12 @@ namespace Decimation.Content.Projectiles
|
|||||||
{
|
{
|
||||||
protected override void Init()
|
protected override void Init()
|
||||||
{
|
{
|
||||||
this.projectile.CloneDefaults(ProjectileID.SpikyBall);
|
projectile.CloneDefaults(ProjectileID.SpikyBall);
|
||||||
this.projectile.damage = 30;
|
projectile.damage = 30;
|
||||||
this.projectile.width = 10;
|
projectile.width = 36;
|
||||||
this.projectile.height = 16;
|
projectile.height = 32;
|
||||||
this.projectile.friendly = false;
|
projectile.friendly = false;
|
||||||
this.projectile.hostile = true;
|
projectile.hostile = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 375 B After Width: | Height: | Size: 534 B |
@ -3,6 +3,7 @@ using Microsoft.Xna.Framework;
|
|||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Terraria;
|
using Terraria;
|
||||||
using Terraria.Audio;
|
using Terraria.Audio;
|
||||||
|
using Terraria.ID;
|
||||||
using Terraria.ModLoader;
|
using Terraria.ModLoader;
|
||||||
|
|
||||||
namespace Decimation.Lib.NPCs
|
namespace Decimation.Lib.NPCs
|
||||||
@ -232,9 +233,14 @@ namespace Decimation.Lib.NPCs
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!flies && npc.behindTiles && npc.soundDelay == 0)
|
if (!flies && npc.behindTiles && npc.soundDelay == 0)
|
||||||
|
{
|
||||||
|
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||||
{
|
{
|
||||||
npc.soundDelay = 120;
|
npc.soundDelay = 120;
|
||||||
|
|
||||||
Main.PlaySound(undergroundSound, npc.position);
|
Main.PlaySound(undergroundSound, npc.position);
|
||||||
|
if(Main.netMode == NetmodeID.Server) SendSoundPacket();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
num193 = (float) Math.Sqrt(num191 * num191 + num192 * num192);
|
num193 = (float) Math.Sqrt(num191 * num191 + num192 * num192);
|
||||||
@ -440,5 +446,7 @@ namespace Decimation.Lib.NPCs
|
|||||||
0f
|
0f
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract void SendSoundPacket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user