Many lighting tweaks (#4709)

This commit is contained in:
mirrorcult
2021-10-01 13:59:06 -07:00
committed by GitHub
parent f07bd6b005
commit 402cd9b56b
18 changed files with 207 additions and 13 deletions

View File

@@ -279,7 +279,8 @@ namespace Content.Client.Entry
"Wieldable", "Wieldable",
"IncreaseDamageOnWield", "IncreaseDamageOnWield",
"AmbientOnPowered", "AmbientOnPowered",
"TabletopGame" "TabletopGame",
"LitOnPowered"
}; };
} }
} }

View File

@@ -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.
/// <summary>
/// Enables or disables a pointlight depending on the powered
/// state of an entity.
/// </summary>
[RegisterComponent, Friend(typeof(PoweredLightSystem))]
public class LitOnPoweredComponent : Component
{
public override string Name => "LitOnPowered";
}
}

View File

@@ -2,6 +2,8 @@ using System;
using Content.Server.Ghost; using Content.Server.Ghost;
using Content.Server.Light.Components; using Content.Server.Light.Components;
using Content.Server.MachineLinking.Events; using Content.Server.MachineLinking.Events;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.Light; using Content.Shared.Light;
using Content.Shared.Damage; using Content.Shared.Damage;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
@@ -24,6 +26,9 @@ namespace Content.Server.Light.EntitySystems
SubscribeLocalEvent<PoweredLightComponent, GhostBooEvent>(OnGhostBoo); SubscribeLocalEvent<PoweredLightComponent, GhostBooEvent>(OnGhostBoo);
SubscribeLocalEvent<PoweredLightComponent, SignalReceivedEvent>(OnSignalReceived); SubscribeLocalEvent<PoweredLightComponent, SignalReceivedEvent>(OnSignalReceived);
SubscribeLocalEvent<PoweredLightComponent, DamageChangedEvent>(HandleLightDamaged); SubscribeLocalEvent<PoweredLightComponent, DamageChangedEvent>(HandleLightDamaged);
SubscribeLocalEvent<LitOnPoweredComponent, PowerChangedEvent>(OnPowerChanged);
SubscribeLocalEvent<LitOnPoweredComponent, PowerNetBatterySupplyEvent>(OnPowerSupply);
} }
/// <summary> /// <summary>
@@ -84,5 +89,21 @@ namespace Content.Server.Light.EntitySystems
break; break;
} }
} }
private void OnPowerChanged(EntityUid uid, LitOnPoweredComponent component, PowerChangedEvent args)
{
if (EntityManager.TryGetComponent<PointLightComponent>(uid, out var light))
{
light.Enabled = args.Powered;
}
}
private void OnPowerSupply(EntityUid uid, LitOnPoweredComponent component, PowerNetBatterySupplyEvent args)
{
if (EntityManager.TryGetComponent<PointLightComponent>(uid, out var light))
{
light.Enabled = args.Supply;
}
}
} }
} }

View File

