From 9a1e7105140e0b686e5b05abf2f7d29df075017c Mon Sep 17 00:00:00 2001 From: Remuchi Date: Tue, 3 Sep 2024 17:17:07 +0700 Subject: [PATCH] style: a bit of styling --- .../EntitySystems/MagnetPickupSystem.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs b/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs index c7398f0fc2..8a7fdb57c8 100644 --- a/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs +++ b/Content.Shared/Storage/EntitySystems/MagnetPickupSystem.cs @@ -1,6 +1,5 @@ using Content.Server.Storage.Components; using Content.Shared.Examine; -using Content.Shared.Hands.EntitySystems; using Content.Shared.Inventory; using Content.Shared.Item; using Content.Shared.Item.ItemToggle; @@ -32,8 +31,8 @@ public override void Initialize() { base.Initialize(); _physicsQuery = GetEntityQuery(); - SubscribeLocalEvent(ToggleDone); // White Dream - SubscribeLocalEvent(onExamined); // WD EDIT + SubscribeLocalEvent(OnItemToggled); // White Dream + SubscribeLocalEvent(OnExamined); // WD EDIT SubscribeLocalEvent(OnMagnetMapInit); } @@ -43,7 +42,7 @@ private void OnMagnetMapInit(EntityUid uid, MagnetPickupComponent component, Map } //WD EDIT start - private void onExamined(Entity entity, ref ExaminedEvent args) + private void OnExamined(Entity entity, ref ExaminedEvent args) { var onMsg = _itemToggle.IsActivated(entity.Owner) ? Loc.GetString("comp-magnet-pickup-examined-on") @@ -51,7 +50,7 @@ private void onExamined(Entity entity, ref ExaminedEvent args.PushMarkup(onMsg); } - private void ToggleDone(Entity entity, ref ItemToggledEvent args) + private void OnItemToggled(Entity entity, ref ItemToggledEvent args) { _item.SetHeldPrefix(entity.Owner, args.Activated ? "on" : "off"); } @@ -79,8 +78,7 @@ public override void Update(float frameTime) comp.NextScan += ScanDelay; // WD EDIT START. Added ForcePickup. - if (!comp.ForcePickup && - !_inventory.TryGetContainingSlot((uid, xform, meta), out var slotDef)) + if (!comp.ForcePickup && !_inventory.TryGetContainingSlot((uid, xform, meta), out _)) continue; //WD EDIT END. @@ -109,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 = nearXform.MapPosition; + 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; }