Clean up StoreSystem (#14027)

This commit is contained in:
Nemanja
2023-02-12 07:39:14 -05:00
committed by GitHub
parent e7b18b33aa
commit 351c53e774
9 changed files with 108 additions and 101 deletions

View File

@@ -19,7 +19,6 @@ using Content.Shared.Bed.Sleep;
using System.Linq;
using Content.Server.Maps;
using Content.Server.Revenant.Components;
using Content.Server.Store.Components;
using Content.Shared.Emag.Systems;
using Content.Shared.FixedPoint;
using Content.Shared.Humanoid;
@@ -29,7 +28,6 @@ using Content.Shared.Mobs.Systems;
using Content.Shared.Revenant.Components;
using Robust.Shared.Physics.Components;
using Robust.Shared.Utility;
using Content.Shared.Humanoid;
namespace Content.Server.Revenant.EntitySystems;
@@ -180,13 +178,10 @@ public sealed partial class RevenantSystem
essence.Harvested = true;
ChangeEssenceAmount(uid, essence.EssenceAmount, component);
if (TryComp<StoreComponent>(uid, out var store))
{
_store.TryAddCurrency(new Dictionary<string, FixedPoint2>()
{ {component.StolenEssenceCurrencyPrototype, essence.EssenceAmount} }, store);
}
_store.TryAddCurrency(new Dictionary<string, FixedPoint2>
{ {component.StolenEssenceCurrencyPrototype, essence.EssenceAmount} }, uid);
if (!TryComp<MobStateComponent>(args.Target, out var mobstate))
if (!HasComp<MobStateComponent>(args.Target))
return;
if (_mobState.IsAlive(args.Target) || _mobState.IsCritical(args.Target))

View File

@@ -18,7 +18,6 @@ using Content.Shared.Tag;
using Content.Server.Store.Components;
using Content.Server.Store.Systems;
using Content.Shared.FixedPoint;
using Robust.Shared.Player;
using Content.Shared.Maps;
using Content.Shared.Mobs.Systems;
using Content.Shared.Physics;
@@ -80,7 +79,7 @@ public sealed partial class RevenantSystem : EntitySystem
}
//ghost vision
if (TryComp(component.Owner, out EyeComponent? eye))
if (TryComp(uid, out EyeComponent? eye))
eye.VisibilityMask |= (uint) (VisibilityFlags.Ghost);
var shopaction = new InstantAction(_proto.Index<InstantActionPrototype>("RevenantShop"));
@@ -131,7 +130,7 @@ public sealed partial class RevenantSystem : EntitySystem
FixedPoint2.Min(component.Essence, component.EssenceRegenCap);
if (TryComp<StoreComponent>(uid, out var store))
_store.UpdateUserInterface(uid, store);
_store.UpdateUserInterface(uid, uid, store);
_alerts.ShowAlert(uid, AlertType.Essence, (short) Math.Clamp(Math.Round(component.Essence.Float() / 10f), 0, 16));
@@ -172,7 +171,7 @@ public sealed partial class RevenantSystem : EntitySystem
{
if (!TryComp<StoreComponent>(uid, out var store))
return;
_store.ToggleUi(uid, store);
_store.ToggleUi(uid, uid, store);
}
public void MakeVisible(bool visible)