From dce230fdb20e38b658e61c3bf85e193068f3611f Mon Sep 17 00:00:00 2001 From: deltanedas <39013340+deltanedas@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:33:37 +0000 Subject: [PATCH] port ore bag magnet toggle from white dream (#2467) * add on textures for ore bags * add code for toggling magnet and working in-hand * update ore bag yml --------- Co-authored-by: deltanedas <@deltanedas:kde.org> --- .../Components/ItemToggleExamineComponent.cs | 17 +++++++++++++ .../Systems/ItemToggleExamineSystem.cs | 23 ++++++++++++++++++ .../EntitySystems/MagnetPickupSystem.cs | 15 +++++++++--- .../Objects/Specific/Salvage/ore_bag.yml | 23 +++++++++++++++++- .../Specific/Mining/ore_bag.rsi/icon_on.png | Bin 0 -> 1344 bytes .../Specific/Mining/ore_bag.rsi/meta.json | 15 +++++++++++- .../Mining/ore_bag_holding.rsi/icon_on.png | Bin 0 -> 2162 bytes .../Mining/ore_bag_holding.rsi/meta.json | 21 +++++++++++++++- 8 files changed, 108 insertions(+), 6 deletions(-) create mode 100644 Content.Shared/DeltaV/Item/ItemToggle/Components/ItemToggleExamineComponent.cs create mode 100644 Content.Shared/DeltaV/Item/ItemToggle/Systems/ItemToggleExamineSystem.cs create mode 100644 Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/icon_on.png create mode 100644 Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/icon_on.png 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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c5y|br{#M+I>ipd52^!xOyGc)>5MjEgTWu5&3{q+0v zCmLMVxA`=AQs}2&i|Izc{Dcrf2qA~Rh literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..42382c71f40a67ee22a68449e79aad6679455901 GIT binary patch literal 2162 zcmaJ?dpOg58~;gd$ea>2=i<#Hhv*R%?~lYBvZ3T`mL)<)#Zu2E(fbr{q#lyPWKud! z2SZ}!oRp0zL(au8!Wf(JZavrY{PAAb`~LC0ug`VgpZorNzu)V+@B4-a5&@Hg%K-oY zb8$ZE1prb>Vyr6z5nGLCly723bcBP0M?`2S02toBc)P}}(L=R`NWD3FP2te**4W3R zA&#m|o<@_!3Khu|0~hoWFNdsMqefNMG780M6#9mp58c~dN!7lI$^Np-ps-(Vdqhmt zL9p&Jt?|9OjJsbcwU%Z@LZmL~Sp z`CP0h=_-`H=-#lqbWG4-0XrU9N5%(KHFj`*8QDET@PVk-oqX&0UA>uYK{SlNb0b!!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