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",
"IncreaseDamageOnWield",
"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.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<PoweredLightComponent, GhostBooEvent>(OnGhostBoo);
SubscribeLocalEvent<PoweredLightComponent, SignalReceivedEvent>(OnSignalReceived);
SubscribeLocalEvent<PoweredLightComponent, DamageChangedEvent>(HandleLightDamaged);
SubscribeLocalEvent<LitOnPoweredComponent, PowerChangedEvent>(OnPowerChanged);
SubscribeLocalEvent<LitOnPoweredComponent, PowerNetBatterySupplyEvent>(OnPowerSupply);
}
/// <summary>
@@ -84,5 +89,21 @@ namespace Content.Server.Light.EntitySystems
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 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);

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

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

View File

@@ -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:

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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"

View File

@@ -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"]]

View File

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

View File

@@ -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

View File

@@ -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:

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB