From 7d31f0cdb6ef0eebf7054ed953e926538836ec82 Mon Sep 17 00:00:00 2001 From: itchyOwl Date: Mon, 9 Apr 2018 16:16:17 +0300 Subject: [PATCH] Add a backing field with the default value Vector2.One for TextureScale. Clamp the values between 0.01 and 10 to keep them sensible. --- Barotrauma/BarotraumaShared/Source/Map/Structure.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs index 0844fd8b8..7d700b5b8 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs @@ -155,8 +155,19 @@ namespace Barotrauma set { spriteColor = value; } } + protected Vector2 textureScale = Vector2.One; [Editable, Serialize("1.0, 1.0", true)] - public Vector2 TextureScale { get; set; } + public Vector2 TextureScale + { + get { return textureScale; } + set + { + var v = value; + v.X = MathHelper.Clamp(v.X, 0.01f, 10); + v.Y = MathHelper.Clamp(v.Y, 0.01f, 10); + textureScale = v; + } + } public override Rectangle Rect {