From f062f736efa6678e29ee3e2656264687baacfc67 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Tue, 31 Jul 2012 20:33:50 -0400 Subject: [PATCH] Fixed bug in player loading introduced in 1.3.2 --- SubstrateCS/Properties/AssemblyInfo.cs | 4 ++-- SubstrateCS/Source/Player.cs | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/SubstrateCS/Properties/AssemblyInfo.cs b/SubstrateCS/Properties/AssemblyInfo.cs index 982d738..2f1e2e3 100644 --- a/SubstrateCS/Properties/AssemblyInfo.cs +++ b/SubstrateCS/Properties/AssemblyInfo.cs @@ -30,8 +30,8 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.3.2.0")] -[assembly: AssemblyFileVersion("1.3.2.0")] +[assembly: AssemblyVersion("1.3.3.0")] +[assembly: AssemblyFileVersion("1.3.3.0")] // This library is compatible with all CLS-compliant .NET programming languages. [assembly: CLSCompliant(true)] \ No newline at end of file diff --git a/SubstrateCS/Source/Player.cs b/SubstrateCS/Source/Player.cs index 0d3388f..6e7e2fc 100644 --- a/SubstrateCS/Source/Player.cs +++ b/SubstrateCS/Source/Player.cs @@ -12,11 +12,11 @@ namespace Substrate /// Whether or not any of these values are respected by the game client is dependent upon the active game mode. public class PlayerAbilities : ICopyable { - private bool _flying; - private bool _instabuild; - private bool _mayfly; - private bool _invulnerable; - private bool _maybuild; + private bool _flying = false; + private bool _instabuild = false; + private bool _mayfly = false; + private bool _invulnerable = false; + private bool _maybuild = true; private float _walkSpeed = 0.1f; private float _flySpeed = 0.05f; @@ -517,9 +517,13 @@ namespace Substrate _abilities.InstantBuild = pb["instabuild"].ToTagByte().Data == 1; _abilities.MayFly = pb["mayfly"].ToTagByte().Data == 1; _abilities.Invulnerable = pb["invulnerable"].ToTagByte().Data == 1; - _abilities.MayBuild = pb["mayBuild"].ToTagByte().Data == 1; - _abilities.WalkSpeed = pb["walkSpeed"].ToTagFloat(); - _abilities.FlySpeed = pb["flySpeed"].ToTagFloat(); + + if (pb.ContainsKey("mayBuild")) + _abilities.MayBuild = pb["mayBuild"].ToTagByte().Data == 1; + if (pb.ContainsKey("walkSpeed")) + _abilities.WalkSpeed = pb["walkSpeed"].ToTagFloat(); + if (pb.ContainsKey("flySpeed")) + _abilities.FlySpeed = pb["flySpeed"].ToTagFloat(); } if (ctree.ContainsKey("PlayerGameType")) {