diff --git a/Content.Shared/DeltaV/Item/ItemToggle/Components/ItemToggleExamineComponent.cs b/Content.Shared/DeltaV/Item/ItemToggle/Components/ItemToggleExamineComponent.cs new file mode 100644 index 00000000000..e8064d79456 --- /dev/null +++ b/Content.Shared/DeltaV/Item/ItemToggle/Components/ItemToggleExamineComponent.cs @@ -0,0 +1,17 @@ +using Content.Shared.DeltaV.Item.ItemToggle.Systems; +using Robust.Shared.GameStates; + +namespace Content.Shared.DeltaV.Item.ItemToggle.Components; + +/// +/// Adds examine text when the item is on or off. +/// +[RegisterComponent, NetworkedComponent, Access(typeof(ItemToggleExamineSystem))] +public sealed partial class ItemToggleExamineComponent : Component +{ + [DataField(required: true)] + public LocId On; + + [DataField(required: true)] + public LocId Off; +} diff --git a/Content.Shared/DeltaV/Item/ItemToggle/Systems/ItemToggleExamineSystem.cs b/Content.Shared/DeltaV/Item/ItemToggle/Systems/ItemToggleExamineSystem.cs new file mode 100644 index 00000000000..5abb0aec78b --- /dev/null +++ b/Content.Shared/DeltaV/Item/ItemToggle/Systems/ItemToggleExamineSystem.cs @@ -0,0 +1,23 @@ +using Content.Shared.DeltaV.Item.ItemToggle.Components; +using Content.Shared.Examine; +using Content.Shared.Item.ItemToggle; + +namespace Content.Shared.DeltaV.Item.ItemToggle.Systems; + +public sealed class ItemToggleExamineSystem : EntitySystem +{ + [Dependency] private readonly ItemToggleSystem _toggle = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnExamined); + } + + private void OnExamined(Entity ent, ref ExaminedEvent args) + { + var msg = _toggle.IsActivated(ent.Owner) ? ent.Comp.On : ent.Comp.Off; + args.PushMarkup(Loc.GetString(msg)); + } +} diff --git a/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs b/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs index 7a8961485d6..5cc24992d31 100644 --- a/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs +++ b/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs @@ -1,5 +1,6 @@ using Content.Server.Storage.Components; using Content.Shared.Inventory; +using Content.Shared.Item.ItemToggle; // DeltaV using Content.Shared.Whitelist; using Robust.Shared.Map; using Robust.Shared.Physics.Components; @@ -15,6 +16,7 @@ public sealed class MagnetPickupSystem : EntitySystem [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly InventorySystem _inventory = default!; + [Dependency] private readonly ItemToggleSystem _toggle = default!; // DeltaV [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SharedStorageSystem _storage = default!; [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; @@ -49,11 +51,18 @@ public override void Update(float frameTime) comp.NextScan += ScanDelay; - if (!_inventory.TryGetContainingSlot((uid, xform, meta), out var slotDef)) + // Begin DeltaV Addition: Make ore bags use ItemToggle + if (!_toggle.IsActivated(uid)) continue; + // End DeltaV Addition - if ((slotDef.SlotFlags & comp.SlotFlags) == 0x0) - continue; + // Begin DeltaV Removals: Allow ore bags to work inhand + //if (!_inventory.TryGetContainingSlot((uid, xform, meta), out var slotDef)) + // continue; + + //if ((slotDef.SlotFlags & comp.SlotFlags) == 0x0) + // continue; + // End DeltaV Removals // No space if (!_storage.HasSpace((uid, storage))) diff --git a/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml b/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml index e73f9d7ba47..0306a7dc147 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml @@ -7,7 +7,10 @@ - type: MagnetPickup - type: Sprite sprite: Objects/Specific/Mining/ore_bag.rsi - state: icon + #state: icon # DeltaV: use a layer instead + layers: # DeltaV + - state: icon + map: [ "enum.ToggleVisuals.Layer" ] - type: Clothing sprite: Objects/Specific/Mining/ore_bag.rsi quickEquip: false @@ -26,6 +29,24 @@ - ArtifactFragment - Ore - type: Dumpable + # Begin DeltaV Additions: toggle magnet from White Dream + - type: ItemToggle + soundActivate: &soundActivate + collection: sparks + params: + variation: 0.25 + soundDeactivate: *soundActivate + - type: ItemToggleExamine + on: magnet-pickup-component-magnet-on + off: magnet-pickup-component-magnet-off + - type: Appearance + - type: GenericVisualizer + visuals: + enum.ToggleVisuals.Toggled: + enum.ToggleVisuals.Layer: + True: { state: icon_on } + False: { state: icon } + # End DeltaV Additions - type: ReverseEngineering # DeltaV difficulty: 2 recipes: diff --git a/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/icon_on.png b/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/icon_on.png new file mode 100644 index 00000000000..b39ff0e6da1 Binary files /dev/null and b/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/icon_on.png differ diff --git a/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/meta.json b/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/meta.json index 39303046bb7..355ad48c8e8 100644 --- a/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/meta.json +++ b/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/meta.json @@ -1,7 +1,7 @@ { "version": 1, "license": "CC-BY-SA-3.0", - "copyright": "Homegrown by @ninruB#7795, inhand sprites by lzk228(discord 455630609641897984)", + "copyright": "Homegrown by @ninruB#7795, inhand sprites by lzk228(discord 455630609641897984) | icon_on state by @kilath", "size": { "x": 32, "y": 32 @@ -21,6 +21,19 @@ { "name": "inhand-right", "directions": 4 + }, + { + "name": "icon_on", + "delays": [ + [ + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1 + ] + ] } ] } diff --git a/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/icon_on.png b/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/icon_on.png new file mode 100644 index 00000000000..42382c71f40 Binary files /dev/null and b/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/icon_on.png differ diff --git a/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/meta.json b/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/meta.json index 3b28912df0d..c81c158a563 100644 --- a/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/meta.json +++ b/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/meta.json @@ -1,7 +1,7 @@ { "version": 1, "license": "CC-BY-SA-3.0", - "copyright": "Taken from Paradise at https://github.com/ParadiseSS13/Paradise/blob/5ce5a66c814c4a60118d24885389357fd0240002/icons/obj/mining.dmi", + "copyright": "Taken from Paradise at https://github.com/ParadiseSS13/Paradise/blob/5ce5a66c814c4a60118d24885389357fd0240002/icons/obj/mining.dmi | icon_on state by PuroSlavKing (Github)", "size": { "x": 32, "y": 32 @@ -106,6 +106,25 @@ 0.1 ] ] + }, + { + "name": "icon_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 + ] + ] } ] }