From 502710ce2ba6bf6ed331a03ccedace3c85cfefd1 Mon Sep 17 00:00:00 2001 From: Ivan <126400932+HellCatten@users.noreply.github.com> Date: Tue, 3 Sep 2024 13:18:06 +0300 Subject: [PATCH 1/2] [Feature] Added Toggle to magnetPickupSystem / [FIX] Ore Processor Fix (#15) * [NEW] Added toggle to magnetPickupSystem / [FIX] ore processor fix * Ru locale / En localisation fix * code change after review * WHITE comments added * ON sprites added by @kilath * update test. * fix * update tests * Changed ContainingSlot/SlotDef checks. Added ForcePickup. * Component fixed * microfix * style: a bit of styling --------- Co-authored-by: Remuchi --- .../Components/MagnetPickupComponent.cs | 11 ++-- .../EntitySystems/MagnetPickupSystem.cs | 50 +++++++++++++----- .../components/magnet-pickup-component.ftl | 4 ++ .../components/magnet-pickup-component.ftl | 4 ++ .../Objects/Specific/Salvage/ore_bag.yml | 23 +++++++- .../Specific/Salvage/ore_bag_holding.yml | 10 +++- .../Entities/Structures/Machines/lathe.yml | 5 ++ .../Specific/Mining/ore_bag.rsi/meta.json | 17 +++++- .../ore_bag.rsi/{icon.png => orebag_off.png} | Bin .../Specific/Mining/ore_bag.rsi/orebag_on.png | Bin 0 -> 1344 bytes .../Mining/ore_bag_holding.rsi/meta.json | 23 +++++++- .../{icon.png => orebag_off.png} | Bin .../Mining/ore_bag_holding.rsi/orebag_on.png | Bin 0 -> 2162 bytes 13 files changed, 124 insertions(+), 23 deletions(-) create mode 100644 Resources/Locale/en-US/storage/components/magnet-pickup-component.ftl create mode 100644 Resources/Locale/ru-RU/_white/storage/components/magnet-pickup-component.ftl rename Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/{icon.png => orebag_off.png} (100%) create mode 100644 Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/orebag_on.png rename Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/{icon.png => orebag_off.png} (100%) create mode 100644 Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/orebag_on.png diff --git a/Content.Shared/Storage/Components/MagnetPickupComponent.cs b/Content.Shared/Storage/Components/MagnetPickupComponent.cs index 3467439a6d..23b5a13ae2 100644 --- a/Content.Shared/Storage/Components/MagnetPickupComponent.cs +++ b/Content.Shared/Storage/Components/MagnetPickupComponent.cs @@ -1,11 +1,13 @@ using Content.Shared.Inventory; +using Robust.Shared.GameStates; namespace Content.Server.Storage.Components; /// /// Applies an ongoing pickup area around the attached entity. /// -[RegisterComponent, AutoGenerateComponentPause] +[NetworkedComponent] +[RegisterComponent, AutoGenerateComponentPause, AutoGenerateComponentState] public sealed partial class MagnetPickupComponent : Component { [ViewVariables(VVAccess.ReadWrite), DataField("nextScan")] @@ -13,10 +15,11 @@ public sealed partial class MagnetPickupComponent : Component public TimeSpan NextScan = TimeSpan.Zero; /// - /// What container slot the magnet needs to be in to work. + /// If true, ignores SlotFlags and can magnet pickup on hands/ground. /// - [ViewVariables(VVAccess.ReadWrite), DataField("slotFlags")] - public SlotFlags SlotFlags = SlotFlags.BELT; + [ViewVariables(VVAccess.ReadWrite), DataField] + [AutoNetworkedField] + public bool ForcePickup = true; [ViewVariables(VVAccess.ReadWrite), DataField("range")] public float Range = 1f; diff --git a/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs b/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs index 7a8961485d..8a7fdb57c8 100644 --- a/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs +++ b/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs @@ -1,6 +1,9 @@ using Content.Server.Storage.Components; +using Content.Shared.Examine; using Content.Shared.Inventory; -using Content.Shared.Whitelist; +using Content.Shared.Item; +using Content.Shared.Item.ItemToggle; +using Content.Shared.Item.ItemToggle.Components; using Robust.Shared.Map; using Robust.Shared.Physics.Components; using Robust.Shared.Timing; @@ -17,8 +20,8 @@ public sealed class MagnetPickupSystem : EntitySystem [Dependency] private readonly InventorySystem _inventory = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SharedStorageSystem _storage = default!; - [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; - + [Dependency] private readonly SharedItemToggleSystem _itemToggle = default!; // WD EDIT + [Dependency] private readonly SharedItemSystem _item = default!; // White Dream private static readonly TimeSpan ScanDelay = TimeSpan.FromSeconds(1); @@ -28,6 +31,8 @@ public override void Initialize() { base.Initialize(); _physicsQuery = GetEntityQuery(); + SubscribeLocalEvent(OnItemToggled); // White Dream + SubscribeLocalEvent(OnExamined); // WD EDIT SubscribeLocalEvent(OnMagnetMapInit); } @@ -36,6 +41,21 @@ private void OnMagnetMapInit(EntityUid uid, MagnetPickupComponent component, Map component.NextScan = _timing.CurTime; } + //WD EDIT start + private void OnExamined(Entity entity, ref ExaminedEvent args) + { + var onMsg = _itemToggle.IsActivated(entity.Owner) + ? Loc.GetString("comp-magnet-pickup-examined-on") + : Loc.GetString("comp-magnet-pickup-examined-off"); + args.PushMarkup(onMsg); + } + + private void OnItemToggled(Entity entity, ref ItemToggledEvent args) + { + _item.SetHeldPrefix(entity.Owner, args.Activated ? "on" : "off"); + } + //WD EDIT end + public override void Update(float frameTime) { base.Update(frameTime); @@ -44,16 +64,23 @@ public override void Update(float frameTime) while (query.MoveNext(out var uid, out var comp, out var storage, out var xform, out var meta)) { - if (comp.NextScan > currentTime) + // WD EDIT START + if (!TryComp(uid, out var toggle)) continue; - comp.NextScan += ScanDelay; + if (!_itemToggle.IsActivated(uid, toggle)) + continue; + // WD EDIT END - if (!_inventory.TryGetContainingSlot((uid, xform, meta), out var slotDef)) + if (comp.NextScan > currentTime) continue; - if ((slotDef.SlotFlags & comp.SlotFlags) == 0x0) + comp.NextScan += ScanDelay; + + // WD EDIT START. Added ForcePickup. + if (!comp.ForcePickup && !_inventory.TryGetContainingSlot((uid, xform, meta), out _)) continue; + //WD EDIT END. // No space if (!_storage.HasSpace((uid, storage))) @@ -66,7 +93,7 @@ public override void Update(float frameTime) foreach (var near in _lookup.GetEntitiesInRange(uid, comp.Range, LookupFlags.Dynamic | LookupFlags.Sundries)) { - if (_whitelistSystem.IsWhitelistFail(storage.Whitelist, near)) + if (storage.Whitelist?.IsValid(near, EntityManager) == false) continue; if (!_physicsQuery.TryGetComponent(near, out var physics) || physics.BodyStatus != BodyStatus.OnGround) @@ -80,17 +107,14 @@ public override void Update(float frameTime) // the problem is that stack pickups delete the original entity, which is fine, but due to // game state handling we can't show a lerp animation for it. var nearXform = Transform(near); - var nearMap = _transform.GetMapCoordinates(near, xform: nearXform); + var nearMap = _transform.GetMapCoordinates(near); var nearCoords = EntityCoordinates.FromMap(moverCoords.EntityId, nearMap, _transform, EntityManager); if (!_storage.Insert(uid, near, out var stacked, storageComp: storage, playSound: !playedSound)) continue; // Play pickup animation for either the stack entity or the original entity. - if (stacked != null) - _storage.PlayPickupAnimation(stacked.Value, nearCoords, finalCoords, nearXform.LocalRotation); - else - _storage.PlayPickupAnimation(near, nearCoords, finalCoords, nearXform.LocalRotation); + _storage.PlayPickupAnimation(stacked ?? near, nearCoords, finalCoords, nearXform.LocalRotation); playedSound = true; } diff --git a/Resources/Locale/en-US/storage/components/magnet-pickup-component.ftl b/Resources/Locale/en-US/storage/components/magnet-pickup-component.ftl new file mode 100644 index 0000000000..d56293dd5b --- /dev/null +++ b/Resources/Locale/en-US/storage/components/magnet-pickup-component.ftl @@ -0,0 +1,4 @@ +## Used when examining the MagnetPickupComponent + +comp-magnet-pickup-examined-on = The magnet is currently [color=darkgreen]on[/color]. +comp-magnet-pickup-examined-off = The magnet is currently [color=darkred]off[/color]. diff --git a/Resources/Locale/ru-RU/_white/storage/components/magnet-pickup-component.ftl b/Resources/Locale/ru-RU/_white/storage/components/magnet-pickup-component.ftl new file mode 100644 index 0000000000..9a58288220 --- /dev/null +++ b/Resources/Locale/ru-RU/_white/storage/components/magnet-pickup-component.ftl @@ -0,0 +1,4 @@ +## Выводится при осмотре предмета с MagnetPickupCompontent + +comp-magnet-pickup-examined-on = Магнит сейчас [color=darkgreen]включен[/color]. +comp-magnet-pickup-examined-off = Магнит сейчас [color=darkred]выключен[/color]. diff --git a/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml b/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml index a36bfaf676..469ba4c36f 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml @@ -7,13 +7,16 @@ - type: MagnetPickup - type: Sprite sprite: Objects/Specific/Mining/ore_bag.rsi - state: icon + layers: + - state: orebag_off + map: [ "enum.ToggleVisuals.Layer" ] - type: Clothing sprite: Objects/Specific/Mining/ore_bag.rsi quickEquip: false slots: - belt - type: Item + heldPrefix: off size: Ginormous - type: Storage maxItemSize: Normal @@ -26,3 +29,21 @@ - ArtifactFragment - Ore - type: Dumpable + # WHITE EDIT START + - type: ItemToggle + soundActivate: + collection: sparks + params: + variation: 0.250 + soundDeactivate: + collection: sparks + params: + variation: 0.250 + - type: Appearance + - type: GenericVisualizer + visuals: + enum.ToggleVisuals.Toggled: + enum.ToggleVisuals.Layer: + True: { state: orebag_on } + False: { state: orebag_off } + # WHITE EDIT END diff --git a/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag_holding.yml b/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag_holding.yml index e8c7fa37dd..c0e21cb8a3 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag_holding.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag_holding.yml @@ -8,7 +8,15 @@ range: 2 - type: Sprite sprite: Objects/Specific/Mining/ore_bag_holding.rsi - state: icon + layers: + - state: orebag_off + map: [ "enum.ToggleVisuals.Layer" ] + - type: GenericVisualizer + visuals: + enum.ToggleVisuals.Toggled: + enum.ToggleVisuals.Layer: + True: { state: orebag_on } + False: { state: orebag_off } - type: Clothing sprite: Objects/Specific/Mining/ore_bag_holding.rsi - type: Storage diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index a905bc73da..5cbaee1f5a 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -1257,6 +1257,10 @@ - IngotSilver1 - MaterialBananium1 - MaterialDiamond + - type: MaterialStorageMagnetPickup # Delta V - Summary: Adds magnet pull from Frontier + magnetEnabled: True + range: 0.30 # Delta V - End Magnet Pull + - type: PlaceableSurface # WHITE EDIT - type: entity parent: OreProcessor @@ -1396,3 +1400,4 @@ - Wooden - RawMaterial - Plastic + - PrizeTicket 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 39303046bb..596d686f64 100644 --- a/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/meta.json +++ b/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/meta.json @@ -1,14 +1,14 @@ { "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 лазік#7305, ON state sprite by @kilath", "size": { "x": 32, "y": 32 }, "states": [ { - "name": "icon" + "name": "orebag_off" }, { "name": "equipped-BELT", @@ -21,6 +21,19 @@ { "name": "inhand-right", "directions": 4 + }, + { + "name": "orebag_on", + "delays": [ + [ + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1 + ] + ] } ] } diff --git a/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/icon.png b/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/orebag_off.png similarity index 100% rename from Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/icon.png rename to Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/orebag_off.png diff --git a/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/orebag_on.png b/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/or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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_holding.rsi/meta.json b/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/meta.json index 3b28912df0..8a3908f419 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,14 +1,14 @@ { "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, ON state sprite by @kilath", "size": { "x": 32, "y": 32 }, "states": [ { - "name": "icon", + "name": "orebag_off", "delays": [ [ 0.1, @@ -19,6 +19,25 @@ ] ] }, + { + "name": "orebag_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": "equipped-BELT", "directions": 4 diff --git a/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/icon.png b/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/orebag_off.png similarity index 100% rename from Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/icon.png rename to Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/orebag_off.png diff --git a/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/orebag_on.png b/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/orebag_on.png new file mode 100644 index 0000000000000000000000000000000000000000..42382c71f40a67ee22a68449e79aad6679455901 GIT binary patch literal 2162 zcmaJ?dpOg58~;gd$ea>2=i<#Hhv*R%?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dd#);UN8KI&Pe}|P!Q&F>p9gj1Xx}E0Qx*k z5OW+DHN@q&ZTwS_^-4Uh;-}g@aZl) zuheH-inz?B<)L5EdBLy-_`W0?VP_s?vi7l*^y5I{d+GYCkeTu=SkDgLjZN_KMuj5d z(PgsK;TfQP*EtYg9vXcMH$(V!ST!InWo)@0l7Gsmbum3w7%h#&Kt0rAh0G+ac;K{h zr4Fq3Pe)AHIpeccacQjQIPlTD6P?oT@WQ84=yBV}9WE4SwF zrD;uzu5U4!E0l+3o{>PUcbPKK%otikJ#NGDju@T+;rj-1=JXq+#@QJV`2>dMVDcgt zA$?uwbRMt45UcN)C5OF~ZhI|3`#+Zb$>ZBCa&h9i?42qj}QfvW?y3s5E z*WDC&Iwfak&NhpI)%$H}VYO6ye`?)ne$S&@v8n+nPNqb+#h~fz9DZAi!<}_ew3%PR z=ry}|!lL}z_x#4%(J?!P{DryJga4}G;B++(i-fVCMp`a|L7nv(=M}65g$LK=*Q_US zW3{Blf`nR0bT(XN^~LM18l4HvS#0-Ixw`mD`Hf%u-yEEAEEI{kWN3fziBj5dUcI_m z@LejE%8ReuX`WLzPqB#|SQBCr!MM9y#hoqg+x1lbgch(eBXdQ2 z%jbDJ`g|v{4K)U~FLN=PsDcsx@s}aCBD)4z^VTTT#HE!V7$(WRKvt3qeinB#WpGmi zMRz2@1%=khs{OaHOQ_d$4dQD-a*{Tb`Ox!pG3G?}PbE+^zp{03ldJo!A}aM{eBDbo zi0QCr3L-UlSB3zJZGKTQu>Ka+(%SmrK0!giQJ2i514Pf}YPZ{7%<<+Ups3Hhx`;&J z-aCaa6iu1vLf7@#0~}0E6$nDE-U%V4)qrSf=Ff)jrj-+x$hsEnAFK3a#T^&qc~5mf z_?DmJ@d^X|7F~N3hecn Date: Fri, 13 Sep 2024 19:19:02 +0300 Subject: [PATCH 2/2] [Port] Magnetic Ore Bags --- .../Components/MagnetPickupComponent.cs | 11 ++-- .../EntitySystems/MagnetPickupSystem.cs | 50 +++++------------- .../components/magnet-pickup-component.ftl | 4 -- .../components/magnet-pickup-component.ftl | 4 -- .../Objects/Specific/Salvage/ore_bag.yml | 23 +------- .../Specific/Salvage/ore_bag_holding.yml | 10 +--- .../Entities/Structures/Machines/lathe.yml | 5 -- .../ore_bag.rsi/{orebag_off.png => icon.png} | Bin .../Specific/Mining/ore_bag.rsi/meta.json | 17 +----- .../Specific/Mining/ore_bag.rsi/orebag_on.png | Bin 1344 -> 0 bytes .../{orebag_off.png => icon.png} | Bin .../Mining/ore_bag_holding.rsi/meta.json | 23 +------- .../Mining/ore_bag_holding.rsi/orebag_on.png | Bin 2162 -> 0 bytes 13 files changed, 23 insertions(+), 124 deletions(-) delete mode 100644 Resources/Locale/en-US/storage/components/magnet-pickup-component.ftl delete mode 100644 Resources/Locale/ru-RU/_white/storage/components/magnet-pickup-component.ftl rename Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/{orebag_off.png => icon.png} (100%) delete mode 100644 Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/orebag_on.png rename Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/{orebag_off.png => icon.png} (100%) delete mode 100644 Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/orebag_on.png diff --git a/Content.Shared/Storage/Components/MagnetPickupComponent.cs b/Content.Shared/Storage/Components/MagnetPickupComponent.cs index 23b5a13ae2..3467439a6d 100644 --- a/Content.Shared/Storage/Components/MagnetPickupComponent.cs +++ b/Content.Shared/Storage/Components/MagnetPickupComponent.cs @@ -1,13 +1,11 @@ using Content.Shared.Inventory; -using Robust.Shared.GameStates; namespace Content.Server.Storage.Components; /// /// Applies an ongoing pickup area around the attached entity. /// -[NetworkedComponent] -[RegisterComponent, AutoGenerateComponentPause, AutoGenerateComponentState] +[RegisterComponent, AutoGenerateComponentPause] public sealed partial class MagnetPickupComponent : Component { [ViewVariables(VVAccess.ReadWrite), DataField("nextScan")] @@ -15,11 +13,10 @@ public sealed partial class MagnetPickupComponent : Component public TimeSpan NextScan = TimeSpan.Zero; /// - /// If true, ignores SlotFlags and can magnet pickup on hands/ground. + /// What container slot the magnet needs to be in to work. /// - [ViewVariables(VVAccess.ReadWrite), DataField] - [AutoNetworkedField] - public bool ForcePickup = true; + [ViewVariables(VVAccess.ReadWrite), DataField("slotFlags")] + public SlotFlags SlotFlags = SlotFlags.BELT; [ViewVariables(VVAccess.ReadWrite), DataField("range")] public float Range = 1f; diff --git a/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs b/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs index 8a7fdb57c8..7a8961485d 100644 --- a/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs +++ b/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs @@ -1,9 +1,6 @@ using Content.Server.Storage.Components; -using Content.Shared.Examine; using Content.Shared.Inventory; -using Content.Shared.Item; -using Content.Shared.Item.ItemToggle; -using Content.Shared.Item.ItemToggle.Components; +using Content.Shared.Whitelist; using Robust.Shared.Map; using Robust.Shared.Physics.Components; using Robust.Shared.Timing; @@ -20,8 +17,8 @@ public sealed class MagnetPickupSystem : EntitySystem [Dependency] private readonly InventorySystem _inventory = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SharedStorageSystem _storage = default!; - [Dependency] private readonly SharedItemToggleSystem _itemToggle = default!; // WD EDIT - [Dependency] private readonly SharedItemSystem _item = default!; // White Dream + [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; + private static readonly TimeSpan ScanDelay = TimeSpan.FromSeconds(1); @@ -31,8 +28,6 @@ public override void Initialize() { base.Initialize(); _physicsQuery = GetEntityQuery(); - SubscribeLocalEvent(OnItemToggled); // White Dream - SubscribeLocalEvent(OnExamined); // WD EDIT SubscribeLocalEvent(OnMagnetMapInit); } @@ -41,21 +36,6 @@ private void OnMagnetMapInit(EntityUid uid, MagnetPickupComponent component, Map component.NextScan = _timing.CurTime; } - //WD EDIT start - private void OnExamined(Entity entity, ref ExaminedEvent args) - { - var onMsg = _itemToggle.IsActivated(entity.Owner) - ? Loc.GetString("comp-magnet-pickup-examined-on") - : Loc.GetString("comp-magnet-pickup-examined-off"); - args.PushMarkup(onMsg); - } - - private void OnItemToggled(Entity entity, ref ItemToggledEvent args) - { - _item.SetHeldPrefix(entity.Owner, args.Activated ? "on" : "off"); - } - //WD EDIT end - public override void Update(float frameTime) { base.Update(frameTime); @@ -64,23 +44,16 @@ public override void Update(float frameTime) while (query.MoveNext(out var uid, out var comp, out var storage, out var xform, out var meta)) { - // WD EDIT START - if (!TryComp(uid, out var toggle)) - continue; - - if (!_itemToggle.IsActivated(uid, toggle)) - continue; - // WD EDIT END - if (comp.NextScan > currentTime) continue; comp.NextScan += ScanDelay; - // WD EDIT START. Added ForcePickup. - if (!comp.ForcePickup && !_inventory.TryGetContainingSlot((uid, xform, meta), out _)) + if (!_inventory.TryGetContainingSlot((uid, xform, meta), out var slotDef)) + continue; + + if ((slotDef.SlotFlags & comp.SlotFlags) == 0x0) continue; - //WD EDIT END. // No space if (!_storage.HasSpace((uid, storage))) @@ -93,7 +66,7 @@ public override void Update(float frameTime) foreach (var near in _lookup.GetEntitiesInRange(uid, comp.Range, LookupFlags.Dynamic | LookupFlags.Sundries)) { - if (storage.Whitelist?.IsValid(near, EntityManager) == false) + if (_whitelistSystem.IsWhitelistFail(storage.Whitelist, near)) continue; if (!_physicsQuery.TryGetComponent(near, out var physics) || physics.BodyStatus != BodyStatus.OnGround) @@ -107,14 +80,17 @@ public override void Update(float frameTime) // the problem is that stack pickups delete the original entity, which is fine, but due to // game state handling we can't show a lerp animation for it. var nearXform = Transform(near); - var nearMap = _transform.GetMapCoordinates(near); + var nearMap = _transform.GetMapCoordinates(near, xform: nearXform); var nearCoords = EntityCoordinates.FromMap(moverCoords.EntityId, nearMap, _transform, EntityManager); if (!_storage.Insert(uid, near, out var stacked, storageComp: storage, playSound: !playedSound)) continue; // Play pickup animation for either the stack entity or the original entity. - _storage.PlayPickupAnimation(stacked ?? near, nearCoords, finalCoords, nearXform.LocalRotation); + if (stacked != null) + _storage.PlayPickupAnimation(stacked.Value, nearCoords, finalCoords, nearXform.LocalRotation); + else + _storage.PlayPickupAnimation(near, nearCoords, finalCoords, nearXform.LocalRotation); playedSound = true; } diff --git a/Resources/Locale/en-US/storage/components/magnet-pickup-component.ftl b/Resources/Locale/en-US/storage/components/magnet-pickup-component.ftl deleted file mode 100644 index d56293dd5b..0000000000 --- a/Resources/Locale/en-US/storage/components/magnet-pickup-component.ftl +++ /dev/null @@ -1,4 +0,0 @@ -## Used when examining the MagnetPickupComponent - -comp-magnet-pickup-examined-on = The magnet is currently [color=darkgreen]on[/color]. -comp-magnet-pickup-examined-off = The magnet is currently [color=darkred]off[/color]. diff --git a/Resources/Locale/ru-RU/_white/storage/components/magnet-pickup-component.ftl b/Resources/Locale/ru-RU/_white/storage/components/magnet-pickup-component.ftl deleted file mode 100644 index 9a58288220..0000000000 --- a/Resources/Locale/ru-RU/_white/storage/components/magnet-pickup-component.ftl +++ /dev/null @@ -1,4 +0,0 @@ -## Выводится при осмотре предмета с MagnetPickupCompontent - -comp-magnet-pickup-examined-on = Магнит сейчас [color=darkgreen]включен[/color]. -comp-magnet-pickup-examined-off = Магнит сейчас [color=darkred]выключен[/color]. diff --git a/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml b/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml index 469ba4c36f..a36bfaf676 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag.yml @@ -7,16 +7,13 @@ - type: MagnetPickup - type: Sprite sprite: Objects/Specific/Mining/ore_bag.rsi - layers: - - state: orebag_off - map: [ "enum.ToggleVisuals.Layer" ] + state: icon - type: Clothing sprite: Objects/Specific/Mining/ore_bag.rsi quickEquip: false slots: - belt - type: Item - heldPrefix: off size: Ginormous - type: Storage maxItemSize: Normal @@ -29,21 +26,3 @@ - ArtifactFragment - Ore - type: Dumpable - # WHITE EDIT START - - type: ItemToggle - soundActivate: - collection: sparks - params: - variation: 0.250 - soundDeactivate: - collection: sparks - params: - variation: 0.250 - - type: Appearance - - type: GenericVisualizer - visuals: - enum.ToggleVisuals.Toggled: - enum.ToggleVisuals.Layer: - True: { state: orebag_on } - False: { state: orebag_off } - # WHITE EDIT END diff --git a/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag_holding.yml b/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag_holding.yml index c0e21cb8a3..e8c7fa37dd 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag_holding.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Salvage/ore_bag_holding.yml @@ -8,15 +8,7 @@ range: 2 - type: Sprite sprite: Objects/Specific/Mining/ore_bag_holding.rsi - layers: - - state: orebag_off - map: [ "enum.ToggleVisuals.Layer" ] - - type: GenericVisualizer - visuals: - enum.ToggleVisuals.Toggled: - enum.ToggleVisuals.Layer: - True: { state: orebag_on } - False: { state: orebag_off } + state: icon - type: Clothing sprite: Objects/Specific/Mining/ore_bag_holding.rsi - type: Storage diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 5cbaee1f5a..a905bc73da 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -1257,10 +1257,6 @@ - IngotSilver1 - MaterialBananium1 - MaterialDiamond - - type: MaterialStorageMagnetPickup # Delta V - Summary: Adds magnet pull from Frontier - magnetEnabled: True - range: 0.30 # Delta V - End Magnet Pull - - type: PlaceableSurface # WHITE EDIT - type: entity parent: OreProcessor @@ -1400,4 +1396,3 @@ - Wooden - RawMaterial - Plastic - - PrizeTicket diff --git a/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/orebag_off.png b/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/icon.png similarity index 100% rename from Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/orebag_off.png rename to Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/icon.png 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 596d686f64..39303046bb 100644 --- a/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/meta.json +++ b/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/meta.json @@ -1,14 +1,14 @@ { "version": 1, "license": "CC-BY-SA-3.0", - "copyright": "Homegrown by @ninruB#7795, inhand sprites by лазік#7305, ON state sprite by @kilath", + "copyright": "Homegrown by @ninruB#7795, inhand sprites by lzk228(discord 455630609641897984)", "size": { "x": 32, "y": 32 }, "states": [ { - "name": "orebag_off" + "name": "icon" }, { "name": "equipped-BELT", @@ -21,19 +21,6 @@ { "name": "inhand-right", "directions": 4 - }, - { - "name": "orebag_on", - "delays": [ - [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1 - ] - ] } ] } diff --git a/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/orebag_on.png b/Resources/Textures/Objects/Specific/Mining/ore_bag.rsi/orebag_on.png deleted file mode 100644 index b39ff0e6da1fe642fd03c64720177c8f27416f92..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1344 zcmV-G1;6@% z!T&&4!Bs&J6hXw%+1DZ^p4$o)X>YhWKfZgv!^sy2Oeec38(1N0yv;`$a8C*R<4(=xKQ@)>ZER z^Yk*qL*?$RacFoBg7+S1+=b#!5PTm8LGc8_PjH#9_*W&T(NEELDq8dqBAal2Rnd$+ zxY&ZuM@M({k`$I5%4Fc}4B8f;{T7;+%31xMbNT?u4f#bkuzvu(azC>C19)v{L8LgM zWB>pF32;bRa{vG?BLDy{BLR4&KXw2B19?eAK~#8N?V3$%6G0fqrxK|~OIn&kt5BsP zR0Yx8L@%w-s|bR(;?Zv)egg60C-5M>c@i%kl(rY4Hx8K|C2o1 z>5}ZTFPSdV{|}bT%QN#ELMF2_yT%Yg2qAaQYSX_PKka9Adb+i^v}7eSLAusl zw&h2w$2+ZRt)zp{pr3wU{zF=T3*?)n!#3U6*b2)fjXD{i59p`A-+pz5favl9sw0(9 z?516k%)lhjPk*$mUw$iY9z@H&cJiG$nd_W%%y{POKnVg5zq zoO#ulv=`D+ju^yB9&}s6l0rZIKK(r>02W0#b-PrsS*E0sMzJ^^K@Lkwck#_b~u zaejR9cOF~_V~g-VoIe(hVZZ$Veq1sM_uCKPmq}2BALQ}(yf?xOoDDV~FN2MQJB!ev z?7ATa_!6Wn8Y_LIy$?+4hZ_{(cR8qjOg{Vx6yb;abNzI#-(TzsfDOlNX9q5u3NY1N zwnF&_LVBw6Ai|AB+ua8f=}F=TMfrt;?3W*Z5q`My{{GY_!QDC-4a%;X59a3GZJU2K zKV(cfh^y;u(?UP}QTpkRodB|n#;$s-a|Sy*h#mH@nYp!L9zPneXS0=ZJ03G`ZPkRa z?q(zl^wSS~`qg7lARXa|$?X(!dFUWl@{elmF>;yok zxUWJ-B9~n`z$0i}0_qThSUG}{`?xI7Prq-!`Yw4f zPrq-!Iz4xH-|Y_F_pO^l?b$c5y|br{#M+I>ipd52^!xOyGc)>5MjEgTWu5&3{q+0v zCmLMVxA`=AQs}2&i|Izc{Dcrf2qA~Rh diff --git a/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/orebag_off.png b/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/icon.png similarity index 100% rename from Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/orebag_off.png rename to Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/icon.png 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 8a3908f419..3b28912df0 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,14 +1,14 @@ { "version": 1, "license": "CC-BY-SA-3.0", - "copyright": "Taken from Paradise at https://github.com/ParadiseSS13/Paradise/blob/5ce5a66c814c4a60118d24885389357fd0240002/icons/obj/mining.dmi, ON state sprite by @kilath", + "copyright": "Taken from Paradise at https://github.com/ParadiseSS13/Paradise/blob/5ce5a66c814c4a60118d24885389357fd0240002/icons/obj/mining.dmi", "size": { "x": 32, "y": 32 }, "states": [ { - "name": "orebag_off", + "name": "icon", "delays": [ [ 0.1, @@ -19,25 +19,6 @@ ] ] }, - { - "name": "orebag_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": "equipped-BELT", "directions": 4 diff --git a/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/orebag_on.png b/Resources/Textures/Objects/Specific/Mining/ore_bag_holding.rsi/orebag_on.png deleted file mode 100644 index 42382c71f40a67ee22a68449e79aad6679455901..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 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!! ztk8d1QG?jqQBB2>a4f3a_c@y>H~;R{YQM6eS2gp_`&=|(*Ea3-U1=)$Z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