public override void NetReceive(BinaryReader reader, bool lightReceive) { //PathOfModifiers.Instance.Logger.Info($"NetReceive: {Main.netMode}"); var newTimeLeft = reader.ReadInt32(); bool isBoundsNull = reader.ReadBoolean(); var newBounds = isBoundsNull ? null : (Rectangle?)reader.ReadRectangle(); mapItem = ItemIO.Receive(reader, true); if (timeLeft == 0 && newTimeLeft != 0) { MapBorder.AddActiveBounds(newBounds.Value); } else if (timeLeft != 0 && newTimeLeft == 0) { MapBorder.RemoveActiveBounds(bounds.Value); } timeLeft = newTimeLeft; bounds = newBounds; if (Main.netMode == NetmodeID.MultiplayerClient) { if (MapDevice.activeMD?.Position == Position) { MapDeviceUI.ShowUI(this); } } }
//Should never run on a client. public void CloseMap() { //PathOfModifiers.Instance.Logger.Info($"CloseMap: {Main.netMode}"); if (!CanClose()) { return; } timeLeft = 0; Items.Map mapModItem = ((Items.Map)mapItem.modItem); Rectangle dimensions = new Rectangle(bounds.Value.X + 1, bounds.Value.Y + 1, bounds.Value.Width - 2, bounds.Value.Height - 2); var map = mapModItem.map; map.Close(); MapBorder.RemoveActiveBounds(bounds.Value); SendToClients(); }