[feat]MeatyOre panel
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Traitor;
|
||||
using Content.Shared.Store;
|
||||
|
||||
namespace Content.Server.Store.Conditions;
|
||||
|
||||
public sealed class BuyerBlockForAntagCondition : ListingCondition
|
||||
{
|
||||
public override bool Condition(ListingConditionArgs args)
|
||||
{
|
||||
var ent = args.EntityManager;
|
||||
|
||||
if (!ent.TryGetComponent<MindComponent>(args.Buyer, out var mind) || mind.Mind == null)
|
||||
return false;
|
||||
|
||||
foreach (var role in mind.Mind.AllRoles)
|
||||
{
|
||||
if (role is TraitorRole traitorRole)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Shared.Store;
|
||||
|
||||
namespace Content.Server.Store.Conditions;
|
||||
|
||||
public sealed class BuyerBlockForMindProtected : ListingCondition
|
||||
{
|
||||
public override bool Condition(ListingConditionArgs args)
|
||||
{
|
||||
var buyer = args.Buyer;
|
||||
var ent = args.EntityManager;
|
||||
|
||||
if (!ent.TryGetComponent<MindComponent>(buyer, out var mind) || mind.Mind == null)
|
||||
return false;
|
||||
|
||||
if (mind.Mind.CurrentJob?.CanBeAntag != true)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
24
Content.Server/Store/Conditions/DonationTierLockCondition.cs
Normal file
24
Content.Server/Store/Conditions/DonationTierLockCondition.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Content.Server.White.Sponsors;
|
||||
using Content.Shared.Store;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.Store.Conditions;
|
||||
|
||||
public sealed class DonationTierLockCondition : ListingCondition
|
||||
{
|
||||
[DataField("tier", required: true)]
|
||||
public int Tier;
|
||||
public override bool Condition(ListingConditionArgs args)
|
||||
{
|
||||
var entityManager = args.EntityManager;
|
||||
var sponsorsManager = IoCManager.Resolve<SponsorsManager>();
|
||||
|
||||
if(!entityManager.TryGetComponent<ActorComponent>(args.Buyer, out var actor)) return false;
|
||||
|
||||
if(!sponsorsManager.TryGetInfo(actor.PlayerSession.UserId, out var sponsorInfo)) return false;
|
||||
|
||||
if (sponsorInfo.Tier < Tier) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -173,7 +173,7 @@ public sealed partial class StoreSystem
|
||||
//broadcast event
|
||||
if (listing.ProductEvent != null)
|
||||
{
|
||||
RaiseLocalEvent(listing.ProductEvent);
|
||||
RaiseLocalEvent(buyer, listing.ProductEvent);
|
||||
}
|
||||
|
||||
//log dat shit.
|
||||
@@ -226,4 +226,12 @@ public sealed partial class StoreSystem
|
||||
component.Balance[msg.Currency] -= msg.Amount;
|
||||
UpdateUserInterface(buyer, uid, component);
|
||||
}
|
||||
|
||||
public void CloseUi(EntityUid user, StoreComponent component)
|
||||
{
|
||||
if (!TryComp<ActorComponent>(user, out var actor))
|
||||
return;
|
||||
|
||||
_ui.TryClose(component.Owner, StoreUiKey.Key, actor.PlayerSession);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user