diff --git a/Content.Client/Entry/IgnoredComponents.cs b/Content.Client/Entry/IgnoredComponents.cs index 380e46ad49..a25353f798 100644 --- a/Content.Client/Entry/IgnoredComponents.cs +++ b/Content.Client/Entry/IgnoredComponents.cs @@ -279,7 +279,8 @@ namespace Content.Client.Entry "Wieldable", "IncreaseDamageOnWield", "AmbientOnPowered", - "TabletopGame" + "TabletopGame", + "LitOnPowered" }; } } diff --git a/Content.Server/Light/Components/LitOnPoweredComponent.cs b/Content.Server/Light/Components/LitOnPoweredComponent.cs new file mode 100644 index 0000000000..fb0ac0d9b1 --- /dev/null +++ b/Content.Server/Light/Components/LitOnPoweredComponent.cs @@ -0,0 +1,18 @@ +using Content.Server.Light.EntitySystems; +using Robust.Shared.Analyzers; +using Robust.Shared.GameObjects; + +namespace Content.Server.Light.Components +{ + // TODO PoweredLight also snowflakes this behavior. Ideally, powered light is renamed to 'wall light' and the + // actual 'light on power' stuff is just handled by this component. + /// + /// Enables or disables a pointlight depending on the powered + /// state of an entity. + /// + [RegisterComponent, Friend(typeof(PoweredLightSystem))] + public class LitOnPoweredComponent : Component + { + public override string Name => "LitOnPowered"; + } +} diff --git a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs index 9307ad501c..f6c6930e67 100644 --- a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs +++ b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs @@ -2,6 +2,8 @@ using System; using Content.Server.Ghost; using Content.Server.Light.Components; using Content.Server.MachineLinking.Events; +using Content.Server.Power.Components; +using Content.Server.Power.EntitySystems; using Content.Shared.Light; using Content.Shared.Damage; using Robust.Server.GameObjects; @@ -24,6 +26,9 @@ namespace Content.Server.Light.EntitySystems SubscribeLocalEvent(OnGhostBoo); SubscribeLocalEvent(OnSignalReceived); SubscribeLocalEvent(HandleLightDamaged); + + SubscribeLocalEvent(OnPowerChanged); + SubscribeLocalEvent(OnPowerSupply); } /// @@ -84,5 +89,21 @@ namespace Content.Server.Light.EntitySystems break; } } + + private void OnPowerChanged(EntityUid uid, LitOnPoweredComponent component, PowerChangedEvent args) + { + if (EntityManager.TryGetComponent(uid, out var light)) + { + light.Enabled = args.Powered; + } + } + + private void OnPowerSupply(EntityUid uid, LitOnPoweredComponent component, PowerNetBatterySupplyEvent args) + { + if (EntityManager.TryGetComponent(uid, out var light)) + { + light.Enabled = args.Supply; + } + } } } diff --git a/Content.Server/Power/Components/ApcComponent.cs b/Content.Server/Power/Components/ApcComponent.cs index ab6b142984..e94f7e5a78 100644 --- a/Content.Server/Power/Components/ApcComponent.cs +++ b/Content.Server/Power/Components/ApcComponent.cs @@ -49,6 +49,10 @@ namespace Content.Server.Power.Components private const int VisualsChangeDelay = 1; + private static readonly Color LackColor = Color.FromHex("#d1332e"); + private static readonly Color ChargingColor = Color.FromHex("#2e8ad1"); + private static readonly Color FullColor = Color.FromHex("#3db83b"); + [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ApcUiKey.Key); public BatteryComponent? Battery => Owner.TryGetComponent(out BatteryComponent? batteryComponent) ? batteryComponent : null; @@ -115,6 +119,18 @@ namespace Content.Server.Power.Components { appearance.SetData(ApcVisuals.ChargeState, newState); } + + if (Owner.TryGetComponent(out SharedPointLightComponent? light)) + { + light.Color = newState switch + { + ApcChargeState.Lack => LackColor, + ApcChargeState.Charging => ChargingColor, + ApcChargeState.Full => FullColor, + _ => LackColor + }; + light.Dirty(); + } } Owner.TryGetComponent(out BatteryComponent? battery); diff --git a/Resources/Maps/saltern.yml b/Resources/Maps/saltern.yml index 8063a314d9..23e7025aa9 100644 --- a/Resources/Maps/saltern.yml +++ b/Resources/Maps/saltern.yml @@ -600,8 +600,6 @@ entities: - uid: 68 type: VendingMachineCoffee components: - - name: Hot drinks machine - type: MetaData - pos: -11.5,-17.5 parent: 853 type: Transform @@ -15239,8 +15237,6 @@ entities: - uid: 985 type: VendingMachineCoffee components: - - name: Hot drinks machine - type: MetaData - rot: 4.371139006309477E-08 rad pos: 0.5,23.5 parent: 853 @@ -25948,8 +25944,6 @@ entities: - uid: 2383 type: VendingMachineCoffee components: - - name: Hot drinks machine - type: MetaData - rot: 4.371139006309477E-08 rad pos: 5.5,-13.5 parent: 853 @@ -41704,8 +41698,6 @@ entities: - uid: 4038 type: VendingMachineCoffee components: - - name: Hot drinks machine - type: MetaData - pos: -11.5,11.5 parent: 853 type: Transform diff --git a/Resources/Prototypes/Entities/Objects/Devices/pda.yml b/Resources/Prototypes/Entities/Objects/Devices/pda.yml index 2c613e2861..25b4119e82 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/pda.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/pda.yml @@ -24,6 +24,8 @@ - type: PointLight enabled: false radius: 1.4 + mask: /Textures/Effects/LightMasks/cone.png + autoRot: true - type: UserInterface interfaces: - key: enum.PDAUiKey.Key diff --git a/Resources/Prototypes/Entities/Objects/Power/lights.yml b/Resources/Prototypes/Entities/Objects/Power/lights.yml index 1bc3a8af96..6d0a77a0e7 100644 --- a/Resources/Prototypes/Entities/Objects/Power/lights.yml +++ b/Resources/Prototypes/Entities/Objects/Power/lights.yml @@ -43,6 +43,7 @@ # Lighting color values gathered from # https://andi-siess.de/rgb-to-color-temperature/ +# https://academo.org/demos/colour-temperature-relationship/ - type: entity parent: BaseLightbulb name: incandescent light bulb @@ -64,7 +65,7 @@ components: - type: LightBulb bulb: Tube - color: "#FFEBDC" # 5400K color temp + color: "#FFE4CE" # 5000K color temp - type: Sprite sprite: Objects/Power/light_tube.rsi state: normal diff --git a/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml b/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml index 8aabc436df..0c56ec313c 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml @@ -25,6 +25,8 @@ HeldPrefix: off - type: PointLight enabled: false + mask: /Textures/Effects/LightMasks/cone.png + autoRot: true radius: 3 - type: Appearance visuals: diff --git a/Resources/Prototypes/Entities/Structures/Machines/Computers/arcades.yml b/Resources/Prototypes/Entities/Structures/Machines/Computers/arcades.yml index 49439b9930..d7fa83e6cc 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/Computers/arcades.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/Computers/arcades.yml @@ -6,6 +6,10 @@ parent: ComputerBase components: - type: ApcPowerReceiver + - type: PointLight + radius: 1.5 + energy: 1.6 + color: "#3db83b" - type: Sprite sprite: Structures/Machines/arcade.rsi layers: diff --git a/Resources/Prototypes/Entities/Structures/Machines/Computers/base.yml b/Resources/Prototypes/Entities/Structures/Machines/Computers/base.yml index 43fd08eba7..b4ddfc76e2 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/Computers/base.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/Computers/base.yml @@ -29,3 +29,11 @@ - type: ComputerVisualizer key: generic_key screen: generic + - type: LitOnPowered + - type: PointLight + radius: 2 + energy: 1.6 + enabled: false + mask: /Textures/Effects/LightMasks/cone.png + autoRot: true + offset: "0, 0.4" # shine from the top, not bottom of the computer diff --git a/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml b/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml index 456b1a2567..92c4345aa5 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml @@ -20,6 +20,10 @@ - type: ShuttleConsole - type: ApcPowerReceiver powerLoad: 200 + - type: PointLight + radius: 2 + energy: 1.6 + color: "#43ccb5" - type: entity parent: ComputerShuttleBase @@ -44,6 +48,10 @@ - type: ComputerVisualizer key: syndie_key screen: syndishuttle + - type: PointLight + radius: 1.6 + energy: 1.6 + color: "#c94242" - type: entity parent: ComputerBase @@ -56,6 +64,10 @@ - type: ComputerVisualizer key: power_key screen: power_monitor + - type: PointLight + radius: 1.6 + energy: 1.6 + color: "#c9c042" - type: entity parent: ComputerBase @@ -68,6 +80,10 @@ - type: ComputerVisualizer key: med_key screen: medcomp + - type: PointLight + radius: 2 + energy: 1.6 + color: "#1f8c28" - type: entity parent: ComputerBase @@ -94,6 +110,10 @@ priority: Low - type: Computer board: ResearchComputerCircuitboard + - type: PointLight + radius: 2 + energy: 1.6 + color: "#b53ca1" - type: entity parent: ComputerBase @@ -115,6 +135,10 @@ screen: id - type: Computer board: IDComputerCircuitboard + - type: PointLight + radius: 2 + energy: 1.6 + color: "#3c5eb5" - type: entity parent: ComputerBase @@ -134,6 +158,10 @@ screen: generic - type: Computer board: BodyScannerComputerCircuitboard + - type: PointLight + radius: 2 + energy: 1.6 + color: "#1f8c28" - type: entity parent: ComputerBase @@ -153,6 +181,10 @@ type: CommunicationsConsoleBoundUserInterface - type: Computer board: CommsComputerCircuitboard + - type: PointLight + radius: 2 + energy: 1.6 + color: "#3c5eb5" - type: entity parent: ComputerBase @@ -172,6 +204,10 @@ type: SolarControlConsoleBoundUserInterface - type: Computer board: SolarControlComputerCircuitboard + - type: PointLight + radius: 2 + energy: 1.6 + color: "#e6e227" - type: entity id: ComputerSupplyOrdering @@ -238,6 +274,10 @@ type: CargoConsoleBoundUserInterface - type: Computer board: SupplyComputerCircuitboard + - type: PointLight + radius: 2 + energy: 1.6 + color: "#b89f25" - type: entity id: ComputerSupplyRequest @@ -254,3 +294,7 @@ requestOnly: true - type: Computer board: SupplyRequestComputerCircuitboard + - type: PointLight + radius: 2 + energy: 1.6 + color: "#b89f25" diff --git a/Resources/Prototypes/Entities/Structures/Machines/research.yml b/Resources/Prototypes/Entities/Structures/Machines/research.yml index c52e37616e..a0d229a9c8 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/research.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/research.yml @@ -45,6 +45,10 @@ - type: ResearchPointSource pointspersecond: 100 active: true + - type: PointLight + radius: 1.5 + energy: 1.6 + color: "#3db83b" - type: UserInterface interfaces: - key: enum.ResearchClientUiKey.Key diff --git a/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml b/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml index 343b11de70..220232b6e3 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml @@ -46,6 +46,7 @@ BoardName: "Vending Machine" LayoutId: Vending - type: Anchorable + - type: LitOnPowered - type: entity parent: VendingMachine @@ -160,6 +161,10 @@ denyUnshaded: true broken: true - type: WiresVisualizer + - type: PointLight + radius: 1 + energy: 1.3 + color: "#ffb0b0" - type: entity parent: VendingMachine @@ -219,6 +224,10 @@ denyUnshaded: true broken: true - type: WiresVisualizer + - type: PointLight + radius: 1.8 + energy: 1.6 + color: "#3db83b" - type: entity parent: VendingMachine @@ -253,6 +262,10 @@ denyUnshaded: true broken: true - type: WiresVisualizer + - type: PointLight + radius: 2 + energy: 1.3 + color: "#ad7c4b" - type: entity parent: VendingMachine @@ -283,6 +296,10 @@ denyUnshaded: true broken: true - type: WiresVisualizer + - type: PointLight + radius: 2 + energy: 1.6 + color: "#3c5eb5" - type: entity parent: VendingMachine @@ -313,6 +330,10 @@ - type: WiresVisualizer - type: AccessReader access: [["Service"]] + - type: PointLight + radius: 2 + energy: 1.6 + color: "#4b93ad" - type: entity parent: VendingMachine @@ -341,6 +362,10 @@ normalUnshaded: true broken: true - type: WiresVisualizer + - type: PointLight + radius: 2 + energy: 1.6 + color: "#6148c7" - type: entity parent: VendingMachine @@ -370,6 +395,10 @@ - type: WiresVisualizer - type: AccessReader access: [["Engineering"]] + - type: PointLight + radius: 2 + energy: 1.6 + color: "#b89e2a" - type: entity parent: VendingMachine @@ -401,6 +430,10 @@ - type: WiresVisualizer - type: AccessReader access: [["Medical"]] + - type: PointLight + radius: 2 + energy: 1.6 + color: "#9dc5c9" - type: entity parent: VendingMachine @@ -432,6 +465,10 @@ - type: WiresVisualizer - type: AccessReader access: [["Service"]] + - type: PointLight + radius: 2 + energy: 1.6 + color: "#326e3f" - type: entity parent: VendingMachine @@ -462,6 +499,10 @@ - type: WiresVisualizer - type: AccessReader access: [["Security"]] + - type: PointLight + radius: 1 + energy: 1.2 + color: "#78645c" - type: entity parent: VendingMachine @@ -492,6 +533,10 @@ - type: WiresVisualizer - type: AccessReader access: [["Service"]] + - type: PointLight + radius: 2 + energy: 1.6 + color: "#326e3f" - type: entity parent: VendingMachine @@ -520,6 +565,10 @@ normalUnshaded: true broken: true - type: WiresVisualizer + - type: PointLight + radius: 2 + energy: 1.6 + color: "#9dc5c9" - type: entity parent: VendingMachine @@ -550,6 +599,10 @@ denyUnshaded: true broken: true - type: WiresVisualizer + - type: PointLight + radius: 2 + energy: 1.6 + color: "#c73434" - type: entity parent: VendingMachine @@ -580,6 +633,10 @@ denyUnshaded: true broken: true - type: WiresVisualizer + - type: PointLight + radius: 2 + energy: 1.6 + color: "#389690" - type: entity parent: VendingMachine @@ -614,6 +671,10 @@ denyUnshaded: true broken: true - type: WiresVisualizer + - type: PointLight + radius: 2 + energy: 1.6 + color: "#c73434" - type: entity parent: VendingMachine @@ -645,6 +706,10 @@ denyUnshaded: true broken: true - type: WiresVisualizer + - type: PointLight + radius: 2 + energy: 1.6 + color: "#9dc5c9" - type: entity parent: VendingMachine @@ -703,3 +768,7 @@ denyUnshaded: true broken: true - type: WiresVisualizer + - type: PointLight + radius: 2 + energy: 1.6 + color: "#d4ab33" diff --git a/Resources/Prototypes/Entities/Structures/Power/parts.yml b/Resources/Prototypes/Entities/Structures/Power/parts.yml index 4fa3813bcb..08c50ee155 100644 --- a/Resources/Prototypes/Entities/Structures/Power/parts.yml +++ b/Resources/Prototypes/Entities/Structures/Power/parts.yml @@ -19,6 +19,10 @@ maxCharge: 1000 startingCharge: 1000 - type: ExaminableBattery + - type: PointLight + radius: 2 + energy: 1.6 + color: "#3db83b" - type: NodeContainer examinable: true nodes: @@ -52,6 +56,10 @@ range: 2 sound: path: /Audio/Ambience/Objects/hdd_buzz.ogg + - type: PointLight + radius: 1.5 + energy: 1.6 + color: "#3db83b" - type: Clickable - type: AccessReader access: [["Engineering"]] diff --git a/Resources/Prototypes/Entities/Structures/Power/smes.yml b/Resources/Prototypes/Entities/Structures/Power/smes.yml index 9a8b039ed5..e934862be0 100644 --- a/Resources/Prototypes/Entities/Structures/Power/smes.yml +++ b/Resources/Prototypes/Entities/Structures/Power/smes.yml @@ -46,3 +46,7 @@ maxChargeRate: 5000 supplyRampTolerance: 5000 supplyRampRate: 1000 + - type: PointLight + radius: 1.6 + energy: 1.6 + color: "#c9c042" diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/emergency_light.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/emergency_light.yml index c72b60f25e..285cbad421 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/emergency_light.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/emergency_light.yml @@ -10,7 +10,7 @@ energy: 2.5 offset: "0, 0.8" color: "#FF4020" - mask: /Textures/Effects/LightMasks/emergency_mask.png + mask: /Textures/Effects/LightMasks/cone.png - type: ApcPowerReceiver - type: Battery maxCharge: 30000 diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/lighting.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/lighting.yml index 3d1b96d959..359bff3354 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/lighting.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/lighting.yml @@ -24,8 +24,8 @@ state: on - type: PointLight radius: 10 - energy: 1.4 - softness: 1.1 + energy: 0.8 + softness: 1 offset: "0, -0.5" - type: SignalReceiver inputs: diff --git a/Resources/Textures/Effects/LightMasks/emergency_mask.png b/Resources/Textures/Effects/LightMasks/cone.png similarity index 100% rename from Resources/Textures/Effects/LightMasks/emergency_mask.png rename to Resources/Textures/Effects/LightMasks/cone.png