From 45e33bca2877ea6e067d42e94a18465057b59b6e Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Fri, 29 Mar 2019 17:27:08 +0200 Subject: [PATCH] (3f574078d) Fixed items emitting light from inside containers in the sub editor. Closes #1365 --- .../Source/Screens/SubEditorScreen.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs index 97342cb7e..ae3a090d2 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs @@ -337,7 +337,24 @@ namespace Barotrauma var tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.03f), paddedLeftPanel.RectTransform), TextManager.Get("ShowLighting")) { Selected = lightingEnabled, - OnSelected = (GUITickBox obj) => { lightingEnabled = obj.Selected; return true; } + OnSelected = (GUITickBox obj) => + { + lightingEnabled = obj.Selected; + if (lightingEnabled) + { + //turn off lights that are inside containers + foreach (Item item in Item.ItemList) + { + foreach (LightComponent lightComponent in item.GetComponents()) + { + lightComponent.Light.Color = item.Container != null || (item.body != null && !item.body.Enabled) ? + Color.Transparent : + lightComponent.LightColor; + } + } + } + return true; + } }; tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.03f), paddedLeftPanel.RectTransform), TextManager.Get("ShowWalls")) {