@@ -49,6 +49,10 @@ namespace Content.Server.Power.Components
private const int VisualsChangeDelay = 1; 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); [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ApcUiKey.Key);
public BatteryComponent? Battery => Owner.TryGetComponent(out BatteryComponent? batteryComponent) ? batteryComponent : null; public BatteryComponent? Battery => Owner.TryGetComponent(out BatteryComponent? batteryComponent) ? batteryComponent : null;
@@ -115,6 +119,18 @@ namespace Content.Server.Power.Components
{ {
appearance.SetData(ApcVisuals.ChargeState, newState); 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); Owner.TryGetComponent(out BatteryComponent? battery);

View File

@@ -600,8 +600,6 @@ entities:
- uid: 68 - uid: 68
type: VendingMachineCoffee type: VendingMachineCoffee
components: components:
- name: Hot drinks machine
type: MetaData
- pos: -11.5,-17.5 - pos: -11.5,-17.5
parent: 853 parent: 853
type: Transform type: Transform
@@ -15239,8 +15237,6 @@ entities:
- uid: 985 - uid: 985
type: VendingMachineCoffee type: VendingMachineCoffee
components: components:
- name: Hot drinks machine
type: MetaData
- rot: 4.371139006309477E-08 rad - rot: 4.371139006309477E-08 rad
pos: 0.5,23.5 pos: 0.5,23.5
parent: 853 parent: 853
@@ -25948,8 +25944,6 @@ entities:
- uid: 2383 - uid: 2383
type: VendingMachineCoffee type: VendingMachineCoffee
components: components:
- name: Hot drinks machine
type: MetaData
- rot: 4.371139006309477E-08 rad - rot: 4.371139006309477E-08 rad
pos: 5.5,-13.5 pos: 5.5,-13.5
parent: 853 parent: 853
@@ -41704,8 +41698,6 @@ entities:
- uid: 4038 - uid: 4038
type: VendingMachineCoffee type: VendingMachineCoffee
components: components:
- name: Hot drinks machine
type: MetaData
- pos: -11.5,11.5 - pos: -11.5,11.5
parent: 853 parent: 853
type: Transform type: Transform

View File

@@ -24,6 +24,8 @@
- type: PointLight - type: PointLight
enabled: false enabled: false
radius: 1.4 radius: 1.4
mask: /Textures/Effects/LightMasks/cone.png
autoRot: true
- type: UserInterface - type: UserInterface
interfaces: interfaces:
- key: enum.PDAUiKey.Key - key: enum.PDAUiKey.Key

View File

@@ -43,6 +43,7 @@
# Lighting color values gathered from # Lighting color values gathered from
# https://andi-siess.de/rgb-to-color-temperature/ # https://andi-siess.de/rgb-to-color-temperature/
# https://academo.org/demos/colour-temperature-relationship/
- type: entity - type: entity
parent: BaseLightbulb parent: BaseLightbulb
name: incandescent light bulb name: incandescent light bulb
@@ -64,7 +65,7 @@
components: components:
- type: LightBulb - type: LightBulb
bulb: Tube bulb: Tube
color: "#FFEBDC" # 5400K color temp color: "#FFE4CE" # 5000K color temp
- type: Sprite - type: Sprite
sprite: Objects/Power/light_tube.rsi sprite: Objects/Power/light_tube.rsi
state: normal state: normal

View File

@@ -25,6 +25,8 @@
HeldPrefix: off HeldPrefix: off
- type: PointLight - type: PointLight
enabled: false enabled: false
mask: /Textures/Effects/LightMasks/cone.png
autoRot: true
radius: 3 radius: 3
- type: Appearance - type: Appearance
visuals: visuals:

View File

@@ -6,6 +6,10 @@
parent: ComputerBase parent: ComputerBase
components: components:
- type: ApcPowerReceiver - type: ApcPowerReceiver
- type: PointLight
radius: 1.5
energy: 1.6
color: "#3db83b"
- type: Sprite - type: Sprite
sprite: Structures/Machines/arcade.rsi sprite: Structures/Machines/arcade.rsi
layers: layers:

View File

@@ -29,3 +29,11 @@
- type: ComputerVisualizer - type: ComputerVisualizer
key: generic_key key: generic_key
screen: generic 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

View File

@@ -20,6 +20,10 @@
- type: ShuttleConsole - type: ShuttleConsole
- type: ApcPowerReceiver - type: ApcPowerReceiver
powerLoad: 200 powerLoad: 200
- type: PointLight
radius: 2
energy: 1.6
color: "#43ccb5"
- type: entity - type: entity
parent: ComputerShuttleBase parent: ComputerShuttleBase
@@ -44,6 +48,10 @@
- type: ComputerVisualizer - type: ComputerVisualizer
key: syndie_key key: syndie_key
screen: syndishuttle screen: syndishuttle
- type: PointLight
radius: 1.6
energy: 1.6
color: "#c94242"
- type: entity - type: entity
parent: ComputerBase parent: ComputerBase
@@ -56,6 +64,10 @@
- type: ComputerVisualizer - type: ComputerVisualizer
key: power_key key: power_key
screen: power_monitor screen: power_monitor
- type: PointLight
radius: 1.6
energy: 1.6
color: "#c9c042"
- type: entity - type: entity
parent: ComputerBase parent: ComputerBase
@@ -68,6 +80,10 @@
- type: ComputerVisualizer - type: ComputerVisualizer
key: med_key key: med_key
screen: medcomp screen: medcomp
- type: PointLight
radius: 2
energy: 1.6
color: "#1f8c28"
- type: entity - type: entity
parent: ComputerBase parent: ComputerBase
@@ -94,6 +110,10 @@
priority: Low priority: Low
- type: Computer - type: Computer
board: ResearchComputerCircuitboard board: ResearchComputerCircuitboard
- type: PointLight
radius: 2
energy: 1.6
color: "#b53ca1"
- type: entity - type: entity
parent: ComputerBase parent: ComputerBase
@@ -115,6 +135,10 @@
screen: id screen: id
- type: Computer - type: Computer
board: IDComputerCircuitboard board: IDComputerCircuitboard
- type: PointLight
radius: 2
energy: 1.6
color: "#3c5eb5"
- type: entity - type: entity
parent: ComputerBase parent: ComputerBase
@@ -134,6 +158,10 @@
screen: generic screen: generic
- type: Computer - type: Computer
board: BodyScannerComputerCircuitboard board: BodyScannerComputerCircuitboard
- type: PointLight
radius: 2
energy: 1.6
color: "#1f8c28"
- type: entity - type: entity
parent: ComputerBase parent: ComputerBase
@@ -153,6 +181,10 @@
type: CommunicationsConsoleBoundUserInterface type: CommunicationsConsoleBoundUserInterface
- type: Computer - type: Computer
board: CommsComputerCircuitboard board: CommsComputerCircuitboard
- type: PointLight
radius: 2
energy: 1.6
color: "#3c5eb5"
- type: entity - type: entity
parent: ComputerBase parent: ComputerBase
@@ -172,6 +204,10 @@
type: SolarControlConsoleBoundUserInterface type: SolarControlConsoleBoundUserInterface
- type: Computer - type: Computer
board: SolarControlComputerCircuitboard board: SolarControlComputerCircuitboard
- type: PointLight
radius: 2
energy: 1.6
color: "#e6e227"
- type: entity - type: entity
id: ComputerSupplyOrdering id: ComputerSupplyOrdering
@@ -238,6 +274,10 @@
type: CargoConsoleBoundUserInterface type: CargoConsoleBoundUserInterface
- type: Computer - type: Computer
board: SupplyComputerCircuitboard board: SupplyComputerCircuitboard
- type: PointLight
radius: 2
energy: 1.6
color: "#b89f25"
- type: entity - type: entity
id: ComputerSupplyRequest id: ComputerSupplyRequest
@@ -254,3 +294,7 @@
requestOnly: true requestOnly: true
- type: Computer - type: Computer
board: SupplyRequestComputerCircuitboard board: SupplyRequestComputerCircuitboard
- type: PointLight
radius: 2
energy: 1.6
color: "#b89f25"

View File

@@ -45,6 +45,10 @@
- type: ResearchPointSource - type: ResearchPointSource
pointspersecond: 100 pointspersecond: 100
active: true active: true
- type: PointLight
radius: 1.5
energy: 1.6
color: "#3db83b"
- type: UserInterface - type: UserInterface
interfaces: interfaces:
- key: enum.ResearchClientUiKey.Key - key: enum.ResearchClientUiKey.Key

View File

@@ -46,6 +46,7 @@
BoardName: "Vending Machine" BoardName: "Vending Machine"
LayoutId: Vending LayoutId: Vending
- type: Anchorable - type: Anchorable
- type: LitOnPowered
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -160,6 +161,10 @@
denyUnshaded: true denyUnshaded: true
broken: true broken: true
- type: WiresVisualizer - type: WiresVisualizer
- type: PointLight
radius: 1
energy: 1.3
color: "#ffb0b0"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -219,6 +224,10 @@
denyUnshaded: true denyUnshaded: true
broken: true broken: true
- type: WiresVisualizer - type: WiresVisualizer
- type: PointLight
radius: 1.8
energy: 1.6
color: "#3db83b"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -253,6 +262,10 @@
denyUnshaded: true denyUnshaded: true
broken: true broken: true
- type: WiresVisualizer - type: WiresVisualizer
- type: PointLight
radius: 2
energy: 1.3
color: "#ad7c4b"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -283,6 +296,10 @@
denyUnshaded: true denyUnshaded: true
broken: true broken: true
- type: WiresVisualizer - type: WiresVisualizer
- type: PointLight
radius: 2
energy: 1.6
color: "#3c5eb5"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -313,6 +330,10 @@
- type: WiresVisualizer - type: WiresVisualizer
- type: AccessReader - type: AccessReader
access: [["Service"]] access: [["Service"]]
- type: PointLight
radius: 2
energy: 1.6
color: "#4b93ad"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -341,6 +362,10 @@
normalUnshaded: true normalUnshaded: true
broken: true broken: true
- type: WiresVisualizer - type: WiresVisualizer
- type: PointLight
radius: 2
energy: 1.6
color: "#6148c7"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -370,6 +395,10 @@
- type: WiresVisualizer - type: WiresVisualizer
- type: AccessReader - type: AccessReader
access: [["Engineering"]] access: [["Engineering"]]
- type: PointLight
radius: 2
energy: 1.6
color: "#b89e2a"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -401,6 +430,10 @@
- type: WiresVisualizer - type: WiresVisualizer
- type: AccessReader - type: AccessReader
access: [["Medical"]] access: [["Medical"]]
- type: PointLight
radius: 2
energy: 1.6
color: "#9dc5c9"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -432,6 +465,10 @@
- type: WiresVisualizer - type: WiresVisualizer
- type: AccessReader - type: AccessReader
access: [["Service"]] access: [["Service"]]
- type: PointLight
radius: 2
energy: 1.6
color: "#326e3f"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -462,6 +499,10 @@
- type: WiresVisualizer - type: WiresVisualizer
- type: AccessReader - type: AccessReader
access: [["Security"]] access: [["Security"]]
- type: PointLight
radius: 1
energy: 1.2
color: "#78645c"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -492,6 +533,10 @@
- type: WiresVisualizer - type: WiresVisualizer
- type: AccessReader - type: AccessReader
access: [["Service"]] access: [["Service"]]
- type: PointLight
radius: 2
energy: 1.6
color: "#326e3f"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -520,6 +565,10 @@
normalUnshaded: true normalUnshaded: true
broken: true broken: true
- type: WiresVisualizer - type: WiresVisualizer
- type: PointLight
radius: 2
energy: 1.6
color: "#9dc5c9"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -550,6 +599,10 @@
denyUnshaded: true denyUnshaded: true
broken: true broken: true
- type: WiresVisualizer - type: WiresVisualizer
- type: PointLight
radius: 2
energy: 1.6
color: "#c73434"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -580,6 +633,10 @@
denyUnshaded: true denyUnshaded: true
broken: true broken: true
- type: WiresVisualizer - type: WiresVisualizer
- type: PointLight
radius: 2
energy: 1.6
color: "#389690"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -614,6 +671,10 @@
denyUnshaded: true denyUnshaded: true
broken: true broken: true
- type: WiresVisualizer - type: WiresVisualizer
- type: PointLight
radius: 2
energy: 1.6
color: "#c73434"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -645,6 +706,10 @@
denyUnshaded: true denyUnshaded: true
broken: true broken: true
- type: WiresVisualizer - type: WiresVisualizer
- type: PointLight
radius: 2
energy: 1.6
color: "#9dc5c9"
- type: entity - type: entity
parent: VendingMachine parent: VendingMachine
@@ -703,3 +768,7 @@
denyUnshaded: true denyUnshaded: true
broken: true broken: true
- type: WiresVisualizer - type: WiresVisualizer
- type: PointLight
radius: 2
energy: 1.6
color: "#d4ab33"

View File

@@ -19,6 +19,10 @@
maxCharge: 1000 maxCharge: 1000
startingCharge: 1000 startingCharge: 1000
- type: ExaminableBattery - type: ExaminableBattery
- type: PointLight
radius: 2
energy: 1.6
color: "#3db83b"
- type: NodeContainer - type: NodeContainer
examinable: true examinable: true
nodes: nodes:
@@ -52,6 +56,10 @@
range: 2 range: 2
sound: sound:
path: /Audio/Ambience/Objects/hdd_buzz.ogg path: /Audio/Ambience/Objects/hdd_buzz.ogg
- type: PointLight
radius: 1.5
energy: 1.6
color: "#3db83b"
- type: Clickable - type: Clickable
- type: AccessReader - type: AccessReader
access: [["Engineering"]] access: [["Engineering"]]

View File

@@ -46,3 +46,7 @@
maxChargeRate: 5000 maxChargeRate: 5000
supplyRampTolerance: 5000 supplyRampTolerance: 5000
supplyRampRate: 1000 supplyRampRate: 1000
- type: PointLight
radius: 1.6
energy: 1.6
color: "#c9c042"

View File

@@ -10,7 +10,7 @@
energy: 2.5 energy: 2.5
offset: "0, 0.8" offset: "0, 0.8"
color: "#FF4020" color: "#FF4020"
mask: /Textures/Effects/LightMasks/emergency_mask.png mask: /Textures/Effects/LightMasks/cone.png
- type: ApcPowerReceiver - type: ApcPowerReceiver
- type: Battery - type: Battery
maxCharge: 30000 maxCharge: 30000

View File

@@ -24,8 +24,8 @@
state: on state: on
- type: PointLight - type: PointLight
radius: 10 radius: 10
energy: 1.4 energy: 0.8
softness: 1.1 softness: 1
offset: "0, -0.5" offset: "0, -0.5"
- type: SignalReceiver - type: SignalReceiver
inputs: inputs:

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB