From ca279d40a344ca9c9591c4d191f2bf795178490e Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Tue, 26 Mar 2019 14:06:26 +0200 Subject: [PATCH] (dbaa7326b) Use the SpriteColor of the item when drawing the moving parts of turrets and doors, made InventoryIconColor and ContainerColor saveable. Closes #1326 --- Barotrauma/BarotraumaClient/Source/Items/Components/Door.cs | 4 ++-- .../BarotraumaClient/Source/Items/Components/Turret.cs | 6 +++--- Barotrauma/BarotraumaShared/Source/Items/Item.cs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Door.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Door.cs index d536e9fe5..8a1858095 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Door.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Door.cs @@ -93,7 +93,7 @@ namespace Barotrauma.Items.Components public void Draw(SpriteBatch spriteBatch, bool editing) { - Color color = Color.White; + Color color = item.SpriteColor; if (brokenSprite == null) { //broken doors turn black if no broken sprite has been configured @@ -108,7 +108,7 @@ namespace Barotrauma.Items.Components weldSpritePos.Y = -weldSpritePos.Y; weldedSprite.Draw(spriteBatch, - weldSpritePos, Color.White * (stuck / 100.0f), scale: item.Scale); + weldSpritePos, item.SpriteColor * (stuck / 100.0f), scale: item.Scale); } if (openState == 1.0f) diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs index 4ed31820f..6e42a2949 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Turret.cs @@ -237,13 +237,13 @@ namespace Barotrauma.Items.Components railSprite?.Draw(spriteBatch, drawPos, - Color.White, + item.SpriteColor, rotation + MathHelper.PiOver2, item.Scale, SpriteEffects.None, item.SpriteDepth + (railSprite.Depth - item.Sprite.Depth)); barrelSprite?.Draw(spriteBatch, - drawPos - new Vector2((float)Math.Cos(rotation), (float)Math.Sin(rotation)) * recoilOffset * item.Scale, - Color.White, + drawPos - new Vector2((float)Math.Cos(rotation), (float)Math.Sin(rotation)) * recoilOffset * item.Scale, + item.SpriteColor, rotation + MathHelper.PiOver2, item.Scale, SpriteEffects.None, item.SpriteDepth + (barrelSprite.Depth - item.Sprite.Depth)); diff --git a/Barotrauma/BarotraumaShared/Source/Items/Item.cs b/Barotrauma/BarotraumaShared/Source/Items/Item.cs index 32cb6f3be..11c413b9b 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Item.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Item.cs @@ -211,14 +211,14 @@ namespace Barotrauma set { spriteColor = value; } } - [Serialize("1.0,1.0,1.0,1.0", false), Editable] + [Serialize("1.0,1.0,1.0,1.0", true), Editable] public Color InventoryIconColor { get; protected set; } - [Serialize("1.0,1.0,1.0,1.0", false), Editable(ToolTip = "Changes the color of the item this item is contained inside. Only has an effect if either of the UseContainedSpriteColor or UseContainedInventoryIconColor property of the container is set to true.")] + [Serialize("1.0,1.0,1.0,1.0", true), Editable(ToolTip = "Changes the color of the item this item is contained inside. Only has an effect if either of the UseContainedSpriteColor or UseContainedInventoryIconColor property of the container is set to true.")] public Color ContainerColor { get;