// Called before AI is run public override bool PreAI(Projectile projectile) { // Disable tombstones if (CrowdControlMod._server != null && ((Main.netMode != Terraria.ID.NetmodeID.Server && CCServer._disableTombstones) || Main.netMode == Terraria.ID.NetmodeID.Server) && m_graves.Contains(projectile.type)) { if (Main.netMode == Terraria.ID.NetmodeID.Server) { try { CCPlayer player = Main.player[projectile.owner].GetModPlayer <CCPlayer>(); if (player.m_servDisableTombstones) { projectile.active = false; NetMessage.SendData(Terraria.ID.MessageID.SyncNPC, -1, player.player.whoAmI, null, projectile.whoAmI); TDebug.WriteDebug("Server disabled " + player.player.name + "'s tombstone", Color.Yellow); return(false); } } catch { } } else { projectile.active = false; TDebug.WriteDebug("Client disabled tombstone", Color.Yellow); return(false); } } return(base.PreAI(projectile)); }
// Set whether to allow the player to hurt town NPCs public static void SetTownNPCMayhem(bool notFriendly) { for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active && Main.npc[i].townNPC && Main.npc[i].friendly == notFriendly) { Main.npc[i].friendly = !notFriendly; if (Main.netMode == Terraria.ID.NetmodeID.Server) { NetMessage.SendData(Terraria.ID.MessageID.SyncNPC, -1, -1, null, i); } if (notFriendly) { Main.npc[i].AddBuff(Terraria.ID.BuffID.Stinky, 60 * CrowdControlMod._server.m_timeDrunkScreen); Main.npc[i].AddBuff(Terraria.ID.BuffID.Slimed, 60 * CrowdControlMod._server.m_timeDrunkScreen); } } } TDebug.WriteDebug("Town mayhem: " + notFriendly + ".", Color.Yellow); }