Skip to content

Commit

Permalink
v1.7.0.1
Browse files Browse the repository at this point in the history
* Reverted class renaming; causes data loss
  • Loading branch information
hamstar committed Nov 20, 2017
1 parent 29d62cf commit 931dab6
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 35 deletions.
12 changes: 6 additions & 6 deletions API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,41 @@ public static WormholesConfigData GetModSettings() {

public static bool WormholesFinishedSpawning {
get {
var myworld = WormholesMod.Instance.GetModWorld<MyWorld>();
var myworld = WormholesMod.Instance.GetModWorld<WormholesWorld>();
return myworld.Wormholes.WormholesFinishedSpawning;
}
}

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

public static int GetWormholeCount() {
var myworld = WormholesMod.Instance.GetModWorld<MyWorld>();
var myworld = WormholesMod.Instance.GetModWorld<WormholesWorld>();
return myworld.Wormholes.Links.Count;
}

public static IEnumerable<WormholeLink> GetWormholes() {
var myworld = WormholesMod.Instance.GetModWorld<MyWorld>();
var myworld = WormholesMod.Instance.GetModWorld<WormholesWorld>();
return (IEnumerable<WormholeLink>)myworld.Wormholes.Links.GetEnumerator();
}

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

public static void RandomizeWormhole( WormholeLink link ) {
var myworld = WormholesMod.Instance.GetModWorld<MyWorld>();
var myworld = WormholesMod.Instance.GetModWorld<WormholesWorld>();
myworld.Wormholes.Reroll( link );
}

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

public static void AddWormhole( Color color ) {
var myworld = WormholesMod.Instance.GetModWorld<MyWorld>();
var myworld = WormholesMod.Instance.GetModWorld<WormholesWorld>();
var link = myworld.Wormholes.CreateRandomWormholePair( color );

myworld.Wormholes.Links.Add( link );
}

public static void RemoveWormhole( WormholeLink link ) {
var myworld = WormholesMod.Instance.GetModWorld<MyWorld>();
var myworld = WormholesMod.Instance.GetModWorld<WormholesWorld>();

if( myworld.Wormholes.Links.Remove( link ) ) {
link.Close();
Expand Down
2 changes: 1 addition & 1 deletion Items/TownPortalScrollItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<MyPlayer>( mymod );
WormholesPlayer modplayer = player.GetModPlayer<WormholesPlayer>( mymod );
if( modplayer.MyPortal != null ) {
modplayer.MyPortal.Close();
}
Expand Down
4 changes: 2 additions & 2 deletions NetProtocols/ClientPacketHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<MyWorld>();
WormholesWorld modworld = mymod.GetModWorld<WormholesWorld>();
string json = reader.ReadString();
int wormhole_count = reader.ReadInt32();

Expand Down Expand Up @@ -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<MyWorld>().Wormholes;
var mngr = mymod.GetModWorld<WormholesWorld>().Wormholes;
var link = mngr.GetLinkById( id );
link.ChangePosition( pos_r, pos_l );
}
Expand Down
6 changes: 3 additions & 3 deletions NetProtocols/ServerPacketHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<MyWorld>();
WormholesWorld modworld = mymod.GetModWorld<WormholesWorld>();
ModPacket packet = mymod.GetPacket();

// Be sure our wormholes are ready to send (if not already)
Expand All @@ -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<MyWorld>();
WormholesWorld modworld = mymod.GetModWorld<WormholesWorld>();
WormholeLink link = modworld.Wormholes.GetLinkById( id );
ModPacket packet = mymod.GetPacket();

Expand Down Expand Up @@ -87,7 +87,7 @@ private static void ReceiveWormholeRerollRequestOnServer( WormholesMod mymod, Bi
return;
}

var mngr = mymod.GetModWorld<MyWorld>().Wormholes;
var mngr = mymod.GetModWorld<WormholesWorld>().Wormholes;
var link = mngr.GetLinkById( id );
mngr.Reroll( link );

Expand Down
4 changes: 2 additions & 2 deletions Projectiles/ChaosBombProjectile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public override bool CanDamage() {

public override void AI() {
var mymod = (WormholesMod)this.mod;
var modworld = this.mod.GetModWorld<MyWorld>();
var modplayer = Main.player[Main.myPlayer].GetModPlayer<MyPlayer>( this.mod );
var modworld = this.mod.GetModWorld<WormholesWorld>();
var modplayer = Main.player[Main.myPlayer].GetModPlayer<WormholesPlayer>( this.mod );
var rect = this.projectile.getRect();
int rand = Main.rand.Next( mymod.Config.Data.ChaosBombWormholeCloseOdds );
var proj = this.projectile;
Expand Down
4 changes: 2 additions & 2 deletions Wormholes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
<Compile Include="WormholesMod.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="NetProtocols\NetProtocolTypes.cs" />
<Compile Include="MyPlayer.cs" />
<Compile Include="WormholesPlayer.cs" />
<Compile Include="WormholesUI.cs" />
<Compile Include="MyWorld.cs" />
<Compile Include="WormholesWorld.cs" />
<Compile Include="Wormholes\WormholePortal.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Wormholes/WormholeLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<MyPlayer>( ctx.MyMod );
WormholesPlayer modplayer = player.GetModPlayer<WormholesPlayer>( ctx.MyMod );

if( modplayer.MyPortal != null && this.ID == modplayer.MyPortal.ID ) {
return true;
Expand All @@ -353,7 +353,7 @@ public int DetectCollision( Rectangle rect ) {

public void ApplyChaosHit( WormholeModContext ctx ) {
if( Main.netMode == 0 ) { // Single
var mngr = ctx.MyMod.GetModWorld<MyWorld>().Wormholes;
var mngr = ctx.MyMod.GetModWorld<WormholesWorld>().Wormholes;
mngr.Reroll( this );
} else { // Non-single
ClientPacketHandlers.SendWormholeRerollRequestViaClient( ctx.MyMod, this.ID );
Expand Down Expand Up @@ -402,7 +402,7 @@ public void TeleportToRight( WormholeModContext ctx, Player player ) {


private void Teleport( WormholeModContext ctx, Player player, Vector2 dest ) {
MyPlayer myplayer = player.GetModPlayer<MyPlayer>( ctx.MyMod );
WormholesPlayer myplayer = player.GetModPlayer<WormholesPlayer>( ctx.MyMod );
if( myplayer.MyPortal == null || (myplayer.MyPortal != null && this.ID != myplayer.MyPortal.ID) ) {
myplayer.ChartedLinks.Add( this.ID );
}
Expand Down
2 changes: 1 addition & 1 deletion Wormholes/WormholeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<MyPlayer>( ctx.MyMod ).MyPortal;
WormholeLink town_portal = player.GetModPlayer<WormholesPlayer>( ctx.MyMod ).MyPortal;

if( !ctx.MyMod.Config.Data.DisableNaturalWormholes ) {
for( int i = 0; i < this.Links.Count; i++ ) {
Expand Down
8 changes: 4 additions & 4 deletions WormholesMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public override void PostDrawFullscreenMap( ref string mouseText ) {
private void DrawMiniMap( SpriteBatch sb ) {
this.UI.Update();

MyWorld modworld = this.GetModWorld<MyWorld>();
MyPlayer curr_modplayer = Main.player[Main.myPlayer].GetModPlayer<MyPlayer>( this );
WormholesWorld modworld = this.GetModWorld<WormholesWorld>();
WormholesPlayer curr_modplayer = Main.player[Main.myPlayer].GetModPlayer<WormholesPlayer>( this );

if( !this.Config.Data.DisableNaturalWormholes ) {
if( modworld.Wormholes != null ) {
Expand Down Expand Up @@ -183,8 +183,8 @@ private void DrawMiniMap( SpriteBatch sb ) {
private void DrawFullMap( SpriteBatch sb ) {
this.UI.Update();

MyWorld modworld = this.GetModWorld<MyWorld>();
MyPlayer curr_modplayer = Main.player[Main.myPlayer].GetModPlayer<MyPlayer>( this );
WormholesWorld modworld = this.GetModWorld<WormholesWorld>();
WormholesPlayer curr_modplayer = Main.player[Main.myPlayer].GetModPlayer<WormholesPlayer>( this );

if( !this.Config.Data.DisableNaturalWormholes ) {
if( modworld.Wormholes != null ) {
Expand Down
14 changes: 7 additions & 7 deletions MyPlayer.cs → WormholesPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


namespace Wormholes {
class MyPlayer : ModPlayer {
class WormholesPlayer : ModPlayer {
public WormholeLink MyPortal;
public ISet<string> ChartedLinks { get; private set; }

Expand All @@ -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;
Expand All @@ -39,7 +39,7 @@ public override void clientClone( ModPlayer clone ) {


public override void Load( TagCompound tag ) {
var modworld = this.mod.GetModWorld<MyWorld>();
var modworld = this.mod.GetModWorld<WormholesWorld>();
int wormholes = tag.GetInt( "wormholes_count" );

this.TownPortalRightPositions = new Dictionary<string, Vector2>();
Expand Down Expand Up @@ -67,7 +67,7 @@ public override void Load( TagCompound tag ) {
}

public override TagCompound Save() {
var modworld = this.mod.GetModWorld<MyWorld>();
var modworld = this.mod.GetModWorld<WormholesWorld>();
string world_id = modworld.ID;
var tags = new TagCompound {
{ "wormholes_count", (int)this.ChartedLinks.Count }
Expand Down Expand Up @@ -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<MyWorld>();
var modworld = this.mod.GetModWorld<WormholesWorld>();

if( !mymod.Config.LoadFile() ) {
mymod.Config.SaveFile();
Expand All @@ -139,7 +139,7 @@ public override void OnEnterWorld( Player player ) {

public void ReopenTownPortal() {
var mymod = (WormholesMod)this.mod;
var modworld = this.mod.GetModWorld<MyWorld>();
var modworld = this.mod.GetModWorld<WormholesWorld>();
string world_id = modworld.ID;

if( this.TownPortalRightPositions.Keys.Contains( world_id ) ) {
Expand All @@ -157,7 +157,7 @@ public override void PreUpdate() {
if( Main.netMode == 2 ) { return; } // Not server

var mymod = (WormholesMod)this.mod;
MyWorld modworld = mymod.GetModWorld<MyWorld>();
WormholesWorld modworld = mymod.GetModWorld<WormholesWorld>();
if( modworld.Wormholes == null ) { return; }

modworld.Wormholes.RunAll( mymod.Context, this.player );
Expand Down
6 changes: 3 additions & 3 deletions MyWorld.cs → WormholesWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


namespace Wormholes {
class MyWorld : ModWorld {
class WormholesWorld : ModWorld {
public WormholeManager Wormholes { get; private set; }
public string ID { get; private set; }

Expand Down Expand Up @@ -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<MyPlayer>( this.mod );
var modplayer = Main.player[Main.myPlayer].GetModPlayer<WormholesPlayer>( this.mod );
if( modplayer.HasEnteredWorld && !modplayer.HasLoadedTownPortals ) {
modplayer.ReopenTownPortal();
}
Expand All @@ -93,7 +93,7 @@ public override void ModifyWorldGenTasks( List<GenPass> tasks, ref float totalWe
public override void PostDrawTiles() {
if( this.Wormholes == null ) { return; }

var myplayer = Main.player[Main.myPlayer].GetModPlayer<MyPlayer>( this.mod );
var myplayer = Main.player[Main.myPlayer].GetModPlayer<WormholesPlayer>( this.mod );
var mymod = (WormholesMod)this.mod;

//Main.spriteBatch.Begin();
Expand Down
2 changes: 1 addition & 1 deletion build.txt
Original file line number Diff line number Diff line change
@@ -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\*
Expand Down

0 comments on commit 931dab6

Please sign in to comment.