Skip to content

Commit

Permalink
v1.1.3.5 - Added tile section cache resets between games (needed?)
Browse files Browse the repository at this point in the history
  • Loading branch information
hamstar0 committed Apr 26, 2020
1 parent cf24be7 commit 00ccbfe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions MountedMagicMirrors/MyMod.cs
Expand Up @@ -9,6 +9,7 @@
using HamstarHelpers.Classes.Tiles.TilePattern;
using HamstarHelpers.Helpers.Debug;
using HamstarHelpers.Helpers.TModLoader.Mods;
using HamstarHelpers.Services.Hooks.LoadHooks;
using HamstarHelpers.Services.Network;
using MountedMagicMirrors.Tiles;

Expand Down Expand Up @@ -69,6 +70,11 @@ partial class MountedMagicMirrorsMod : Mod {
//

Client.SubscribeToTileSectionPackets( onTileSectionPacketGet );

LoadHooks.AddPostWorldUnloadEachHook( () => {
var myworld = ModContent.GetInstance<MMMWorld>();
myworld?.UnregisterTileSections();
} );
}

public override void Unload() {
Expand Down
10 changes: 9 additions & 1 deletion MountedMagicMirrors/MyWorld_TileSectionMap.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using Terraria;
using Terraria.ModLoader;
using HamstarHelpers.Helpers.Debug;
Expand All @@ -8,7 +9,7 @@

namespace MountedMagicMirrors {
partial class MMMWorld : ModWorld {
private IDictionary<int, ISet<int>> TileSectionMapByTile = new Dictionary<int, ISet<int>>();
private IDictionary<int, ISet<int>> TileSectionMapByTile = new ConcurrentDictionary<int, ISet<int>>();



Expand All @@ -29,5 +30,12 @@ partial class MMMWorld : ModWorld {

return this.TileSectionMapByTile.Contains2D( sectionX, sectionY );
}


////////////////

public void UnregisterTileSections() {
this.TileSectionMapByTile.Clear();
}
}
}
2 changes: 1 addition & 1 deletion MountedMagicMirrors/build.txt
@@ -1,6 +1,6 @@
displayName = Mounted Magic Mirrors
author = hamstar
version = 1.1.3.4
version = 1.1.3.5
modReferences = HamstarHelpers@5.6.1.1
buildIgnore = *.csproj, *.user, *.bat, obj\*, bin\*, .vs\*, .git\*
homepage = https://forums.terraria.org/index.php?threads/mounted-magic-mirrors-fast-travel.83296/

0 comments on commit 00ccbfe

Please sign in to comment.