From 1132e5b6a77887c631c2de009d8e0c22113b89af Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Tue, 30 Jul 2019 13:31:46 +0200 Subject: [PATCH] Update submodule: light cleanup. --- .../Interactable/HandheldLightComponent.cs | 13 ++++++------- .../Components/Power/PoweredLightComponent.cs | 17 ++++++++--------- .../Prototypes/Entities/buildings/lighting.yml | 6 +++--- .../Entities/items/clothing/helmets.yml | 4 ++-- .../Prototypes/Entities/items/flashlight.yml | 2 +- RobustToolbox | 2 +- 6 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs index 57aad41b94..b662990f1a 100644 --- a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs @@ -6,7 +6,6 @@ using Content.Shared.GameObjects; using Robust.Server.GameObjects; using Robust.Server.GameObjects.Components.Container; using Robust.Server.Interfaces.GameObjects; -using Robust.Shared.Enums; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Utility; @@ -118,7 +117,7 @@ namespace Content.Server.GameObjects.Components.Interactable return; } - SetState(LightState.Off); + SetState(false); Activated = false; if (Owner.TryGetComponent(out SoundComponent soundComponent)) @@ -158,7 +157,7 @@ namespace Content.Server.GameObjects.Components.Interactable } Activated = true; - SetState(LightState.On); + SetState(true); if (Owner.TryGetComponent(out soundComponent)) { @@ -166,13 +165,13 @@ namespace Content.Server.GameObjects.Components.Interactable } } - private void SetState(LightState newState) + private void SetState(bool on) { - _spriteComponent.LayerSetVisible(1, newState == LightState.On); - _pointLight.State = newState; + _spriteComponent.LayerSetVisible(1, on); + _pointLight.Enabled = on; if (_clothingComponent != null) { - _clothingComponent.ClothingEquippedPrefix = newState.ToString(); + _clothingComponent.ClothingEquippedPrefix = on ? "On" : "Off"; } } diff --git a/Content.Server/GameObjects/Components/Power/PoweredLightComponent.cs b/Content.Server/GameObjects/Components/Power/PoweredLightComponent.cs index c78e7067ad..651c129bf1 100644 --- a/Content.Server/GameObjects/Components/Power/PoweredLightComponent.cs +++ b/Content.Server/GameObjects/Components/Power/PoweredLightComponent.cs @@ -5,7 +5,6 @@ using Content.Shared.GameObjects; using Robust.Server.GameObjects; using Robust.Server.GameObjects.Components.Container; using Robust.Shared.Audio; -using Robust.Shared.Enums; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Timing; @@ -68,7 +67,7 @@ namespace Content.Server.GameObjects.Components.Power bool CanBurn(int heatResistance) { - return _lightState == LightState.On && heatResistance < LightBulb.BurningTemperature; + return _lightState && heatResistance < LightBulb.BurningTemperature; } void Burn() @@ -135,8 +134,8 @@ namespace Content.Server.GameObjects.Components.Power UpdateLight(); } - private LightState _lightState => Owner.GetComponent().State; - + private bool _lightState => Owner.GetComponent().Enabled; + /// /// Updates the light's power drain, sprite and actual light state. /// @@ -149,7 +148,7 @@ namespace Content.Server.GameObjects.Components.Power { device.Load = 0; sprite.LayerSetState(0, "empty"); - light.State = LightState.Off; + light.Enabled = false; return; } @@ -160,7 +159,7 @@ namespace Content.Server.GameObjects.Components.Power if (device.Powered) { sprite.LayerSetState(0, "on"); - light.State = LightState.On; + light.Enabled = true; light.Color = LightBulb.Color; var time = IoCManager.Resolve().CurTime; if (time > _lastThunk + _thunkDelay) @@ -172,18 +171,18 @@ namespace Content.Server.GameObjects.Components.Power else { sprite.LayerSetState(0, "off"); - light.State = LightState.Off; + light.Enabled = false; } break; case LightBulbState.Broken: device.Load = 0; sprite.LayerSetState(0, "broken"); - light.State = LightState.Off; + light.Enabled = false; break; case LightBulbState.Burned: device.Load = 0; sprite.LayerSetState(0, "burned"); - light.State = LightState.Off; + light.Enabled = false; break; } } diff --git a/Resources/Prototypes/Entities/buildings/lighting.yml b/Resources/Prototypes/Entities/buildings/lighting.yml index ac44f005fa..f9679aa2b3 100644 --- a/Resources/Prototypes/Entities/buildings/lighting.yml +++ b/Resources/Prototypes/Entities/buildings/lighting.yml @@ -16,7 +16,7 @@ - type: PointLight radius: 8 energy: 1.2 - offset: "0, -16" + #offset: "0, -16" color: "#DCDCC6" placement: @@ -39,7 +39,7 @@ state: off - type: PointLight - state: Off + enabled: false - type: PowerDevice priority: Low @@ -64,7 +64,7 @@ - type: PointLight energy: 1.0 - state: Off + enabled: false - type: PowerDevice priority: Low diff --git a/Resources/Prototypes/Entities/items/clothing/helmets.yml b/Resources/Prototypes/Entities/items/clothing/helmets.yml index 056bb679f2..092e487d4a 100644 --- a/Resources/Prototypes/Entities/items/clothing/helmets.yml +++ b/Resources/Prototypes/Entities/items/clothing/helmets.yml @@ -38,7 +38,7 @@ components: - type: HandheldLight - type: PointLight - state: Off + enabled: false - type: Sprite sprite: Clothing/helmet_engineering.rsi layers: @@ -52,4 +52,4 @@ - type: Clothing Slots: - head - sprite: Clothing/helmet_engineering.rsi \ No newline at end of file + sprite: Clothing/helmet_engineering.rsi diff --git a/Resources/Prototypes/Entities/items/flashlight.yml b/Resources/Prototypes/Entities/items/flashlight.yml index f1b539af7a..886dd4cf51 100644 --- a/Resources/Prototypes/Entities/items/flashlight.yml +++ b/Resources/Prototypes/Entities/items/flashlight.yml @@ -16,5 +16,5 @@ sprite: Objects/lantern.rsi state: lantern_off - type: PointLight - state: Off + enabled: false - type: Sound diff --git a/RobustToolbox b/RobustToolbox index be379b2e20..fdfbf92223 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit be379b2e205fd35dcd06f0921aaec9c19ac28910 +Subproject commit fdfbf92223b5539ac2a97143b090aed540e8a498