[Admin] Made admin log be high if the buyer is not from expected faction for a store. (#42687)

* more admin qol prs

* mistakes were made at 3am

* mindshield check and cleanup

* address reviews

* typo
This commit is contained in:
Velken
2026-01-29 15:40:06 -03:00
committed by GitHub
parent 2a268a5c25
commit 801b024e65
5 changed files with 33 additions and 2 deletions

View File

@@ -8,6 +8,8 @@ using Content.Shared.Database;
using Content.Shared.FixedPoint;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Mind;
using Content.Shared.Mindshield.Components;
using Content.Shared.NPC.Systems;
using Content.Shared.PDA.Ringer;
using Content.Shared.Store;
using Content.Shared.Store.Components;
@@ -30,6 +32,7 @@ public sealed partial class StoreSystem
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly StackSystem _stack = default!;
[Dependency] private readonly UserInterfaceSystem _ui = default!;
[Dependency] private readonly NpcFactionSystem _npcFaction = default!;
private void InitializeUi()
{
@@ -262,9 +265,23 @@ public sealed partial class StoreSystem
}
//log dat shit.
var logImpact = LogImpact.Low;
var logExtraInfo = "";
if (component.ExpectedFaction?.Count > 0 && !_npcFaction.IsMemberOfAny(buyer, component.ExpectedFaction))
{
logImpact = LogImpact.High;
logExtraInfo = ", but was not from an expected faction";
if (HasComp<MindShieldComponent>(buyer))
{
logImpact = LogImpact.Extreme;
logExtraInfo += " while also possessing a mindshield";
}
}
_admin.Add(LogType.StorePurchase,
LogImpact.Low,
$"{ToPrettyString(buyer):player} purchased listing \"{ListingLocalisationHelpers.GetLocalisedNameOrEntityName(listing, _proto)}\" from {ToPrettyString(uid)}");
logImpact,
$"{ToPrettyString(buyer):player} purchased listing \"{ListingLocalisationHelpers.GetLocalisedNameOrEntityName(listing, _proto)}\" from {ToPrettyString(uid)}{logExtraInfo}.");
listing.PurchaseAmount++; //track how many times something has been purchased
_audio.PlayEntity(component.BuySuccessSound, msg.Actor, uid); //cha-ching!

View File

@@ -1,4 +1,5 @@
using Content.Shared.FixedPoint;
using Content.Shared.NPC.Prototypes;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
@@ -36,6 +37,13 @@ public sealed partial class StoreComponent : Component
[DataField]
public HashSet<ProtoId<CurrencyPrototype>> CurrencyWhitelist = new();
/// <summary>
/// The expected Faction to use this store. (Optional)
/// Used to increase the severity of the admin log upon purchase if the purchaser is not a member of one of the listed factions.
/// </summary>
[DataField]
public HashSet<ProtoId<NpcFactionPrototype>>? ExpectedFaction = new ();
/// <summary>
/// The person/mind who "owns" the store/account. Used if you want the listings to be fixed
/// regardless of who activated it. I.E. role specific items for uplinks.

View File

@@ -70,6 +70,7 @@
ownerOnly: false # For ease of debugging.
balance:
WizCoin: 99999
expectedFaction: #nulls out the expected faction
- type: entity
parent: BaseSpellbook

View File

@@ -123,3 +123,4 @@
- type: Store
balance:
Telecrystal: 99999
expectedFaction: #nulls out the expected faction

View File

@@ -20,6 +20,8 @@
- Telecrystal
balance:
Telecrystal: 0
expectedFaction:
- Syndicate
- type: entity
id: StorePresetSpellbook
@@ -35,6 +37,8 @@
- SpellbookEvents #Summon Weapons, Summon Ghosts
currencyWhitelist:
- WizCoin
expectedFaction:
- Wizard
- type: entity
id: StorePresetChangeling