diff --git a/Content.Client/Light/Components/HandheldLightComponent.cs b/Content.Client/Light/Components/HandheldLightComponent.cs index 448179e99a..c6bccac941 100644 --- a/Content.Client/Light/Components/HandheldLightComponent.cs +++ b/Content.Client/Light/Components/HandheldLightComponent.cs @@ -1,17 +1,10 @@ using Content.Client.Items.Components; -using Content.Shared.Hands.Components; using Content.Shared.Light.Component; using Robust.Client.Graphics; using Robust.Client.UserInterface; 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 System.Collections.Generic; using static Robust.Client.UserInterface.Controls.BoxContainer; -using static Robust.Shared.GameObjects.SharedSpriteComponent; namespace Content.Client.Light.Components { @@ -32,26 +25,6 @@ namespace Content.Client.Light.Components [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() { return new StatusControl(this); diff --git a/Content.Client/Light/HandheldLightSystem.cs b/Content.Client/Light/HandheldLightSystem.cs index fdb2899db0..68f4438b20 100644 --- a/Content.Client/Light/HandheldLightSystem.cs +++ b/Content.Client/Light/HandheldLightSystem.cs @@ -1,13 +1,8 @@ -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.Client.GameObjects; using Robust.Shared.GameStates; -using System.Linq; namespace Content.Client.Light; @@ -19,59 +14,6 @@ public sealed class HandheldLightSystem : EntitySystem { 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) @@ -85,21 +27,13 @@ public sealed class HandheldLightSystem : EntitySystem 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"; + _itemSys.VisualsChanged(uid); + } } } diff --git a/Content.Client/Toggleable/ToggleableLightVisualsComponent.cs b/Content.Client/Toggleable/ToggleableLightVisualsComponent.cs new file mode 100644 index 0000000000..58ec08f2b8 --- /dev/null +++ b/Content.Client/Toggleable/ToggleableLightVisualsComponent.cs @@ -0,0 +1,33 @@ +using Content.Shared.Hands.Components; +using static Robust.Shared.GameObjects.SharedSpriteComponent; + +namespace Content.Client.Toggleable; + +/// +/// Component that handles the toggling the visuals of some light emitting entity. +/// +/// +/// This will toggle the visibility of layers on an entity's sprite, the in-hand visuals, and the clothing/equipment +/// visuals. This will modify the color of any attached point lights. +/// +[RegisterComponent] +public sealed class ToggleableLightVisualsComponent : Component +{ + /// + /// Sprite layer that will have it's visibility toggled when this item is toggled. + /// + [DataField("spriteLayer")] + public string SpriteLayer = "light"; + + /// + /// Layers to add to the sprite of the player that is holding this entity (while the component is toggled on). + /// + [DataField("inhandVisuals")] + public Dictionary> InhandVisuals = new(); + + /// + /// Layers to add to the sprite of the player that is wearing this entity (while the component is toggled on). + /// + [DataField("clothingVisuals")] + public readonly Dictionary> ClothingVisuals = new(); +} diff --git a/Content.Client/Toggleable/ToggleableLightVisualsSystem.cs b/Content.Client/Toggleable/ToggleableLightVisualsSystem.cs new file mode 100644 index 0000000000..56aba2a376 --- /dev/null +++ b/Content.Client/Toggleable/ToggleableLightVisualsSystem.cs @@ -0,0 +1,113 @@ +using Content.Client.Clothing; +using Content.Client.Items.Systems; +using Content.Shared.Clothing; +using Content.Shared.Hands; +using Content.Shared.Item; +using Content.Shared.Toggleable; +using Robust.Client.GameObjects; +using Robust.Shared.Utility; +using System.Linq; + +namespace Content.Client.Toggleable; + +public sealed class ToggleableLightVisualsSystem : VisualizerSystem +{ + [Dependency] private readonly SharedItemSystem _itemSys = default!; + + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnGetHeldVisuals, after: new[] { typeof(ItemSystem) }); + SubscribeLocalEvent(OnGetEquipmentVisuals, after: new[] { typeof(ClothingSystem) }); + } + + protected override void OnAppearanceChange(EntityUid uid, ToggleableLightVisualsComponent component, ref AppearanceChangeEvent args) + { + if (!args.Component.TryGetData(ToggleableLightVisuals.Enabled, out bool enabled)) + return; + + var modulate = args.Component.TryGetData(ToggleableLightVisuals.Color, out Color color); + + // Update the item's sprite + if (TryComp(uid, out SpriteComponent? sprite) && sprite.LayerMapTryGet(component.SpriteLayer, out var layer)) + { + sprite.LayerSetVisible(layer, enabled); + if (modulate) + sprite.LayerSetColor(layer, color); + } + + // Update any point-lights + if (TryComp(uid, out PointLightComponent? light)) + { + DebugTools.Assert(!light.NetSyncEnabled, "light visualizers require point lights without net-sync"); + light.Enabled = enabled; + if (enabled && modulate) + light.Color = color; + } + + // update clothing & in-hand visuals. + _itemSys.VisualsChanged(uid); + } + + /// + /// Add the unshaded light overlays to any clothing sprites. + /// + private void OnGetEquipmentVisuals(EntityUid uid, ToggleableLightVisualsComponent component, GetEquipmentVisualsEvent args) + { + if (!TryComp(uid, out AppearanceComponent? appearance) + || !appearance.TryGetData(ToggleableLightVisuals.Enabled, out bool enabled) + || !enabled) + return; + + if (!component.ClothingVisuals.TryGetValue(args.Slot, out var layers)) + return; + + var modulate = appearance.TryGetData(ToggleableLightVisuals.Color, out Color color); + + var i = 0; + foreach (var layer in layers) + { + var key = layer.MapKeys?.FirstOrDefault(); + if (key == null) + { + key = i == 0 ? $"{args.Slot}-toggle" : $"{args.Slot}-toggle-{i}"; + i++; + } + + if (modulate) + layer.Color = color; + + args.Layers.Add((key, layer)); + } + } + + private void OnGetHeldVisuals(EntityUid uid, ToggleableLightVisualsComponent component, GetInhandVisualsEvent args) + { + if (!TryComp(uid, out AppearanceComponent? appearance) + || !appearance.TryGetData(ToggleableLightVisuals.Enabled, out bool enabled) + || !enabled) + return; + + if (!component.InhandVisuals.TryGetValue(args.Location, out var layers)) + return; + + var modulate = appearance.TryGetData(ToggleableLightVisuals.Color, out Color color); + + var i = 0; + var defaultKey = $"inhand-{args.Location.ToString().ToLowerInvariant()}-toggle"; + foreach (var layer in layers) + { + var key = layer.MapKeys?.FirstOrDefault(); + if (key == null) + { + key = i == 0 ? defaultKey : $"{defaultKey}-{i}"; + i++; + } + + if (modulate) + layer.Color = color; + + args.Layers.Add((key, layer)); + } + } +} diff --git a/Content.Client/Weapons/Melee/EnergySwordVisualizer.cs b/Content.Client/Weapons/Melee/EnergySwordVisualizer.cs deleted file mode 100644 index ad6373fa73..0000000000 --- a/Content.Client/Weapons/Melee/EnergySwordVisualizer.cs +++ /dev/null @@ -1,96 +0,0 @@ -using Content.Shared.Item; -using Content.Shared.Weapons.Melee; -using Robust.Client.GameObjects; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; -using Robust.Shared.Maths; - -namespace Content.Client.Weapons.Melee; - -public sealed class EnergySwordVisualizer : AppearanceVisualizer -{ - public override void OnChangeData(AppearanceComponent component) - { - base.OnChangeData(component); - var entManager = IoCManager.Resolve(); - - component.TryGetData(EnergySwordVisuals.State, out EnergySwordStatus? status); - status ??= EnergySwordStatus.Off; - component.TryGetData(EnergySwordVisuals.Color, out Color? color); - color ??= Color.DodgerBlue; - entManager.TryGetComponent(component.Owner, out SpriteComponent? spriteComponent); - - if ((status & EnergySwordStatus.On) != 0x0) - { - TurnOn(component, status.Value, color.Value, entManager, spriteComponent); - } - else - { - TurnOff(component, status.Value, entManager, spriteComponent); - } - } - - private void TurnOn( - AppearanceComponent component, - EnergySwordStatus status, - Color color, - IEntityManager entManager, - SpriteComponent? spriteComponent = null) - { - if ((status & EnergySwordStatus.Hacked) != 0x0) - { - if (entManager.TryGetComponent(component.Owner, out SharedItemComponent? itemComponent)) - { - itemComponent.EquippedPrefix = "on-rainbow"; - } - - //todo: figure out how to use the RGBLightControllerSystem to phase out the rainbow sprite AND add lights. - spriteComponent?.LayerSetColor(1, Color.White); - spriteComponent?.LayerSetVisible(1, false); - spriteComponent?.LayerSetState(0, "e_sword_rainbow_on"); - } - else - { - if (entManager.TryGetComponent(component.Owner, out SharedItemComponent? itemComponent)) - { - itemComponent.EquippedPrefix = "on"; - itemComponent.Color = color; - } - - spriteComponent?.LayerSetColor(1, color); - spriteComponent?.LayerSetVisible(1, true); - - if (entManager.TryGetComponent(component.Owner, out PointLightComponent? pointLightComponent)) - { - pointLightComponent.Color = color; - pointLightComponent.Enabled = true; - } - } - } - - private void TurnOff( - AppearanceComponent component, - EnergySwordStatus status, - IEntityManager entManager, - SpriteComponent? spriteComponent = null) - { - if (entManager.TryGetComponent(component.Owner, out SharedItemComponent? itemComponent)) - { - itemComponent.EquippedPrefix = "off"; - } - - if ((status & EnergySwordStatus.Hacked) != 0x0) - { - spriteComponent?.LayerSetState(0, "e_sword"); - } - else - { - spriteComponent?.LayerSetVisible(1, false); - } - - if (entManager.TryGetComponent(component.Owner, out PointLightComponent? pointLightComponent)) - { - pointLightComponent.Enabled = false; - } - } -} diff --git a/Content.Server/Entry/IgnoredComponents.cs b/Content.Server/Entry/IgnoredComponents.cs index e3748402fb..41fd5e6514 100644 --- a/Content.Server/Entry/IgnoredComponents.cs +++ b/Content.Server/Entry/IgnoredComponents.cs @@ -20,6 +20,7 @@ namespace Content.Server.Entry "ItemCabinetVisuals", "DiseaseMachineVisuals", "HandheldGPS", + "ToggleableLightVisuals", "PotencyVisuals", "PaperVisuals" }; diff --git a/Content.Server/Light/EntitySystems/HandheldLightSystem.cs b/Content.Server/Light/EntitySystems/HandheldLightSystem.cs index 4ce723592c..1f9e6d7a67 100644 --- a/Content.Server/Light/EntitySystems/HandheldLightSystem.cs +++ b/Content.Server/Light/EntitySystems/HandheldLightSystem.cs @@ -183,10 +183,13 @@ namespace Content.Server.Light.EntitySystems _actionSystem.SetToggled(component.ToggleAction, false); _activeLights.Remove(component); component.LastLevel = null; - component.Dirty(EntityManager); + Dirty(component); + + if (TryComp(component.Owner, out AppearanceComponent? appearance)) + appearance.SetData(ToggleableLightVisuals.Enabled, false); if (makeNoise) - SoundSystem.Play(Filter.Pvs(component.Owner), component.TurnOffSound.GetSound(), component.Owner); + SoundSystem.Play(Filter.Pvs(component.Owner, entityManager: EntityManager), component.TurnOffSound.GetSound(), component.Owner); return true; } @@ -197,7 +200,7 @@ namespace Content.Server.Light.EntitySystems if (!_powerCell.TryGetBatteryFromSlot(component.Owner, out var battery)) { - SoundSystem.Play(Filter.Pvs(component.Owner), component.TurnOnFailSound.GetSound(), component.Owner); + SoundSystem.Play(Filter.Pvs(component.Owner, entityManager: EntityManager), component.TurnOnFailSound.GetSound(), component.Owner); _popup.PopupEntity(Loc.GetString("handheld-light-component-cell-missing-message"), component.Owner, Filter.Entities(user)); return false; } @@ -207,7 +210,7 @@ namespace Content.Server.Light.EntitySystems // Simple enough. if (component.Wattage > battery.CurrentCharge) { - SoundSystem.Play(Filter.Pvs(component.Owner), component.TurnOnFailSound.GetSound(), component.Owner); + SoundSystem.Play(Filter.Pvs(component.Owner, entityManager: EntityManager), component.TurnOnFailSound.GetSound(), component.Owner); _popup.PopupEntity(Loc.GetString("handheld-light-component-cell-dead-message"), component.Owner, Filter.Entities(user)); return false; } @@ -219,7 +222,10 @@ namespace Content.Server.Light.EntitySystems component.LastLevel = GetLevel(component); Dirty(component); - SoundSystem.Play(Filter.Pvs(component.Owner), component.TurnOnSound.GetSound(), component.Owner); + if (TryComp(component.Owner, out AppearanceComponent? appearance)) + appearance.SetData(ToggleableLightVisuals.Enabled, true); + + SoundSystem.Play(Filter.Pvs(component.Owner, entityManager: EntityManager), component.TurnOnSound.GetSound(), component.Owner); return true; } diff --git a/Content.Server/Weapon/Melee/EnergySword/Components/EnergySwordComponent.cs b/Content.Server/Weapon/Melee/EnergySword/Components/EnergySwordComponent.cs index d3e2d52c38..455fb71aae 100644 --- a/Content.Server/Weapon/Melee/EnergySword/Components/EnergySwordComponent.cs +++ b/Content.Server/Weapon/Melee/EnergySword/Components/EnergySwordComponent.cs @@ -1,9 +1,5 @@ -using System.Collections.Generic; using Content.Shared.Damage; using Content.Shared.Sound; -using Robust.Shared.GameObjects; -using Robust.Shared.Maths; -using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.Weapon.Melee.EnergySword { @@ -15,6 +11,13 @@ namespace Content.Server.Weapon.Melee.EnergySword public bool Hacked = false; public bool Activated = false; + + /// + /// RGB cycle rate for hacked e-swords. + /// + [DataField("cycleRate")] + public float CycleRate = 1f; + [DataField("hitSound")] public SoundSpecifier HitSound { get; set; } = new SoundPathSpecifier("/Audio/Weapons/eblade1.ogg"); diff --git a/Content.Server/Weapon/Melee/EnergySword/EnergySwordSystem.cs b/Content.Server/Weapon/Melee/EnergySword/EnergySwordSystem.cs index 4dfdc4c0dd..5321822a43 100644 --- a/Content.Server/Weapon/Melee/EnergySword/EnergySwordSystem.cs +++ b/Content.Server/Weapon/Melee/EnergySword/EnergySwordSystem.cs @@ -1,12 +1,11 @@ -using Content.Shared.ActionBlocker; using Content.Shared.Interaction; using Content.Shared.Interaction.Events; using Content.Shared.Item; +using Content.Shared.Light; +using Content.Shared.Light.Component; +using Content.Shared.Toggleable; using Content.Shared.Tools.Components; -using Content.Shared.Weapons.Melee; using Robust.Shared.Audio; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; using Robust.Shared.Player; using Robust.Shared.Random; @@ -15,6 +14,7 @@ namespace Content.Server.Weapon.Melee.EnergySword public sealed class EnergySwordSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly SharedRgbLightControllerSystem _rgbSystem = default!; public override void Initialize() { @@ -55,6 +55,8 @@ namespace Content.Server.Weapon.Melee.EnergySword { TurnOn(comp); } + + UpdateAppearance(comp); } private void TurnOff(EnergySwordComponent comp) @@ -67,10 +69,9 @@ namespace Content.Server.Weapon.Melee.EnergySword item.Size = 5; } - SoundSystem.Play(Filter.Pvs(comp.Owner), comp.DeActivateSound.GetSound(), comp.Owner); + SoundSystem.Play(Filter.Pvs(comp.Owner, entityManager: EntityManager), comp.DeActivateSound.GetSound(), comp.Owner); comp.Activated = false; - UpdateAppearance(comp, item); } private void TurnOn(EnergySwordComponent comp) @@ -83,43 +84,36 @@ namespace Content.Server.Weapon.Melee.EnergySword item.Size = 9999; } - SoundSystem.Play(Filter.Pvs(comp.Owner), comp.ActivateSound.GetSound(), comp.Owner); + SoundSystem.Play(Filter.Pvs(comp.Owner, entityManager: EntityManager), comp.ActivateSound.GetSound(), comp.Owner); comp.Activated = true; - UpdateAppearance(comp, item); } - private void UpdateAppearance(EnergySwordComponent component, SharedItemComponent? itemComponent = null) + private void UpdateAppearance(EnergySwordComponent component) { - if (!EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearanceComponent)) return; + if (!TryComp(component.Owner, out AppearanceComponent? appearanceComponent)) + return; - appearanceComponent.SetData(EnergySwordVisuals.Color, component.BladeColor); - - var status = component.Activated ? EnergySwordStatus.On : EnergySwordStatus.Off; - if (component.Hacked) - status |= EnergySwordStatus.Hacked; - - appearanceComponent.SetData(EnergySwordVisuals.State, status); - // wew itemcomp - if (Resolve(component.Owner, ref itemComponent, false)) - { - itemComponent.EquippedPrefix = component.Activated ? "on" : "off"; - itemComponent.Color = component.BladeColor; - } + appearanceComponent.SetData(ToggleableLightVisuals.Enabled, component.Activated); + appearanceComponent.SetData(ToggleableLightVisuals.Color, component.BladeColor); } private void OnInteractUsing(EntityUid uid, EnergySwordComponent comp, InteractUsingEvent args) { if (args.Handled) return; - if (comp.Hacked) - return; - if (!TryComp(args.Used, out ToolComponent? tool) || !tool.Qualities.ContainsAny("Pulsing")) return; args.Handled = true; - comp.Hacked = true; - UpdateAppearance(comp); + comp.Hacked = !comp.Hacked; + + if (comp.Hacked) + { + var rgb = EnsureComp(uid); + _rgbSystem.SetCycleRate(uid, comp.CycleRate, rgb); + } + else + RemComp(uid); } } } diff --git a/Content.Shared/Item/SharedItemComponent.cs b/Content.Shared/Item/SharedItemComponent.cs index a54f00d55e..84a5832af3 100644 --- a/Content.Shared/Item/SharedItemComponent.cs +++ b/Content.Shared/Item/SharedItemComponent.cs @@ -64,23 +64,6 @@ namespace Content.Shared.Item [DataField("EquipSound")] public SoundSpecifier? EquipSound { get; set; } = default!; - // TODO REMOVE. Currently nonfunctional and only used by RGB system. #6253 Fixes this but requires #6252 - /// - /// Color of the sprite shown on the player when this item is in their hands. - /// - [ViewVariables(VVAccess.ReadWrite)] - public Color Color - { - get => _color; - set - { - _color = value; - Dirty(); - } - } - [DataField("color")] - private Color _color = Color.White; - /// /// Rsi of the sprite shown on the player when this item is in their hands. Used to generate a default entry for /// diff --git a/Content.Shared/Toggleable/ToggleableLightVisuals.cs b/Content.Shared/Toggleable/ToggleableLightVisuals.cs new file mode 100644 index 0000000000..ab96d16b26 --- /dev/null +++ b/Content.Shared/Toggleable/ToggleableLightVisuals.cs @@ -0,0 +1,11 @@ +using Robust.Shared.Serialization; + +namespace Content.Shared.Toggleable; + +// Appearance Data key +[Serializable, NetSerializable] +public enum ToggleableLightVisuals +{ + Enabled, + Color +} diff --git a/Content.Shared/Weapons/Melee/SharedEnergySwordComponent.cs b/Content.Shared/Weapons/Melee/SharedEnergySwordComponent.cs deleted file mode 100644 index 45fd78d689..0000000000 --- a/Content.Shared/Weapons/Melee/SharedEnergySwordComponent.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Robust.Shared.Serialization; - -namespace Content.Shared.Weapons.Melee; - - -[Serializable, NetSerializable, Flags] -public enum EnergySwordStatus : byte -{ - Off = 0, - On = 1 << 0, - Hacked = 1 << 1, -} - -[Serializable, NetSerializable] -public enum EnergySwordVisuals : byte -{ - State, - Color, -} diff --git a/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml b/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml index 640891a6e3..dc20b0f707 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml @@ -17,6 +17,8 @@ map: [ "light" ] - type: HandheldLight addPrefix: false + - type: ToggleableLightVisuals + spriteLayer: light inhandVisuals: left: - state: inhand-left-light diff --git a/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml b/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml index f509d799c7..c88b7b72cd 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/flashlights.yml @@ -10,6 +10,14 @@ - DroneUsable - type: HandheldLight addPrefix: false + toggleAction: + name: action-name-toggle-light + description: action-description-toggle-light + icon: Objects/Tools/flashlight.rsi/flashlight.png + iconOn: Objects/Tools/flashlight.rsi/flashlight-on.png + event: !type:ToggleActionEvent + - type: ToggleableLightVisuals + spriteLayer: light inhandVisuals: left: - state: inhand-left-light diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/e_sword.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/e_sword.yml index 144de1e6d6..c58638167c 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/e_sword.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/e_sword.yml @@ -19,6 +19,7 @@ color: "#FFFFFF" visible: false shader: unshaded + map: [ "blade" ] - type: MeleeWeapon damage: types: @@ -35,8 +36,15 @@ energy: 2 color: white - type: Appearance - visuals: - - type: EnergySwordVisualizer + - type: ToggleableLightVisuals + spriteLayer: blade + inhandVisuals: + left: + - state: inhand-left-blade + shader: unshaded + right: + - state: inhand-right-blade + shader: unshaded - type: entity name: pen @@ -59,6 +67,7 @@ color: "#FFFFFF" visible: false shader: unshaded + map: [ "blade" ] - type: MeleeWeapon damage: types: @@ -75,8 +84,15 @@ energy: 1.5 color: white - type: Appearance - visuals: - - type: EnergySwordVisualizer + - type: ToggleableLightVisuals + spriteLayer: blade + inhandVisuals: + left: + - state: inhand-left-blade + shader: unshaded + right: + - state: inhand-right-blade + shader: unshaded - type: Tag tags: - Write diff --git a/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/e_sword_on.png b/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/e_sword_on.png deleted file mode 100644 index f1c209165f..0000000000 Binary files a/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/e_sword_on.png and /dev/null differ diff --git a/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/e_sword_rainbow_on.png b/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/e_sword_rainbow_on.png deleted file mode 100644 index 5a691ef5c2..0000000000 Binary files a/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/e_sword_rainbow_on.png and /dev/null differ diff --git a/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/on-inhand-left.png b/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/inhand-left-blade.png similarity index 100% rename from Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/on-inhand-left.png rename to Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/inhand-left-blade.png diff --git a/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/off-inhand-left.png b/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/inhand-left.png similarity index 100% rename from Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/off-inhand-left.png rename to Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/inhand-left.png diff --git a/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/on-inhand-right.png b/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/inhand-right-blade.png similarity index 100% rename from Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/on-inhand-right.png rename to Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/inhand-right-blade.png diff --git a/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/off-inhand-right.png b/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/inhand-right.png similarity index 100% rename from Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/off-inhand-right.png rename to Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/inhand-right.png diff --git a/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/meta.json b/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/meta.json index ace1544263..2dc66a0e7f 100644 --- a/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/meta.json +++ b/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/meta.json @@ -11,40 +11,12 @@ "name": "e_sword" }, { - "name": "off-inhand-left", + "name": "inhand-left", "directions": 4 }, { - "name": "off-inhand-right", + "name": "inhand-right", "directions": 4 - }, - { - "name": "e_sword_rainbow_on", - "delays": [ - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ] - ] - }, - { - "name": "e_sword_on", - "delays": [ - [ - 0.1, - 0.1 - ] - ] }, { "name": "e_sword_blade", @@ -56,7 +28,7 @@ ] }, { - "name": "on-inhand-left", + "name": "inhand-left-blade", "directions": 4, "delays": [ [ @@ -78,7 +50,7 @@ ] }, { - "name": "on-inhand-right", + "name": "inhand-right-blade", "directions": 4, "delays": [ [ @@ -98,130 +70,6 @@ 0.1 ] ] - }, - { - "name": "on-rainbow-inhand-left", - "directions": 4, - "delays": [ - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ], - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ], - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ], - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ] - ] - }, - { - "name": "on-rainbow-inhand-right", - "directions": 4, - "delays": [ - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ], - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ], - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ], - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ] - ] } ] } diff --git a/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/on-rainbow-inhand-left.png b/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/on-rainbow-inhand-left.png deleted file mode 100644 index b1fa49e19d..0000000000 Binary files a/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/on-rainbow-inhand-left.png and /dev/null differ diff --git a/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/on-rainbow-inhand-right.png b/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/on-rainbow-inhand-right.png deleted file mode 100644 index 57e26517a1..0000000000 Binary files a/Resources/Textures/Objects/Weapons/Melee/e_dagger.rsi/on-rainbow-inhand-right.png and /dev/null differ diff --git a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/e_sword_on.png b/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/e_sword_on.png deleted file mode 100644 index 521324817e..0000000000 Binary files a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/e_sword_on.png and /dev/null differ diff --git a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/e_sword_rainbow_on.png b/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/e_sword_rainbow_on.png deleted file mode 100644 index 02326c8999..0000000000 Binary files a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/e_sword_rainbow_on.png and /dev/null differ diff --git a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/inhand-left-blade.png b/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/inhand-left-blade.png new file mode 100644 index 0000000000..6bc304a12f Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/inhand-left-blade.png differ diff --git a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/off-inhand-left.png b/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/inhand-left.png similarity index 100% rename from Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/off-inhand-left.png rename to Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/inhand-left.png diff --git a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/inhand-right-blade.png b/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/inhand-right-blade.png new file mode 100644 index 0000000000..456e742892 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/inhand-right-blade.png differ diff --git a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/off-inhand-right.png b/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/inhand-right.png similarity index 100% rename from Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/off-inhand-right.png rename to Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/inhand-right.png diff --git a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/meta.json b/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/meta.json index 5aae86289b..2dc66a0e7f 100644 --- a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/meta.json +++ b/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/meta.json @@ -11,40 +11,12 @@ "name": "e_sword" }, { - "name": "off-inhand-left", + "name": "inhand-left", "directions": 4 }, { - "name": "off-inhand-right", + "name": "inhand-right", "directions": 4 - }, - { - "name": "e_sword_rainbow_on", - "delays": [ - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ] - ] - }, - { - "name": "e_sword_on", - "delays": [ - [ - 0.1, - 0.1 - ] - ] }, { "name": "e_sword_blade", @@ -56,7 +28,7 @@ ] }, { - "name": "on-inhand-left", + "name": "inhand-left-blade", "directions": 4, "delays": [ [ @@ -78,7 +50,7 @@ ] }, { - "name": "on-inhand-right", + "name": "inhand-right-blade", "directions": 4, "delays": [ [ @@ -98,130 +70,6 @@ 0.1 ] ] - }, - { - "name": "on-rainbow-inhand-left", - "directions": 4, - "delays": [ - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ], - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ], - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ], - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ] - ] - }, - { - "name": "on-rainbow-inhand-right", - "directions": 4, - "delays": [ - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ], - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ], - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ], - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ] - ] } ] -} \ No newline at end of file +} diff --git a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/on-inhand-left.png b/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/on-inhand-left.png deleted file mode 100644 index b0c4c24359..0000000000 Binary files a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/on-inhand-left.png and /dev/null differ diff --git a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/on-inhand-right.png b/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/on-inhand-right.png deleted file mode 100644 index 6585cdc73d..0000000000 Binary files a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/on-inhand-right.png and /dev/null differ diff --git a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/on-rainbow-inhand-left.png b/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/on-rainbow-inhand-left.png deleted file mode 100644 index 974889d984..0000000000 Binary files a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/on-rainbow-inhand-left.png and /dev/null differ diff --git a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/on-rainbow-inhand-right.png b/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/on-rainbow-inhand-right.png deleted file mode 100644 index 432c057f4b..0000000000 Binary files a/Resources/Textures/Objects/Weapons/Melee/e_sword.rsi/on-rainbow-inhand-right.png and /dev/null differ