diff --git a/Content.Client/Light/Components/HandheldLightComponent.cs b/Content.Client/Light/Components/HandheldLightComponent.cs index eac211e864..448179e99a 100644 --- a/Content.Client/Light/Components/HandheldLightComponent.cs +++ b/Content.Client/Light/Components/HandheldLightComponent.cs @@ -1,4 +1,5 @@ using Content.Client.Items.Components; +using Content.Shared.Hands.Components; using Content.Shared.Light.Component; using Robust.Client.Graphics; using Robust.Client.UserInterface; @@ -6,9 +7,11 @@ using Robust.Client.UserInterface.Controls; using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; using Robust.Shared.Maths; +using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Timing; -using Robust.Shared.ViewVariables; +using System.Collections.Generic; using static Robust.Client.UserInterface.Controls.BoxContainer; +using static Robust.Shared.GameObjects.SharedSpriteComponent; namespace Content.Client.Light.Components { @@ -17,6 +20,37 @@ namespace Content.Client.Light.Components public sealed class HandheldLightComponent : SharedHandheldLightComponent, IItemStatus { public byte? Level; + public bool Activated; + + /// + /// Whether to automatically set item-prefixes when toggling the flashlight. + /// + /// + /// Flashlights should probably be using explicit unshaded sprite, in-hand and clothing layers, this is + /// mostly here for backwards compatibility. + /// + [DataField("addPrefix")] + public bool AddPrefix = false; + + /// + /// Sprite layer that will have it's visibility toggled when this item is toggled. + /// + [DataField("layer")] + public string Layer = "light"; + + /// + /// Layers to add to the sprite of the player that is holding this entity. + /// + [DataField("inhandVisuals")] + public Dictionary> InhandVisuals = new(); + + /// + /// Layers to add to the sprite of the player that is wearing this entity. + /// + [DataField("clothingVisuals")] + public readonly Dictionary> ClothingVisuals = new(); + + public Color Color { get; internal set; } public Control MakeControl() { diff --git a/Content.Client/Light/HandheldLightSystem.cs b/Content.Client/Light/HandheldLightSystem.cs index ee1b3b6bc4..fdb2899db0 100644 --- a/Content.Client/Light/HandheldLightSystem.cs +++ b/Content.Client/Light/HandheldLightSystem.cs @@ -1,16 +1,77 @@ +using Content.Client.Clothing; +using Content.Client.Items.Systems; using Content.Client.Light.Components; +using Content.Shared.Clothing; +using Content.Shared.Hands; +using Content.Shared.Item; using Content.Shared.Light.Component; -using Robust.Shared.GameObjects; +using Robust.Client.GameObjects; using Robust.Shared.GameStates; +using System.Linq; namespace Content.Client.Light; public sealed class HandheldLightSystem : EntitySystem { + [Dependency] private readonly ItemSystem _itemSys = default!; + public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnHandleState); + SubscribeLocalEvent(OnGetHeldVisuals, after: new[] { typeof(ItemSystem) } ); + SubscribeLocalEvent(OnGetEquipmentVisuals, after: new[] { typeof(ClothingSystem)}); + } + + /// + /// Add the unshaded light overlays to any clothing sprites. + /// + private void OnGetEquipmentVisuals(EntityUid uid, HandheldLightComponent component, GetEquipmentVisualsEvent args) + { + if (!component.Activated) + return; + + if (!component.ClothingVisuals.TryGetValue(args.Slot, out var layers)) + return; + + var i = 0; + foreach (var layer in layers) + { + var key = layer.MapKeys?.FirstOrDefault(); + if (key == null) + { + key = i == 0 ? $"{args.Slot}-light" : $"{args.Slot}-light-{i}"; + i++; + } + + args.Layers.Add((key, layer)); + } + } + + /// + /// Add the unshaded light overlays to any in-hand sprites. + /// + private void OnGetHeldVisuals(EntityUid uid, HandheldLightComponent component, GetInhandVisualsEvent args) + { + if (!component.Activated) + return; + + if (!component.InhandVisuals.TryGetValue(args.Location, out var layers)) + return; + + var i = 0; + var defaultKey = $"inhand-{args.Location.ToString().ToLowerInvariant()}-light"; + foreach (var layer in layers) + { + var key = layer.MapKeys?.FirstOrDefault(); + if (key == null) + { + key = i == 0 ? defaultKey : $"{defaultKey}-{i}"; + i++; + } + + args.Layers.Add((key, layer)); + } } private void OnHandleState(EntityUid uid, HandheldLightComponent component, ref ComponentHandleState args) @@ -19,5 +80,26 @@ public sealed class HandheldLightSystem : EntitySystem return; component.Level = state.Charge; + + if (state.Activated == component.Activated) + return; + + component.Activated = state.Activated; + _itemSys.VisualsChanged(uid); + + if (TryComp(component.Owner, out SpriteComponent? sprite)) + { + sprite.LayerSetVisible(component.Layer, state.Activated); + } + + if (TryComp(uid, out PointLightComponent? light)) + { + light.Enabled = state.Activated; + } + + // really hand-held lights should be using a separate unshaded layer. (see FlashlightVisualizer) + // this prefix stuff is largely for backwards compatibility with RSIs/yamls that have not been updated. + if (component.AddPrefix && TryComp(uid, out SharedItemComponent? item)) + item.EquippedPrefix = state.Activated ? "on" : "off"; } } diff --git a/Content.Client/Light/RgbLightControllerSystem.cs b/Content.Client/Light/RgbLightControllerSystem.cs index 05e846c6d8..e77483bd3e 100644 --- a/Content.Client/Light/RgbLightControllerSystem.cs +++ b/Content.Client/Light/RgbLightControllerSystem.cs @@ -1,20 +1,21 @@ -using System; using System.Linq; -using Content.Shared.Item; +using Content.Client.Items.Systems; +using Content.Shared.Clothing; +using Content.Shared.Hands; +using Content.Shared.Inventory.Events; using Content.Shared.Light; using Content.Shared.Light.Component; using Robust.Client.GameObjects; -using Robust.Shared.GameObjects; using Robust.Shared.GameStates; -using Robust.Shared.IoC; -using Robust.Shared.Maths; using Robust.Shared.Timing; +using static Robust.Client.GameObjects.SpriteComponent; namespace Content.Client.Light { public sealed class RgbLightControllerSystem : SharedRgbLightControllerSystem { [Dependency] private IGameTiming _gameTiming = default!; + [Dependency] private ItemSystem _itemSystem = default!; public override void Initialize() { @@ -23,77 +24,137 @@ namespace Content.Client.Light SubscribeLocalEvent(OnHandleState); SubscribeLocalEvent(OnComponentShutdown); SubscribeLocalEvent(OnComponentStart); + + SubscribeLocalEvent(OnGotUnequipped); + + SubscribeLocalEvent(OnEquipmentVisualsUpdated); + SubscribeLocalEvent(OnHeldVisualsUpdated); } private void OnComponentStart(EntityUid uid, RgbLightControllerComponent rgb, ComponentStartup args) { - if (TryComp(uid, out PointLightComponent? light)) - rgb.OriginalLightColor = light.Color; + GetOriginalColors(uid, rgb); - if (TryComp(uid, out SharedItemComponent? item)) - rgb.OriginalItemColor = item.Color; - - GetOriginalSpriteColors(uid, rgb); + // trigger visuals updated events + _itemSystem.VisualsChanged(uid); } private void OnComponentShutdown(EntityUid uid, RgbLightControllerComponent rgb, ComponentShutdown args) { - if (TryComp(uid, out PointLightComponent? light)) - light.Color = rgb.OriginalLightColor; + ResetOriginalColors(uid, rgb); - if (TryComp(uid, out SharedItemComponent? item)) - item.Color = rgb.OriginalItemColor; - - ResetSpriteColors(uid, rgb); + // and reset any in-hands or clothing sprites + _itemSystem.VisualsChanged(uid); } + private void OnGotUnequipped(EntityUid uid, RgbLightControllerComponent rgb, GotUnequippedEvent args) + { + rgb.Holder = null; + rgb.HolderLayers = null; + } + + private void OnHeldVisualsUpdated(EntityUid uid, RgbLightControllerComponent rgb, HeldVisualsUpdatedEvent args) + { + if (args.RevealedLayers.Count == 0) + { + rgb.Holder = null; + rgb.HolderLayers = null; + return; + } + + rgb.Holder = args.User; + rgb.HolderLayers = new(); + + if (!TryComp(args.User, out SpriteComponent? sprite)) + return; + + foreach (var key in args.RevealedLayers) + { + if (!sprite.LayerMapTryGet(key, out var index) || sprite[index] is not Layer layer) + continue; + + if (layer.ShaderPrototype == "unshaded") + rgb.HolderLayers.Add(key); + } + } + + private void OnEquipmentVisualsUpdated(EntityUid uid, RgbLightControllerComponent rgb, EquipmentVisualsUpdatedEvent args) + { + rgb.Holder = args.Equipee; + rgb.HolderLayers = new(); + + if (!TryComp(args.Equipee, out SpriteComponent? sprite)) + return; + + foreach (var key in args.RevealedLayers) + { + if (!sprite.LayerMapTryGet(key, out var index) || sprite[index] is not Layer layer) + continue; + + if (layer.ShaderPrototype == "unshaded") + rgb.HolderLayers.Add(key); + } + } private void OnHandleState(EntityUid uid, RgbLightControllerComponent rgb, ref ComponentHandleState args) { if (args.Current is not RgbLightControllerState state) return; - ResetSpriteColors(uid, rgb); + ResetOriginalColors(uid, rgb); rgb.CycleRate = state.CycleRate; rgb.Layers = state.Layers; + GetOriginalColors(uid, rgb); - // get the new original sprite colors (necessary if rgb.Layers was updated). - GetOriginalSpriteColors(uid, rgb); } - private void GetOriginalSpriteColors(EntityUid uid, RgbLightControllerComponent? rgb = null, SpriteComponent? sprite = null) + private void GetOriginalColors(EntityUid uid, RgbLightControllerComponent? rgb = null, PointLightComponent? light = null, SpriteComponent? sprite = null) { - if (!Resolve(uid, ref rgb, ref sprite)) + if (!Resolve(uid, ref rgb, ref sprite, ref light)) return; + rgb.OriginalLightColor = light.Color; + rgb.OriginalLayerColors = new(); + + var layerCount = sprite.AllLayers.Count(); + + // if layers is null, get unshaded layers if (rgb.Layers == null) { - rgb.OriginalSpriteColor = sprite.Color; - rgb.OriginalLayerColors = null; + rgb.Layers = new(); + + for (var i = 0; i < layerCount; i++) + { + if (sprite[i] is Layer layer && layer.ShaderPrototype == "unshaded") + { + rgb.Layers.Add(i); + rgb.OriginalLayerColors[i] = layer.Color; + } + } return; } - var spriteLayerCount = sprite.AllLayers.Count(); - rgb.OriginalLayerColors = new(rgb.Layers.Count); - - foreach (var layer in rgb.Layers.ToArray()) + foreach (var index in rgb.Layers.ToArray()) { - if (layer < spriteLayerCount) - rgb.OriginalLayerColors[layer] = sprite[layer].Color; + if (index < layerCount) + rgb.OriginalLayerColors[index] = sprite[index].Color; else - rgb.Layers.Remove(layer); + { + // admeme fuck-ups or bad yaml? + Logger.Warning($"RGB light attempted to use invalid sprite index {index} on entity {ToPrettyString(uid)}"); + rgb.Layers.Remove(index); + } } } - private void ResetSpriteColors(EntityUid uid, RgbLightControllerComponent? rgb = null, SpriteComponent? sprite = null) + private void ResetOriginalColors(EntityUid uid, RgbLightControllerComponent? rgb = null, PointLightComponent? light = null, SpriteComponent? sprite = null) { - if (!Resolve(uid, ref rgb, ref sprite)) + if (!Resolve(uid, ref rgb, ref sprite, ref light)) return; + light.Color = rgb.OriginalLightColor; + if (rgb.Layers == null || rgb.OriginalLayerColors == null) - { - sprite.Color = rgb.OriginalSpriteColor; return; - } foreach (var (layer, color) in rgb.OriginalLayerColors) { @@ -109,9 +170,7 @@ namespace Content.Client.Light light.Color = color; - if (rgb.Layers == null) - sprite.Color = color; - else + if (rgb.Layers != null) { foreach (var layer in rgb.Layers) { @@ -119,9 +178,14 @@ namespace Content.Client.Light } } - // not all rgb is hand-held (Hence, not part of EntityQuery) - if (TryComp(rgb.Owner, out SharedItemComponent? item)) - item.Color = color; + // is the entity being held by someone? + if (rgb.HolderLayers == null || !TryComp(rgb.Holder, out SpriteComponent? holderSprite)) + continue; + + foreach (var layer in rgb.HolderLayers) + { + holderSprite.LayerSetColor(layer, color); + } } } diff --git a/Content.Server/Light/EntitySystems/HandheldLightSystem.cs b/Content.Server/Light/EntitySystems/HandheldLightSystem.cs index 2bbcf5770c..e380a14896 100644 --- a/Content.Server/Light/EntitySystems/HandheldLightSystem.cs +++ b/Content.Server/Light/EntitySystems/HandheldLightSystem.cs @@ -5,7 +5,6 @@ using Content.Server.PowerCell; using Content.Shared.Actions; using Content.Shared.Examine; using Content.Shared.Interaction; -using Content.Shared.Item; using Content.Shared.Light.Component; using Content.Shared.Rounding; using Content.Shared.Toggleable; @@ -67,7 +66,7 @@ namespace Content.Server.Light.EntitySystems private void OnGetState(EntityUid uid, HandheldLightComponent component, ref ComponentGetState args) { - args.State = new SharedHandheldLightComponent.HandheldLightComponentState(GetLevel(component)); + args.State = new SharedHandheldLightComponent.HandheldLightComponentState(component.Activated, GetLevel(component)); } private byte? GetLevel(HandheldLightComponent component) @@ -169,8 +168,8 @@ namespace Content.Server.Light.EntitySystems { if (!component.Activated) return false; - SetState(component, false); component.Activated = false; + _actionSystem.SetToggled(component.ToggleAction, false); _activeLights.Remove(component); component.LastLevel = null; component.Dirty(EntityManager); @@ -203,36 +202,15 @@ namespace Content.Server.Light.EntitySystems } component.Activated = true; - SetState(component, true); + _actionSystem.SetToggled(component.ToggleAction, true); _activeLights.Add(component); component.LastLevel = GetLevel(component); - component.Dirty(EntityManager); + Dirty(component); SoundSystem.Play(Filter.Pvs(component.Owner), component.TurnOnSound.GetSound(), component.Owner); return true; } - private void SetState(HandheldLightComponent component, bool on) - { - // TODO: Oh dear - if (EntityManager.TryGetComponent(component.Owner, out SpriteComponent? sprite)) - { - sprite.LayerSetVisible(1, on); - } - - if (EntityManager.TryGetComponent(component.Owner, out PointLightComponent? light)) - { - light.Enabled = on; - } - - if (EntityManager.TryGetComponent(component.Owner, out SharedItemComponent? item)) - { - item.EquippedPrefix = on ? "on" : "off"; - } - - _actionSystem.SetToggled(component.ToggleAction, on); - } - public void TryUpdate(HandheldLightComponent component, float frameTime) { if (!_powerCell.TryGetBatteryFromSlot(component.Owner, out var battery)) diff --git a/Content.Shared/Inventory/InventorySystem.Equip.cs b/Content.Shared/Inventory/InventorySystem.Equip.cs index 9ac83b056b..58b98afd1b 100644 --- a/Content.Shared/Inventory/InventorySystem.Equip.cs +++ b/Content.Shared/Inventory/InventorySystem.Equip.cs @@ -84,9 +84,6 @@ public abstract partial class InventorySystem if(!TryGetSlot(uid, args.Container.ID, out var slotDef, inventory: component)) return; - // un-rotate entities. needed for things like directional flashlights on hardsuit helmets - Transform(args.Entity).LocalRotation = 0; - var equippedEvent = new DidEquipEvent(uid, args.Entity, slotDef); RaiseLocalEvent(uid, equippedEvent); diff --git a/Content.Shared/Light/Component/RgbLightControllerComponent.cs b/Content.Shared/Light/Component/RgbLightControllerComponent.cs index 770269c1b8..6fa65f8130 100644 --- a/Content.Shared/Light/Component/RgbLightControllerComponent.cs +++ b/Content.Shared/Light/Component/RgbLightControllerComponent.cs @@ -6,12 +6,17 @@ using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; namespace Content.Shared.Light.Component; /// -/// Networked ~~solely for admemes~~ for completely legitimate reasons, like hacked energy swords. +/// Makes the color of lights on an entity fluctuate. Will update point-light color and modulate some or all of the +/// sprite layers. Will also modulate the color of any unshaded layers that this entity contributes to a wearer or holder. /// +/// +/// Networked ~~solely for admemes~~ for completely legitimate reasons, like hacked energy swords. +/// [NetworkedComponent] [RegisterComponent] [Friend(typeof(SharedRgbLightControllerSystem))] @@ -21,23 +26,37 @@ public sealed class RgbLightControllerComponent : Robust.Shared.GameObjects.Comp public float CycleRate { get; set; } = 0.1f; /// - /// What layers of the sprite to modulate? If null, will affect the whole sprite. + /// What layers of the sprite to modulate? If null, will affect only unshaded layers. /// [DataField("layers")] public List? Layers; - // original colors when rgb was added. Used to revert Colors when removed. + /// + /// Original light color from befor the rgb was aded. Used to revert colors when removed. + /// public Color OriginalLightColor; - public Color OriginalItemColor; - public Color OriginalSpriteColor; + + /// + /// Original colors of the sprite layersfrom before the rgb was added. Used to revert colors when removed. + /// public Dictionary? OriginalLayerColors; + + /// + /// User that is holding or wearing this entity + /// + public EntityUid? Holder; + + /// + /// List of unshaded layers on the holder/wearer that are being modulated. + /// + public List? HolderLayers; } [Serializable, NetSerializable] public sealed class RgbLightControllerState : ComponentState { public readonly float CycleRate; - public readonly List? Layers; + public List? Layers; public RgbLightControllerState(float cycleRate, List? layers) { diff --git a/Content.Shared/Light/Component/SharedHandheldLightComponent.cs b/Content.Shared/Light/Component/SharedHandheldLightComponent.cs index 0202cd5a27..0dbf940465 100644 --- a/Content.Shared/Light/Component/SharedHandheldLightComponent.cs +++ b/Content.Shared/Light/Component/SharedHandheldLightComponent.cs @@ -17,8 +17,11 @@ namespace Content.Shared.Light.Component { public byte? Charge { get; } - public HandheldLightComponentState(byte? charge) + public bool Activated { get; } + + public HandheldLightComponentState(bool activated, byte? charge) { + Activated = activated; Charge = charge; } } diff --git a/Content.Shared/Light/SharedRgbLightControllerSystem.cs b/Content.Shared/Light/SharedRgbLightControllerSystem.cs index 32c1fc9841..6f04937c8b 100644 --- a/Content.Shared/Light/SharedRgbLightControllerSystem.cs +++ b/Content.Shared/Light/SharedRgbLightControllerSystem.cs @@ -1,6 +1,7 @@ using Content.Shared.Light.Component; using Robust.Shared.GameObjects; using Robust.Shared.GameStates; +using System; using System.Collections.Generic; namespace Content.Shared.Light; @@ -33,7 +34,7 @@ public abstract class SharedRgbLightControllerSystem : EntitySystem if (!Resolve(uid, ref rgb)) return; - rgb.CycleRate = rate; + rgb.CycleRate = Math.Clamp(0.01f, rate, 1); // lets not give people seizures rgb.Dirty(); } } diff --git a/Resources/Prototypes/Entities/Clothing/Head/base_clothinghead.yml b/Resources/Prototypes/Entities/Clothing/Head/base_clothinghead.yml index 4eab41e436..dba182d8d1 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/base_clothinghead.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/base_clothinghead.yml @@ -58,20 +58,26 @@ name: base hardsuit helmet with light components: - type: Sprite - netsync: true + netsync: false layers: - state: icon - state: icon-flash visible: false + map: [ "light" ] - type: Clothing HeldPrefix: off - type: PointLight + netsync: false enabled: false - radius: 3 + radius: 6 + energy: 2 + mask: /Textures/Effects/LightMasks/cone.png + autoRot: true - type: Appearance visuals: - type: FlashLightVisualizer - type: HandheldLight + addPrefix: true toggleAction: name: action-name-toggle-light description: action-description-toggle-light diff --git a/Resources/Prototypes/Entities/Clothing/Head/hardhats.yml b/Resources/Prototypes/Entities/Clothing/Head/hardhats.yml index f100c5087e..edbcef7b4c 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/hardhats.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/hardhats.yml @@ -10,6 +10,7 @@ - state: light-icon shader: unshaded visible: false + map: [ "light" ] - type: Clothing HeldPrefix: off - type: PointLight @@ -19,6 +20,7 @@ visuals: - type: FlashLightVisualizer - type: HandheldLight + addPrefix: true toggleAction: name: action-name-toggle-light description: action-description-toggle-light diff --git a/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml b/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml index a4038e43bc..d2c05e3bfc 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml @@ -5,9 +5,44 @@ description: A special hardsuit helmet designed for working in low-pressure, high thermal environments. components: - type: Sprite + netsync: false sprite: Clothing/Head/Hardsuits/atmospherics.rsi + layers: + - state: icon + - state: icon-unshaded + shader: unshaded + - state: light-overlay + visible: false + shader: unshaded + map: [ "light" ] + - type: HandheldLight + addPrefix: false + inhandVisuals: + left: + - state: inhand-left-light + shader: unshaded + right: + - state: inhand-right-light + shader: unshaded + clothingVisuals: + head: + - state: equipped-head-light + shader: unshaded - type: Clothing - sprite: Clothing/Head/Hardsuits/atmospherics.rsi + clothingVisuals: + head: + - state: equipped-head + - state: equipped-head-unshaded + shader: unshaded + inhandVisuals: + left: + - state: inhand-left + - state: inhand-left-unshaded + shader: unshaded + right: + - state: inhand-right + - state: inhand-right-unshaded + shader: unshaded - type: entity parent: ClothingHeadHardsuitBase diff --git a/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml b/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml index 8a422b132d..91dec0beb1 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml @@ -5,6 +5,7 @@ abstract: true components: - type: HandheldLight + addPrefix: true toggleAction: name: action-name-toggle-light description: action-description-toggle-light @@ -31,6 +32,7 @@ - state: lamp-on shader: unshaded visible: false + map: [ "light" ] - type: Item sprite: Objects/Misc/Lights/lamp.rsi - type: PointLight @@ -53,6 +55,7 @@ - state: bananalamp_on shader: unshaded visible: false + map: [ "light" ] - type: PointLight enabled: false radius: 3 @@ -74,6 +77,7 @@ - state: lampgreen-on shader: unshaded visible: false + map: [ "light" ] - type: Item sprite: Objects/Misc/Lights/lampgreen.rsi - type: PointLight @@ -96,6 +100,7 @@ - state: floodlight_on shader: unshaded visible: false + map: [ "light" ] - type: Physics - type: Fixtures fixtures: diff --git a/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml b/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml index ac2ec7e79b..0583ab1326 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml @@ -9,6 +9,14 @@ - Flashlight - DroneUsable - type: HandheldLight + addPrefix: false + inhandVisuals: + left: + - state: inhand-left-light + shader: unshaded + right: + - state: inhand-right-light + shader: unshaded toggleAction: name: action-name-toggle-light description: action-description-toggle-light @@ -26,10 +34,11 @@ - state: flashlight-overlay shader: unshaded visible: false + map: [ "light" ] - type: Item sprite: Objects/Tools/flashlight.rsi - HeldPrefix: off - type: PointLight + netsync: false enabled: false mask: /Textures/Effects/LightMasks/cone.png autoRot: true @@ -47,6 +56,15 @@ - type: PowerCellSlot cellSlot: startingItem: PowerCellSmallSuper + - type: HandheldLight + addPrefix: false + inhandVisuals: + left: + - state: inhand-left-light + shader: unshaded + right: + - state: inhand-right-light + shader: unshaded - type: Sprite sprite: Objects/Tools/seclite.rsi layers: @@ -54,6 +72,7 @@ - state: seclite-overlay shader: unshaded visible: false + map: [ "light" ] - type: Item sprite: Objects/Tools/seclite.rsi - type: PointLight diff --git a/Resources/Prototypes/Entities/Objects/Tools/lantern.yml b/Resources/Prototypes/Entities/Objects/Tools/lantern.yml index 3c96a8f58d..67ea2ae2aa 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/lantern.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/lantern.yml @@ -5,6 +5,7 @@ description: The holy light guides the way. components: - type: HandheldLight + addPrefix: true toggleAction: name: action-name-toggle-light description: action-description-toggle-light @@ -18,10 +19,12 @@ - state: lantern-on shader: unshaded visible: false + map: [ "light" ] - type: Item sprite: Objects/Tools/lantern.rsi HeldPrefix: off - type: PointLight + netsync: false enabled: false radius: 3 energy: 2.5 diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/equipped-head-light.png b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/equipped-head-light.png new file mode 100644 index 0000000000..9f75f28c05 Binary files /dev/null and b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/equipped-head-light.png differ diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/equipped-head-unshaded.png b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/equipped-head-unshaded.png new file mode 100644 index 0000000000..4ba7fc7b74 Binary files /dev/null and b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/equipped-head-unshaded.png differ diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/off-equipped-HELMET.png b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/equipped-head.png similarity index 100% rename from Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/off-equipped-HELMET.png rename to Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/equipped-head.png diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/icon-unshaded.png b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/icon-unshaded.png new file mode 100644 index 0000000000..4723be70cb Binary files /dev/null and b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/icon-unshaded.png differ diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-left-light.png b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-left-light.png new file mode 100644 index 0000000000..9ee768d5ee Binary files /dev/null and b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-left-light.png differ diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-left-unshaded.png b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-left-unshaded.png new file mode 100644 index 0000000000..8a7835b20d Binary files /dev/null and b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-left-unshaded.png differ diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/off-inhand-left.png b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-left.png similarity index 100% rename from Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/off-inhand-left.png rename to Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-left.png diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-right-light.png b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-right-light.png new file mode 100644 index 0000000000..2990605237 Binary files /dev/null and b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-right-light.png differ diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-right-unshaded.png b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-right-unshaded.png new file mode 100644 index 0000000000..6c80725c0a Binary files /dev/null and b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-right-unshaded.png differ diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/off-inhand-right.png b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-right.png similarity index 100% rename from Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/off-inhand-right.png rename to Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/inhand-right.png diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/light-overlay.png b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/light-overlay.png new file mode 100644 index 0000000000..5347ab016e Binary files /dev/null and b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/light-overlay.png differ diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/meta.json b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/meta.json index 7bea2d1a86..1faf3aa6d0 100644 --- a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/meta.json +++ b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/meta.json @@ -10,31 +10,49 @@ { "name": "icon" }, + { + "name": "icon-unshaded" + }, { "name": "icon-flash" }, { - "name": "off-equipped-HELMET", + "name": "light-overlay" + }, + { + "name": "equipped-head", "directions": 4 }, { - "name": "off-inhand-left", + "name": "equipped-head-light", "directions": 4 }, { - "name": "off-inhand-right", + "name": "equipped-head-unshaded", "directions": 4 }, { - "name": "on-equipped-HELMET", + "name": "inhand-left", "directions": 4 }, { - "name": "on-inhand-left", + "name": "inhand-left-unshaded", "directions": 4 }, { - "name": "on-inhand-right", + "name": "inhand-left-light", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + }, + { + "name": "inhand-right-unshaded", + "directions": 4 + }, + { + "name": "inhand-right-light", "directions": 4 } ] diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/on-equipped-HELMET.png b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/on-equipped-HELMET.png deleted file mode 100644 index 97d20b7d3e..0000000000 Binary files a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/on-equipped-HELMET.png and /dev/null differ diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/on-inhand-left.png b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/on-inhand-left.png deleted file mode 100644 index be7ccc076c..0000000000 Binary files a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/on-inhand-left.png and /dev/null differ diff --git a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/on-inhand-right.png b/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/on-inhand-right.png deleted file mode 100644 index 77b15e837d..0000000000 Binary files a/Resources/Textures/Clothing/Head/Hardsuits/atmospherics.rsi/on-inhand-right.png and /dev/null differ diff --git a/Resources/Textures/Objects/Tools/flashlight.rsi/inhand-left-light.png b/Resources/Textures/Objects/Tools/flashlight.rsi/inhand-left-light.png new file mode 100644 index 0000000000..cb42c3eb65 Binary files /dev/null and b/Resources/Textures/Objects/Tools/flashlight.rsi/inhand-left-light.png differ diff --git a/Resources/Textures/Objects/Tools/flashlight.rsi/off-inhand-left.png b/Resources/Textures/Objects/Tools/flashlight.rsi/inhand-left.png similarity index 100% rename from Resources/Textures/Objects/Tools/flashlight.rsi/off-inhand-left.png rename to Resources/Textures/Objects/Tools/flashlight.rsi/inhand-left.png diff --git a/Resources/Textures/Objects/Tools/flashlight.rsi/inhand-right-light.png b/Resources/Textures/Objects/Tools/flashlight.rsi/inhand-right-light.png new file mode 100644 index 0000000000..eea2533dfa Binary files /dev/null and b/Resources/Textures/Objects/Tools/flashlight.rsi/inhand-right-light.png differ diff --git a/Resources/Textures/Objects/Tools/flashlight.rsi/off-inhand-right.png b/Resources/Textures/Objects/Tools/flashlight.rsi/inhand-right.png similarity index 100% rename from Resources/Textures/Objects/Tools/flashlight.rsi/off-inhand-right.png rename to Resources/Textures/Objects/Tools/flashlight.rsi/inhand-right.png diff --git a/Resources/Textures/Objects/Tools/flashlight.rsi/meta.json b/Resources/Textures/Objects/Tools/flashlight.rsi/meta.json index a470271bdd..41d6756d63 100644 --- a/Resources/Textures/Objects/Tools/flashlight.rsi/meta.json +++ b/Resources/Textures/Objects/Tools/flashlight.rsi/meta.json @@ -17,19 +17,19 @@ "name": "flashlight-overlay" }, { - "name": "off-inhand-left", + "name": "inhand-left", "directions": 4 }, { - "name": "off-inhand-right", + "name": "inhand-right", "directions": 4 }, { - "name": "on-inhand-left", + "name": "inhand-left-light", "directions": 4 }, { - "name": "on-inhand-right", + "name": "inhand-right-light", "directions": 4 }, { diff --git a/Resources/Textures/Objects/Tools/flashlight.rsi/on-inhand-left.png b/Resources/Textures/Objects/Tools/flashlight.rsi/on-inhand-left.png deleted file mode 100644 index 328bb38f7b..0000000000 Binary files a/Resources/Textures/Objects/Tools/flashlight.rsi/on-inhand-left.png and /dev/null differ diff --git a/Resources/Textures/Objects/Tools/flashlight.rsi/on-inhand-right.png b/Resources/Textures/Objects/Tools/flashlight.rsi/on-inhand-right.png deleted file mode 100644 index 812a0186fe..0000000000 Binary files a/Resources/Textures/Objects/Tools/flashlight.rsi/on-inhand-right.png and /dev/null differ diff --git a/Resources/Textures/Objects/Tools/seclite.rsi/inhand-left-light.png b/Resources/Textures/Objects/Tools/seclite.rsi/inhand-left-light.png new file mode 100644 index 0000000000..db9422225f Binary files /dev/null and b/Resources/Textures/Objects/Tools/seclite.rsi/inhand-left-light.png differ diff --git a/Resources/Textures/Objects/Tools/seclite.rsi/off-inhand-left.png b/Resources/Textures/Objects/Tools/seclite.rsi/inhand-left.png similarity index 100% rename from Resources/Textures/Objects/Tools/seclite.rsi/off-inhand-left.png rename to Resources/Textures/Objects/Tools/seclite.rsi/inhand-left.png diff --git a/Resources/Textures/Objects/Tools/seclite.rsi/inhand-right-light.png b/Resources/Textures/Objects/Tools/seclite.rsi/inhand-right-light.png new file mode 100644 index 0000000000..4310855bae Binary files /dev/null and b/Resources/Textures/Objects/Tools/seclite.rsi/inhand-right-light.png differ diff --git a/Resources/Textures/Objects/Tools/seclite.rsi/off-inhand-right.png b/Resources/Textures/Objects/Tools/seclite.rsi/inhand-right.png similarity index 100% rename from Resources/Textures/Objects/Tools/seclite.rsi/off-inhand-right.png rename to Resources/Textures/Objects/Tools/seclite.rsi/inhand-right.png diff --git a/Resources/Textures/Objects/Tools/seclite.rsi/meta.json b/Resources/Textures/Objects/Tools/seclite.rsi/meta.json index f06d071347..86f25b0b7a 100644 --- a/Resources/Textures/Objects/Tools/seclite.rsi/meta.json +++ b/Resources/Textures/Objects/Tools/seclite.rsi/meta.json @@ -17,19 +17,19 @@ "name": "seclite-overlay" }, { - "name": "off-inhand-left", + "name": "inhand-left", "directions": 4 }, { - "name": "off-inhand-right", + "name": "inhand-right", "directions": 4 }, { - "name": "on-inhand-left", + "name": "inhand-left-light", "directions": 4 }, { - "name": "on-inhand-right", + "name": "inhand-right-light", "directions": 4 }, { diff --git a/Resources/Textures/Objects/Tools/seclite.rsi/on-inhand-left.png b/Resources/Textures/Objects/Tools/seclite.rsi/on-inhand-left.png deleted file mode 100644 index 3bbdfefaf0..0000000000 Binary files a/Resources/Textures/Objects/Tools/seclite.rsi/on-inhand-left.png and /dev/null differ diff --git a/Resources/Textures/Objects/Tools/seclite.rsi/on-inhand-right.png b/Resources/Textures/Objects/Tools/seclite.rsi/on-inhand-right.png deleted file mode 100644 index ad27d43a70..0000000000 Binary files a/Resources/Textures/Objects/Tools/seclite.rsi/on-inhand-right.png and /dev/null differ