Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layer #1

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed partial class ToggleableLightVisualsComponent : Component
/// Sprite layer that will have its visibility toggled when this item is toggled.
/// </summary>
[DataField("spriteLayer")]
public string SpriteLayer = "light";
public string? SpriteLayer = "light";

/// <summary>
/// Layers to add to the sprite of the player that is holding this entity (while the component is toggled on).
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Toggleable/ToggleableLightVisualsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override void OnAppearanceChange(EntityUid uid, ToggleableLightVisuals
var modulate = AppearanceSystem.TryGetData<Color>(uid, ToggleableLightVisuals.Color, out var color, args.Component);

// Update the item's sprite
if (args.Sprite != null && args.Sprite.LayerMapTryGet(component.SpriteLayer, out var layer))
if (args.Sprite != null && component.SpriteLayer != null && args.Sprite.LayerMapTryGet(component.SpriteLayer, out var layer))
{
args.Sprite.LayerSetVisible(layer, enabled);
if (modulate)
Expand Down
7 changes: 7 additions & 0 deletions Content.Server/Atmos/EntitySystems/FlammableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Content.Shared.Temperature;
using Content.Shared.Throwing;
using Content.Shared.Timing;
using Content.Shared.Toggleable;
using Content.Shared.Weapons.Melee.Events;
using Robust.Server.GameObjects;
using Robust.Shared.Physics.Components;
Expand Down Expand Up @@ -248,6 +249,12 @@ public void UpdateAppearance(EntityUid uid, FlammableComponent? flammable = null

_appearance.SetData(uid, FireVisuals.OnFire, flammable.OnFire, appearance);
_appearance.SetData(uid, FireVisuals.FireStacks, flammable.FireStacks, appearance);

// Also enable toggleable-light visuals
// This is intended so that matches & candles can re-use code for un-shaded layers on in-hand sprites.
// However, this could cause conflicts if something is ACTUALLY both a toggleable light and flammable.
// if that ever happens, then fire visuals will need to implement their own in-hand sprite management.
_appearance.SetData(uid, ToggleableLightVisuals.Enabled, true, appearance);
}

public void AdjustFireStacks(EntityUid uid, float relativeFireStacks, FlammableComponent? flammable = null)
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Objects/Misc/candles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
sprite: Objects/Misc/candles.rsi
normalState: fire-big
- type: ToggleableLightVisuals
spriteLayer: enum.FireVisuals.OnFire
spriteLayer: null
inhandVisuals:
left:
- state: inhand-left-flame
Expand Down
Loading