Skip to content

Commit

Permalink
fix some magic numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
direwolf420 committed May 8, 2020
1 parent f929144 commit 03a50ca
Show file tree
Hide file tree
Showing 41 changed files with 66 additions and 65 deletions.
6 changes: 3 additions & 3 deletions AssWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static void DisappearMessage(string message)

public static void ToggleSlimeRainSky()
{
if (!Main.slimeRain && Main.netMode != 1)
if (!Main.slimeRain && Main.netMode != NetmodeID.MultiplayerClient)
{
if (!slimeRainSky)
{
Expand All @@ -138,7 +138,7 @@ public static void ToggleSlimeRainSky()

public static void DisableSlimeRainSky()
{
if (!Main.slimeRain && slimeRainSky && Main.netMode != 1)
if (!Main.slimeRain && slimeRainSky && Main.netMode != NetmodeID.MultiplayerClient)
{
SkyManager.Instance.Deactivate("Slime");
CombatText.NewText(Main.LocalPlayer.getRect(), CombatText.DamagedFriendly, "Background Deactivated");
Expand Down Expand Up @@ -173,7 +173,7 @@ private void LimitSoulCount()
oldestnpc.netUpdate = true;
if (Main.netMode == NetmodeID.Server && oldest < Main.maxNPCs)
{
NetMessage.SendData(23, -1, -1, null, oldest);
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, oldest);
}
//poof visual
for (int i = 0; i < 15; i++)
Expand Down
16 changes: 8 additions & 8 deletions AssortedCrazyThings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private void LoadWormList()

private void LoadUI()
{
if (!Main.dedServ && Main.netMode != 2)
if (!Main.dedServ && Main.netMode != NetmodeID.Server)
{
CircleUI = new CircleUI();
CircleUI.Activate();
Expand Down Expand Up @@ -162,7 +162,7 @@ private void LoadUI()

private void UnloadUI()
{
if (!Main.dedServ && Main.netMode != 2)
if (!Main.dedServ && Main.netMode != NetmodeID.Server)
{
CircleUIInterface = null;
CircleUI = null;
Expand Down Expand Up @@ -191,7 +191,7 @@ private void UnloadUI()
private void LoadPets()
{
SlimePets.Load();
if (!Main.dedServ && Main.netMode != 2)
if (!Main.dedServ && Main.netMode != NetmodeID.Server)
{
PetAccessory.Load();
}
Expand All @@ -200,15 +200,15 @@ private void LoadPets()
private void UnloadPets()
{
SlimePets.Unload();
if (!Main.dedServ && Main.netMode != 2)
if (!Main.dedServ && Main.netMode != NetmodeID.Server)
{
PetAccessory.Unload();
}
}

private void LoadMisc()
{
if (!Main.dedServ && Main.netMode != 2)
if (!Main.dedServ && Main.netMode != NetmodeID.Server)
{
animatedSoulTextures = new Texture2D[2];

Expand All @@ -227,7 +227,7 @@ private void LoadMisc()

private void UnloadMisc()
{
if (!Main.dedServ && Main.netMode != 2)
if (!Main.dedServ && Main.netMode != NetmodeID.Server)
{
animatedSoulTextures = null;

Expand Down Expand Up @@ -824,7 +824,7 @@ public override void HandlePacket(BinaryReader reader, int whoAmI)
DungeonSoulBase.KillInstantly(npc);
if (npcNumber < Main.maxNPCs)
{
NetMessage.SendData(23, -1, -1, null, npcNumber);
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npcNumber);
}
}
else
Expand All @@ -837,7 +837,7 @@ public override void HandlePacket(BinaryReader reader, int whoAmI)
DungeonSoulBase.KillInstantly(other);
if (k < Main.maxNPCs)
{
NetMessage.SendData(23, -1, -1, null, k);
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, k);
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion Base/AssHooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private static void NPC_CatchNPC(On.Terraria.NPC.orig_CatchNPC orig, int i, int
if (npc.active && npc.modNPC != null && npc.modNPC is CuteSlimeBaseNPC)
{
CuteSlimeBaseNPC slime = (CuteSlimeBaseNPC)npc.modNPC;
if (Main.netMode == 1)
if (Main.netMode == NetmodeID.MultiplayerClient)
{
npc.active = false;
NetMessage.SendData(MessageID.BugCatching, -1, -1, null, i, who, 0f, 0f, 0, 0, 0);
Expand Down
2 changes: 1 addition & 1 deletion Base/AssUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ public static int NewProjectile(float X, float Y, float SpeedX, float SpeedY, in

preSync?.Invoke(projectile);

if (Main.netMode != 0)
if (Main.netMode != NetmodeID.SinglePlayer)
{
NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, index);
}
Expand Down
2 changes: 1 addition & 1 deletion Items/AssGlobalItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public override bool CanUseItem(Item item, Player player)
if (item.melee)
{
//TODO do something with auto-fire boomerangs
if (item.shoot > 0 && item.shootSpeed > 0)
if (item.shoot > ProjectileID.None && item.shootSpeed > 0)
{
ShootCandleDust(item, mPlayer);
}
Expand Down
2 changes: 1 addition & 1 deletion Items/CaughtDungeonSoul.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override void MoreSetDefaults()
{
frame2CounterCount = 8.0;
animatedTextureSelect = 0;
item.useStyle = 1;
item.useStyle = ItemUseStyleID.SwingThrow;
item.autoReuse = true;
item.useTurn = true;
item.useAnimation = 15;
Expand Down
4 changes: 2 additions & 2 deletions Items/Fun/GuideVoodoorang.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ public override void PostUpdate()
{
if (Main.netMode == NetmodeID.Server)
{
NetMessage.SendData(28, -1, -1, null, i, 9999f, 10f, 0f - (float)npc.direction);
NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, i, 9999f, 10f, 0f - (float)npc.direction);
}
npc.StrikeNPCNoInteraction(9999, 10f, -npc.direction);
NPC.SpawnWOF(item.position);

//despawns upon wof spawn
item.TurnToAir();
NetMessage.SendData(21, -1, -1, null, item.whoAmI);
NetMessage.SendData(MessageID.SyncItem, -1, -1, null, item.whoAmI);
byte plr = Player.FindClosest(item.position, item.width, item.height);
Item.NewItem(Main.player[plr].getRect(), ModContent.ItemType<GuideVoodoorang>());
}
Expand Down
2 changes: 1 addition & 1 deletion Items/Fun/InfinityRocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public override void SetDefaults()
item.CloneDefaults(ItemID.EndlessMusketPouch);
item.ammo = AmmoID.Rocket;
item.rare = -11;
item.shoot = 0;
item.shoot = ProjectileID.None;
item.damage = 40;
item.UseSound = SoundID.Item11;
//item.shoot = ProjectileID.RocketII;
Expand Down
4 changes: 2 additions & 2 deletions Items/IdolOfDecay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override void SetDefaults()
item.rare = -11;
item.useAnimation = 45;
item.useTime = 45;
item.useStyle = 4;
item.useStyle = ItemUseStyleID.HoldingUp;
item.value = Item.sellPrice(silver: 5);
item.UseSound = SoundID.Item44;
item.consumable = true;
Expand All @@ -42,7 +42,7 @@ public override bool UseItem(Player player)
AssWorld.AwakeningMessage("Soul Harvester has been Awakened!");
if (Main.netMode == NetmodeID.Server && i < Main.maxNPCs)
{
NetMessage.SendData(23, -1, -1, null, i);
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, i);
}
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions Items/OrigamiManual.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public override void SetDefaults()
item.rare = -11;
item.useAnimation = 45;
item.useTime = 45;
item.useStyle = 4;
item.useStyle = ItemUseStyleID.HoldingUp;
item.UseSound = SoundID.Item44;
item.consumable = true;
item.value = Item.sellPrice(silver: 10);
Expand All @@ -46,7 +46,7 @@ public override bool UseItem(Player player)
npc.velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f;
if (Main.netMode == NetmodeID.Server && index < Main.maxNPCs)
{
NetMessage.SendData(23, -1, -1, null, index);
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, index);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Items/PetAccessories/PetAccessoryClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ public override void SetDefaults()
item.rare = -11;
item.useAnimation = 16;
item.useTime = 16;
item.useStyle = 4;
item.useStyle = ItemUseStyleID.HoldingUp;
item.UseSound = SoundID.Item1;
item.consumable = false;
item.value = Item.sellPrice(silver: 30);
Expand Down
2 changes: 1 addition & 1 deletion Items/Placeable/CuteSlimeStatueItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public override void SetDefaults()
item.autoReuse = true;
item.useAnimation = 15;
item.useTime = 10;
item.useStyle = 1;
item.useStyle = ItemUseStyleID.SwingThrow;
item.consumable = true;
item.rare = -11;
item.value = Item.sellPrice(0, 0, 0, 60);
Expand Down
2 changes: 1 addition & 1 deletion Items/Placeable/SlimeBeaconItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override void SetDefaults()
item.autoReuse = true;
item.useAnimation = 15;
item.useTime = 10;
item.useStyle = 1;
item.useStyle = ItemUseStyleID.SwingThrow;
item.consumable = true;
item.rare = -11;
item.value = Item.buyPrice(0, 10, 0, 0);
Expand Down
2 changes: 1 addition & 1 deletion Items/Placeable/VanityDresserItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override void SetDefaults()
item.autoReuse = true;
item.useAnimation = 15;
item.useTime = 15;
item.useStyle = 1;
item.useStyle = ItemUseStyleID.SwingThrow;
item.consumable = true;
item.value = Item.sellPrice(silver: 10);
item.rare = -11;
Expand Down
2 changes: 1 addition & 1 deletion Items/Placeable/WyvernCampfireItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public override void SetDefaults()
item.autoReuse = true;
item.useAnimation = 15;
item.useTime = 10;
item.useStyle = 1;
item.useStyle = ItemUseStyleID.SwingThrow;
item.consumable = true;
item.rare = -11;
item.value = Item.buyPrice(0, 10, 0, 0);
Expand Down
2 changes: 1 addition & 1 deletion Items/Tools/ExtendoNetBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public abstract class ExtendoNetBase : ModItem
{
public override void SetDefaults()
{
item.useStyle = 5;
item.useStyle = ItemUseStyleID.HoldingOut;
item.shootSpeed = 3.7f;
item.width = 40;
item.height = 40;
Expand Down
2 changes: 1 addition & 1 deletion Items/Weapons/BreathOfSpazmatism.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override void SetDefaults()
item.useAmmo = AmmoID.Gel;
item.useTime = 3; //adjusted from 10 to 3 to match spazmatism speed
item.useAnimation = 3; //^
item.useStyle = 5;
item.useStyle = ItemUseStyleID.HoldingOut;
item.value = Item.sellPrice(gold: 15, silver: 20);
item.rare = -11;
item.autoReuse = true;
Expand Down
2 changes: 1 addition & 1 deletion Items/Weapons/DroneController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public override void SetDefaults()
item.height = 30;
item.useTime = 36;
item.useAnimation = 36;
item.useStyle = 4;
item.useStyle = ItemUseStyleID.HoldingUp;
item.noMelee = true;
item.noUseGraphic = true;
item.value = Item.sellPrice(0, 0, 75, 0);
Expand Down
2 changes: 1 addition & 1 deletion Items/Weapons/EverglowLantern.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public override void SetDefaults()
item.height = 38;
item.useTime = 36;
item.useAnimation = 36;
item.useStyle = 4; //4 for life crystal
item.useStyle = ItemUseStyleID.HoldingUp; //4 for life crystal
item.noMelee = true;
item.value = Item.sellPrice(0, 0, 75, 0);
item.rare = -11;
Expand Down
2 changes: 1 addition & 1 deletion Items/Weapons/EverhallowedLantern.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public override void SetDefaults()
item.height = 40;
item.useTime = 30;
item.useAnimation = 30;
item.useStyle = 4; //4 for life crystal
item.useStyle = ItemUseStyleID.HoldingUp; //4 for life crystal
item.noMelee = true;
item.value = Item.sellPrice(0, 0, 95, 0);
item.rare = -11;
Expand Down
2 changes: 1 addition & 1 deletion Items/Weapons/PlagueOfToads.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override void SetDefaults()

item.mana = 20;
item.damage = 8;
item.useStyle = 1;
item.useStyle = ItemUseStyleID.SwingThrow;
item.shootSpeed = 16f;
item.shoot = ModContent.ProjectileType<PlagueOfToadsFired>();
item.width = 26;
Expand Down
2 changes: 1 addition & 1 deletion Items/Weapons/SlimeHandlerKnapsack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public override void SetDefaults()
item.height = 30;
item.useTime = 36;
item.useAnimation = 36;
item.useStyle = 4; //4 for life crystal
item.useStyle = ItemUseStyleID.HoldingUp; //4 for life crystal
item.noMelee = true;
item.noUseGraphic = true;
item.value = Item.sellPrice(0, 0, 75, 0);
Expand Down
2 changes: 1 addition & 1 deletion NPCs/AssGlobalNPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public override void NPCLoot(NPC npc)
Main.npc[soulID].timeLeft = DungeonSoulBase.SoulActiveTime;
if (Main.netMode == NetmodeID.Server)
{
NetMessage.SendData(23, -1, -1, null, soulID);
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, soulID);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion NPCs/Bass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public override void AI()
{
if (npc.velocity.Y == 0f)
{
if (Main.netMode != 1)
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.velocity.Y = (float)Main.rand.Next(-50, -20) * 0.1f;
npc.velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f;
Expand Down
2 changes: 1 addition & 1 deletion NPCs/Bladetongue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public override void AI()
{
if (npc.velocity.Y == 0f)
{
if (Main.netMode != 1)
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.velocity.Y = (float)Main.rand.Next(-50, -20) * 0.1f;
npc.velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f;
Expand Down
2 changes: 1 addition & 1 deletion NPCs/BloatedBaitThief.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public override void AI()
{
if (npc.velocity.Y == 0f)
{
if (Main.netMode != 1)
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.velocity.Y = (float)Main.rand.Next(-50, -20) * 0.1f;
npc.velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f;
Expand Down
2 changes: 1 addition & 1 deletion NPCs/Chunky.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public override void NPCLoot()
int i = NPC.NewNPC((int)npc.position.X, (int)npc.position.Y - 16, mod.NPCType("ChunkysEye"));
if (Main.netMode == NetmodeID.Server && i < Main.maxNPCs)
{
NetMessage.SendData(23, -1, -1, null, i);
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, i);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion NPCs/Cloudfish.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public override void AI()
{
if (npc.velocity.Y == 0f)
{
if (Main.netMode != 1)
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.velocity.Y = (float)Main.rand.Next(-50, -20) * 0.1f;
npc.velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f;
Expand Down
2 changes: 1 addition & 1 deletion NPCs/CrystalSerpent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public override void AI()
{
if (npc.velocity.Y == 0f)
{
if (Main.netMode != 1)
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.velocity.Y = (float)Main.rand.Next(-50, -20) * 0.1f;
npc.velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f;
Expand Down
8 changes: 4 additions & 4 deletions NPCs/DungeonBird/Harvester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,19 +416,19 @@ public override void AI()
AssWorld.harvesterIndex = npc.whoAmI;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0);
Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0);
int index1 = NPC.NewNPC((int)npc.Center.X + TalonOffsetLeftX, (int)npc.Center.Y + TalonOffsetY, AssWorld.harvesterTalonLeft);
int index2 = NPC.NewNPC((int)npc.Center.X + TalonOffsetRightX, (int)npc.Center.Y + TalonOffsetY, AssWorld.harvesterTalonRight);

if (Main.netMode == NetmodeID.Server)
{
if (index1 < Main.maxNPCs)
{
NetMessage.SendData(23, -1, -1, null, index1);
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, index1);
}
if (index2 < Main.maxNPCs)
{
NetMessage.SendData(23, -1, -1, null, index2);
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, index2);
}
}
}
Expand All @@ -444,7 +444,7 @@ public override void AI()
if (npc.alpha < 4)
{
npc.alpha = 0;
if (Main.netMode != 1)
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.netUpdate = true;
}
Expand Down
Loading

0 comments on commit 03a50ca

Please sign in to comment.