From fd70f5107ec9ac623a5bb886de715a16ce95e7e3 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Fri, 14 Jun 2019 14:04:26 +0300 Subject: [PATCH] (7684c5e4e) Moved structure TextureScale and TextureOffset from the client project to shared. Excluding them from the server project caused them to reset when the server saves the sub in the multiplayer campaign. --- .../BarotraumaClient/Source/Map/Structure.cs | 31 +------------------ .../BarotraumaShared/Source/Map/Structure.cs | 26 ++++++++++++++-- 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/Map/Structure.cs b/Barotrauma/BarotraumaClient/Source/Map/Structure.cs index 46d973c57..726ddd2dc 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Structure.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Structure.cs @@ -30,43 +30,14 @@ namespace Barotrauma return HasBody ? ShowWalls : ShowStructures;; } } - - // Only for testing in the debug build. Not saved. - protected Vector2 textureScale = Vector2.One; - [Editable(DecimalCount = 3, MinValueFloat = 0.01f, MaxValueFloat = 10f, ValueStep = 0.1f), Serialize("1.0, 1.0", false)] - public Vector2 TextureScale - { - get { return textureScale; } - set - { - textureScale = new Vector2( - MathHelper.Clamp(value.X, 0.01f, 10), - MathHelper.Clamp(value.Y, 0.01f, 10)); - } - } - private string specialTag; [Editable, Serialize("", true)] public string SpecialTag { get { return specialTag; } set { specialTag = value; } - } - - // Only for testing in the debug build. Not saved. -#if DEBUG - [Editable, Serialize(true, false)] -#endif - public bool DrawTiled { get; protected set; } = true; - - protected Vector2 textureOffset = Vector2.Zero; - [Editable(MinValueFloat = -1000f, MaxValueFloat = 1000f, ValueStep = 10f), Serialize("0.0, 0.0", true)] - public Vector2 TextureOffset - { - get { return textureOffset; } - set { textureOffset = value; } - } + } partial void InitProjSpecific() { diff --git a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs index f8f14717d..099bf9813 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs @@ -183,6 +183,29 @@ namespace Barotrauma } } + + protected Vector2 textureScale = Vector2.One; + + [Editable(DecimalCount = 3, MinValueFloat = 0.01f, MaxValueFloat = 10f, ValueStep = 0.1f), Serialize("1.0, 1.0", false)] + public Vector2 TextureScale + { + get { return textureScale; } + set + { + textureScale = new Vector2( + MathHelper.Clamp(value.X, 0.01f, 10), + MathHelper.Clamp(value.Y, 0.01f, 10)); + } + } + + protected Vector2 textureOffset = Vector2.Zero; + [Editable(MinValueFloat = -1000f, MaxValueFloat = 1000f, ValueStep = 10f), Serialize("0.0, 0.0", true)] + public Vector2 TextureOffset + { + get { return textureOffset; } + set { textureOffset = value; } + } + private Rectangle defaultRect; public override Rectangle Rect @@ -296,9 +319,8 @@ namespace Barotrauma defaultRect = rectangle; rect = rectangle; -#if CLIENT TextureScale = sp.TextureScale; -#endif + spriteColor = prefab.SpriteColor; if (sp.IsHorizontal.HasValue) {