From 931dab6595e0aa6bd3649e6fa9ab17ad4d16c80f Mon Sep 17 00:00:00 2001 From: hamstar Date: Sun, 19 Nov 2017 17:00:51 -0800 Subject: [PATCH] v1.7.0.1 * Reverted class renaming; causes data loss --- API.cs | 12 ++++++------ Items/TownPortalScrollItem.cs | 2 +- NetProtocols/ClientPacketHandlers.cs | 4 ++-- NetProtocols/ServerPacketHandlers.cs | 6 +++--- Projectiles/ChaosBombProjectile.cs | 4 ++-- Wormholes.csproj | 4 ++-- Wormholes/WormholeLink.cs | 6 +++--- Wormholes/WormholeManager.cs | 2 +- WormholesMod.cs | 8 ++++---- MyPlayer.cs => WormholesPlayer.cs | 14 +++++++------- MyWorld.cs => WormholesWorld.cs | 6 +++--- build.txt | 2 +- 12 files changed, 35 insertions(+), 35 deletions(-) rename MyPlayer.cs => WormholesPlayer.cs (93%) rename MyWorld.cs => WormholesWorld.cs (93%) diff --git a/API.cs b/API.cs index 5100fab..30b8eee 100644 --- a/API.cs +++ b/API.cs @@ -16,7 +16,7 @@ public static WormholesConfigData GetModSettings() { public static bool WormholesFinishedSpawning { get { - var myworld = WormholesMod.Instance.GetModWorld(); + var myworld = WormholesMod.Instance.GetModWorld(); return myworld.Wormholes.WormholesFinishedSpawning; } } @@ -24,33 +24,33 @@ public static bool WormholesFinishedSpawning { //////////////// public static int GetWormholeCount() { - var myworld = WormholesMod.Instance.GetModWorld(); + var myworld = WormholesMod.Instance.GetModWorld(); return myworld.Wormholes.Links.Count; } public static IEnumerable GetWormholes() { - var myworld = WormholesMod.Instance.GetModWorld(); + var myworld = WormholesMod.Instance.GetModWorld(); return (IEnumerable)myworld.Wormholes.Links.GetEnumerator(); } //////////////// public static void RandomizeWormhole( WormholeLink link ) { - var myworld = WormholesMod.Instance.GetModWorld(); + var myworld = WormholesMod.Instance.GetModWorld(); myworld.Wormholes.Reroll( link ); } //////////////// public static void AddWormhole( Color color ) { - var myworld = WormholesMod.Instance.GetModWorld(); + var myworld = WormholesMod.Instance.GetModWorld(); var link = myworld.Wormholes.CreateRandomWormholePair( color ); myworld.Wormholes.Links.Add( link ); } public static void RemoveWormhole( WormholeLink link ) { - var myworld = WormholesMod.Instance.GetModWorld(); + var myworld = WormholesMod.Instance.GetModWorld(); if( myworld.Wormholes.Links.Remove( link ) ) { link.Close(); diff --git a/Items/TownPortalScrollItem.cs b/Items/TownPortalScrollItem.cs index 5258ae4..75a30e7 100644 --- a/Items/TownPortalScrollItem.cs +++ b/Items/TownPortalScrollItem.cs @@ -8,7 +8,7 @@ namespace Wormholes.Items { class TownPortalScrollItem : ModItem { public static void OpenPortal( WormholesMod mymod, Player player, Vector2 to, Vector2 fro ) { - MyPlayer modplayer = player.GetModPlayer( mymod ); + WormholesPlayer modplayer = player.GetModPlayer( mymod ); if( modplayer.MyPortal != null ) { modplayer.MyPortal.Close(); } diff --git a/NetProtocols/ClientPacketHandlers.cs b/NetProtocols/ClientPacketHandlers.cs index 48386d0..e316f0b 100644 --- a/NetProtocols/ClientPacketHandlers.cs +++ b/NetProtocols/ClientPacketHandlers.cs @@ -53,7 +53,7 @@ public static void SendWormholeRerollRequestViaClient( WormholesMod mymod, strin private static void ReceiveWormholesAndSettingsOnClient( WormholesMod mymod, BinaryReader reader ) { if( Main.netMode != 1 ) { return; } // Clients only - MyWorld modworld = mymod.GetModWorld(); + WormholesWorld modworld = mymod.GetModWorld(); string json = reader.ReadString(); int wormhole_count = reader.ReadInt32(); @@ -86,7 +86,7 @@ private static void ReceiveWormholeUpdateOnClient( WormholesMod mymod, BinaryRea Vector2 pos_l = new Vector2( worm_r_x, worm_l_y ); Vector2 pos_r = new Vector2( worm_l_x, worm_r_y ); - var mngr = mymod.GetModWorld().Wormholes; + var mngr = mymod.GetModWorld().Wormholes; var link = mngr.GetLinkById( id ); link.ChangePosition( pos_r, pos_l ); } diff --git a/NetProtocols/ServerPacketHandlers.cs b/NetProtocols/ServerPacketHandlers.cs index e73d7ff..d1870f0 100644 --- a/NetProtocols/ServerPacketHandlers.cs +++ b/NetProtocols/ServerPacketHandlers.cs @@ -30,7 +30,7 @@ public static void HandlePacket( WormholesMod mymod, BinaryReader reader, int pl public static void SendWormholesAndSettingsViaServer( WormholesMod mymod, Player player ) { if( Main.netMode != 2 ) { return; } // Server only - MyWorld modworld = mymod.GetModWorld(); + WormholesWorld modworld = mymod.GetModWorld(); ModPacket packet = mymod.GetPacket(); // Be sure our wormholes are ready to send (if not already) @@ -54,7 +54,7 @@ public static void SendWormholesAndSettingsViaServer( WormholesMod mymod, Player public static void BroadcastWormholeUpdateViaServer( WormholesMod mymod, string id ) { if( Main.netMode != 2 ) { return; } // Server only - MyWorld modworld = mymod.GetModWorld(); + WormholesWorld modworld = mymod.GetModWorld(); WormholeLink link = modworld.Wormholes.GetLinkById( id ); ModPacket packet = mymod.GetPacket(); @@ -87,7 +87,7 @@ private static void ReceiveWormholeRerollRequestOnServer( WormholesMod mymod, Bi return; } - var mngr = mymod.GetModWorld().Wormholes; + var mngr = mymod.GetModWorld().Wormholes; var link = mngr.GetLinkById( id ); mngr.Reroll( link ); diff --git a/Projectiles/ChaosBombProjectile.cs b/Projectiles/ChaosBombProjectile.cs index e8b6e73..04fa15b 100644 --- a/Projectiles/ChaosBombProjectile.cs +++ b/Projectiles/ChaosBombProjectile.cs @@ -37,8 +37,8 @@ public override bool CanDamage() { public override void AI() { var mymod = (WormholesMod)this.mod; - var modworld = this.mod.GetModWorld(); - var modplayer = Main.player[Main.myPlayer].GetModPlayer( this.mod ); + var modworld = this.mod.GetModWorld(); + var modplayer = Main.player[Main.myPlayer].GetModPlayer( this.mod ); var rect = this.projectile.getRect(); int rand = Main.rand.Next( mymod.Config.Data.ChaosBombWormholeCloseOdds ); var proj = this.projectile; diff --git a/Wormholes.csproj b/Wormholes.csproj index 2aa998a..c9145c3 100644 --- a/Wormholes.csproj +++ b/Wormholes.csproj @@ -68,9 +68,9 @@ - + - + diff --git a/Wormholes/WormholeLink.cs b/Wormholes/WormholeLink.cs index 02207dc..9dd146e 100644 --- a/Wormholes/WormholeLink.cs +++ b/Wormholes/WormholeLink.cs @@ -326,7 +326,7 @@ public void UpdateBehavior( WormholeModContext ctx, Player player ) { public bool IsCharted( WormholeModContext ctx, Player player ) { if( this.IsClosed ) { return false; } - MyPlayer modplayer = player.GetModPlayer( ctx.MyMod ); + WormholesPlayer modplayer = player.GetModPlayer( ctx.MyMod ); if( modplayer.MyPortal != null && this.ID == modplayer.MyPortal.ID ) { return true; @@ -353,7 +353,7 @@ public int DetectCollision( Rectangle rect ) { public void ApplyChaosHit( WormholeModContext ctx ) { if( Main.netMode == 0 ) { // Single - var mngr = ctx.MyMod.GetModWorld().Wormholes; + var mngr = ctx.MyMod.GetModWorld().Wormholes; mngr.Reroll( this ); } else { // Non-single ClientPacketHandlers.SendWormholeRerollRequestViaClient( ctx.MyMod, this.ID ); @@ -402,7 +402,7 @@ public void TeleportToRight( WormholeModContext ctx, Player player ) { private void Teleport( WormholeModContext ctx, Player player, Vector2 dest ) { - MyPlayer myplayer = player.GetModPlayer( ctx.MyMod ); + WormholesPlayer myplayer = player.GetModPlayer( ctx.MyMod ); if( myplayer.MyPortal == null || (myplayer.MyPortal != null && this.ID != myplayer.MyPortal.ID) ) { myplayer.ChartedLinks.Add( this.ID ); } diff --git a/Wormholes/WormholeManager.cs b/Wormholes/WormholeManager.cs index 3febc74..aeb6201 100644 --- a/Wormholes/WormholeManager.cs +++ b/Wormholes/WormholeManager.cs @@ -257,7 +257,7 @@ public void RunAll( WormholeModContext ctx, Player player ) { bool is_upon_a_portal = false; bool is_upon_my_portal = false; int block_countdown = this.BlockPortalCountdown[who]; - WormholeLink town_portal = player.GetModPlayer( ctx.MyMod ).MyPortal; + WormholeLink town_portal = player.GetModPlayer( ctx.MyMod ).MyPortal; if( !ctx.MyMod.Config.Data.DisableNaturalWormholes ) { for( int i = 0; i < this.Links.Count; i++ ) { diff --git a/WormholesMod.cs b/WormholesMod.cs index 838d574..57ecf4f 100644 --- a/WormholesMod.cs +++ b/WormholesMod.cs @@ -152,8 +152,8 @@ public override void PostDrawFullscreenMap( ref string mouseText ) { private void DrawMiniMap( SpriteBatch sb ) { this.UI.Update(); - MyWorld modworld = this.GetModWorld(); - MyPlayer curr_modplayer = Main.player[Main.myPlayer].GetModPlayer( this ); + WormholesWorld modworld = this.GetModWorld(); + WormholesPlayer curr_modplayer = Main.player[Main.myPlayer].GetModPlayer( this ); if( !this.Config.Data.DisableNaturalWormholes ) { if( modworld.Wormholes != null ) { @@ -183,8 +183,8 @@ private void DrawMiniMap( SpriteBatch sb ) { private void DrawFullMap( SpriteBatch sb ) { this.UI.Update(); - MyWorld modworld = this.GetModWorld(); - MyPlayer curr_modplayer = Main.player[Main.myPlayer].GetModPlayer( this ); + WormholesWorld modworld = this.GetModWorld(); + WormholesPlayer curr_modplayer = Main.player[Main.myPlayer].GetModPlayer( this ); if( !this.Config.Data.DisableNaturalWormholes ) { if( modworld.Wormholes != null ) { diff --git a/MyPlayer.cs b/WormholesPlayer.cs similarity index 93% rename from MyPlayer.cs rename to WormholesPlayer.cs index 21d2e2f..642506a 100644 --- a/MyPlayer.cs +++ b/WormholesPlayer.cs @@ -8,7 +8,7 @@ namespace Wormholes { - class MyPlayer : ModPlayer { + class WormholesPlayer : ModPlayer { public WormholeLink MyPortal; public ISet ChartedLinks { get; private set; } @@ -27,7 +27,7 @@ public override void Initialize() { public override void clientClone( ModPlayer clone ) { base.clientClone( clone ); - var myclone = (MyPlayer)clone; + var myclone = (WormholesPlayer)clone; myclone.MyPortal = this.MyPortal; myclone.ChartedLinks = this.ChartedLinks; @@ -39,7 +39,7 @@ public override void clientClone( ModPlayer clone ) { public override void Load( TagCompound tag ) { - var modworld = this.mod.GetModWorld(); + var modworld = this.mod.GetModWorld(); int wormholes = tag.GetInt( "wormholes_count" ); this.TownPortalRightPositions = new Dictionary(); @@ -67,7 +67,7 @@ public override void Load( TagCompound tag ) { } public override TagCompound Save() { - var modworld = this.mod.GetModWorld(); + var modworld = this.mod.GetModWorld(); string world_id = modworld.ID; var tags = new TagCompound { { "wormholes_count", (int)this.ChartedLinks.Count } @@ -115,7 +115,7 @@ public override void OnEnterWorld( Player player ) { if( player.whoAmI == this.player.whoAmI ) { // Current player var mymod = (WormholesMod)this.mod; - var modworld = this.mod.GetModWorld(); + var modworld = this.mod.GetModWorld(); if( !mymod.Config.LoadFile() ) { mymod.Config.SaveFile(); @@ -139,7 +139,7 @@ public override void OnEnterWorld( Player player ) { public void ReopenTownPortal() { var mymod = (WormholesMod)this.mod; - var modworld = this.mod.GetModWorld(); + var modworld = this.mod.GetModWorld(); string world_id = modworld.ID; if( this.TownPortalRightPositions.Keys.Contains( world_id ) ) { @@ -157,7 +157,7 @@ public override void PreUpdate() { if( Main.netMode == 2 ) { return; } // Not server var mymod = (WormholesMod)this.mod; - MyWorld modworld = mymod.GetModWorld(); + WormholesWorld modworld = mymod.GetModWorld(); if( modworld.Wormholes == null ) { return; } modworld.Wormholes.RunAll( mymod.Context, this.player ); diff --git a/MyWorld.cs b/WormholesWorld.cs similarity index 93% rename from MyWorld.cs rename to WormholesWorld.cs index 634ad43..d0d36c5 100644 --- a/MyWorld.cs +++ b/WormholesWorld.cs @@ -10,7 +10,7 @@ namespace Wormholes { - class MyWorld : ModWorld { + class WormholesWorld : ModWorld { public WormholeManager Wormholes { get; private set; } public string ID { get; private set; } @@ -68,7 +68,7 @@ public override void NetReceive( BinaryReader reader ) { this.HasCorrectID = has_correct_id; this.ID = id; - var modplayer = Main.player[Main.myPlayer].GetModPlayer( this.mod ); + var modplayer = Main.player[Main.myPlayer].GetModPlayer( this.mod ); if( modplayer.HasEnteredWorld && !modplayer.HasLoadedTownPortals ) { modplayer.ReopenTownPortal(); } @@ -93,7 +93,7 @@ public override void ModifyWorldGenTasks( List tasks, ref float totalWe public override void PostDrawTiles() { if( this.Wormholes == null ) { return; } - var myplayer = Main.player[Main.myPlayer].GetModPlayer( this.mod ); + var myplayer = Main.player[Main.myPlayer].GetModPlayer( this.mod ); var mymod = (WormholesMod)this.mod; //Main.spriteBatch.Begin(); diff --git a/build.txt b/build.txt index e5b16e8..521bb80 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = hamstar -version = 1.7.0 +version = 1.7.0.1 displayName = Wormholes modReferences = HamstarHelpers buildIgnore = *.csproj, *.user, obj\*, bin\*, .vs\*