Skip to content

Commit f2073db

Browse files
author
hamstar0
committed
v1.2.1 - Removed net code (wtf!)
1 parent 51e9e46 commit f2073db

File tree

5 files changed

+5
-196
lines changed

5 files changed

+5
-196
lines changed

MountedMagicMirrors/MyCustomPlayer.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

MountedMagicMirrors/MyPlayer.cs

Lines changed: 4 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using ModLibsCore.Libraries.DotNET.Extensions;
1010
using ModLibsCore.Libraries.TModLoader;
1111
using ModLibsCore.Libraries.World;
12-
using MountedMagicMirrors.Net;
1312
using MountedMagicMirrors.DataStructures;
1413

1514

@@ -51,97 +50,15 @@ public DiscoveredMirrors CurrentWorldDiscoveredMirrorTiles {
5150

5251

5352

54-
////////////////
55-
56-
internal void OnCurrentClientEnter() {
57-
PlayerDataProtocol.Broadcast( this.DiscoveredMirrorTilesPerWorld );
58-
}
59-
60-
/*public override void SyncPlayer( int toWho, int fromWho, bool newPlayer ) {
61-
if( Main.netMode == 1 ) {
62-
if( newPlayer ) {
63-
//PlayerDataProtocol.SendToServer( this.DiscoveredMirrorTilesPerWorld );
64-
PlayerDataProtocol.Broadcast( this.DiscoveredMirrorTilesPerWorld );
65-
}
66-
} else {
67-
//PlayerDataProtocol.SendToClients( toWho, fromWho, this.DiscoveredMirrorTilesPerWorld );
68-
}
69-
}*/
70-
71-
public override void clientClone( ModPlayer clientClone ) {
72-
var myclone = (MMMPlayer)clientClone;
73-
74-
myclone._CurrentWorldDiscoveredMirrorTiles = null;
75-
76-
foreach( (string worldUid, DiscoveredMirrors mirrors) in this.DiscoveredMirrorTilesPerWorld ) {
77-
myclone.DiscoveredMirrorTilesPerWorld[worldUid] = new DiscoveredMirrors();
78-
79-
foreach( (int tileX, ISet<int> tileYs) in mirrors ) {
80-
myclone.DiscoveredMirrorTilesPerWorld[worldUid][tileX] = new HashSet<int>( tileYs );
81-
}
82-
}
83-
}
84-
85-
////////////////
86-
87-
public override void SendClientChanges( ModPlayer clientPlayer ) {
88-
if( clientPlayer.player.whoAmI != Main.myPlayer ) {
89-
return;
90-
}
91-
92-
var myclone = (MMMPlayer)clientPlayer;
93-
var thisDict = this.DiscoveredMirrorTilesPerWorld;
94-
var thatDict = myclone.DiscoveredMirrorTilesPerWorld;
95-
96-
if( !DiscoveredMirrors.WorldMirrorsEquals(thisDict, thatDict) ) {
97-
if( Main.netMode == NetmodeID.MultiplayerClient ) {
98-
PlayerDataProtocol.Broadcast( this.DiscoveredMirrorTilesPerWorld );
99-
}
100-
else {
101-
//PlayerDataProtocol.SendToClients( -1, -1, this.DiscoveredMirrorTilesPerWorld );
102-
}
103-
}
104-
}
105-
106-
10753
////////////////
10854

10955
public override void Load( TagCompound tag ) {
110-
int count = 0;
56+
this.DiscoveredMirrorTilesPerWorld.Clear();
11157

11258
if( !tag.ContainsKey("world_count") ) {
113-
if( tag.ContainsKey( "discovery_count" ) ) {
114-
this.DiscoveredMirrorTilesPerWorld.Clear();
115-
count = this.LoadOld( tag );
116-
}
117-
} else {
118-
this.DiscoveredMirrorTilesPerWorld.Clear();
119-
count = this.LoadNew( tag );
120-
}
121-
122-
LogLibraries.Log( "Loaded "+count+" discovered mirrors for "+this.player.name+" ("+this.player.whoAmI+")" );
123-
}
124-
125-
private int LoadOld( TagCompound tag ) {
126-
int count = tag.GetInt( "discovery_count" );
127-
128-
this.DiscoveredMirrorTilesPerWorld["_"] = new DiscoveredMirrors();
129-
130-
for( int i = 0; i < count; i++ ) {
131-
int tileX = tag.GetInt( "discovery_x_" + i );
132-
int tileY = tag.GetInt( "discovery_y_" + i );
133-
134-
this.DiscoveredMirrorTilesPerWorld["_"].Set2D( tileX, tileY );
135-
136-
if( MMMConfig.Instance.DebugModeInfo ) {
137-
LogLibraries.Log( "(Old) Loaded mirror at " + tileX + ", " + tileY );
138-
}
59+
return;
13960
}
14061

141-
return count;
142-
}
143-
144-
private int LoadNew( TagCompound tag ) {
14562
int worldCount = tag.GetInt( "world_count" );
14663
int totalMirrorCount = 0;
14764

@@ -165,7 +82,7 @@ private int LoadNew( TagCompound tag ) {
16582
totalMirrorCount += mirrorCount;
16683
}
16784

168-
return totalMirrorCount;
85+
LogLibraries.Log( "Loaded "+totalMirrorCount+" discovered mirrors for "+this.player.name+" ("+this.player.whoAmI+")" );
16986
}
17087

17188

@@ -184,6 +101,7 @@ public override TagCompound Save() {
184101
string myWorldUid = worldUid;
185102
if( worldUid == "_" ) {
186103
myWorldUid = WorldIdentityLibraries.GetUniqueIdForCurrentWorld( true );
104+
187105
if( MMMConfig.Instance.DebugModeInfo ) {
188106
LogLibraries.Log( "Saving for world UID " + myWorldUid );
189107
}

MountedMagicMirrors/MyPlayer_Mirrors.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Collections.Concurrent;
43
using System.Linq;
54
using Microsoft.Xna.Framework;
65
using Terraria;
@@ -10,7 +9,6 @@
109
using ModLibsGeneral.Libraries.Players;
1110
using ModLibsTiles.Libraries.Tiles;
1211
using MountedMagicMirrors.Tiles;
13-
using MountedMagicMirrors.DataStructures;
1412

1513

1614
namespace MountedMagicMirrors {
@@ -51,12 +49,6 @@ partial class MMMPlayer : ModPlayer {
5149

5250
////
5351

54-
internal void SetDiscoveredMirrorsFromNetwork( ConcurrentDictionary<string, DiscoveredMirrors> mirrors ) {
55-
this.DiscoveredMirrorTilesPerWorld = mirrors;
56-
}
57-
58-
////
59-
6052
public void ClearInvalidMirrorDiscoveries() {
6153
if( this.CurrentWorldDiscoveredMirrorTiles == null ) {
6254
return;

MountedMagicMirrors/Net/PlayerData.cs

Lines changed: 0 additions & 83 deletions
This file was deleted.

MountedMagicMirrors/build.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
displayName = Mounted Magic Mirrors
22
author = hamstar
3-
version = 1.2.0
3+
version = 1.2.1
44
modReferences = ModLibsCore@1.0.0, ModLibsGeneral@1.0.0, ModLibsNet@1.0.0, ModLibsTiles@1.0.0
55
buildIgnore = *.csproj, *.user, *.bat, obj\*, bin\*, .vs\*, .git\*
66
homepage = https://forums.terraria.org/index.php?threads/mounted-magic-mirrors-fast-travel.83296/

0 commit comments

Comments
 (0)