Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8324ebe
fixes
Androidonator Dec 1, 2025
1fb3368
x d
Androidonator Dec 1, 2025
949dadb
... readability
Androidonator Dec 1, 2025
5cfe3cf
merged thing when apropriate
Androidonator Dec 1, 2025
30e2d69
merged when apropriate
Androidonator Dec 1, 2025
b67cf5b
the war
Androidonator Dec 1, 2025
17d6025
agh i dont know anymorre honestly just leave it like this
Androidonator Dec 1, 2025
1aa9d00
god help me
Androidonator Dec 1, 2025
c14c016
hope this doesnt break anything
Androidonator Dec 1, 2025
8f290a4
goida code go
Androidonator Dec 1, 2025
8146afc
how do i go fast?
Androidonator Dec 1, 2025
5c023b9
made it faster
Androidonator Dec 2, 2025
be847d1
goidaed
Androidonator Dec 2, 2025
7b7e0b4
g9oida
Androidonator Dec 2, 2025
6a3c85c
gg
Androidonator Dec 2, 2025
c75e719
holy shit yaml
Androidonator Dec 2, 2025
5367f4f
fuck my stupid chud lif e
Androidonator Dec 2, 2025
097e599
h
Androidonator Dec 2, 2025
2ba8b21
yoml lontr xd
Androidonator Dec 2, 2025
0003c7a
what ththe fuck is wrong with lonter
Androidonator Dec 2, 2025
9b8f555
goida go
Androidonator Dec 3, 2025
293696d
polishing the turd
Androidonator Dec 3, 2025
a547a45
idk its probably faster now
Androidonator Dec 3, 2025
6f5eeb8
removed rendundant code
Androidonator Dec 3, 2025
3add6ed
I think I made this significantly faster while having the same effect.
Androidonator Dec 3, 2025
cdabfee
aaaaaaaaa
Androidonator Dec 3, 2025
e489823
idk
Androidonator Dec 3, 2025
9a2f107
Merge branch 'master' into fix-contraband-hud-dictionary-edition
Androidonator Dec 3, 2025
a86a64c
:trolled:
Androidonator Dec 3, 2025
d7c4593
hmmm
Androidonator Dec 3, 2025
481e819
holy goida it just works GABEN
Androidonator Dec 4, 2025
7ac09c5
Merge branch 'master' into fix-contraband-hud-dictionary-edition
Androidonator Dec 4, 2025
f2deada
added comments to not make it shit to read
Androidonator Dec 4, 2025
2541462
we are done herre
Androidonator Dec 4, 2025
7545e41
made it less shitcode
Androidonator Dec 5, 2025
60f8b27
goida
Androidonator Dec 5, 2025
dd60572
Merge branch 'master' into fix-contraband-hud-dictionary-edition
Androidonator Dec 5, 2025
8f40201
stick my whole goida up there
Androidonator Dec 5, 2025
f2e3046
Merge remote-tracking branch 'origin/fix-contraband-hud-dictionary-ed…
Androidonator Dec 5, 2025
c0009f5
gods strongest shitcoder
Androidonator Dec 5, 2025
162bb0d
polishing the shit
Androidonator Dec 5, 2025
b9a8319
mr clean fixed bso
Androidonator Dec 5, 2025
fd09a88
goida slop
Androidonator Dec 6, 2025
f2f4dc0
centcomm headset for centcomm ? bruh
Androidonator Dec 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,84 @@
using Content.Goobstation.Common.CCVar;
using Content.Goobstation.Common.Security.ContrabandIcons.Events;
using Content.Goobstation.Shared.Contraband;
using Content.Goobstation.Shared.Security.ContrabandIcons;
using Content.Goobstation.Shared.Security.ContrabandIcons.Components;
using Content.Shared.Contraband;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Robust.Shared.Configuration;


namespace Content.Goobstation.Client.Security.Systems;

public sealed class ContrabandIconsSystem : SharedContrabandIconsSystem;
public sealed class ContrabandIconsSystem : SharedContrabandIconsSystem
{
[Dependency] private readonly IConfigurationManager _configuration = default!;
[Dependency] private readonly SharedContrabandDetectorSystem _detectorSystem = default!;

private bool _isEnabled = true;
private EntityQuery<ContrabandComponent> _contrabandQuery;

public override void Initialize()
{
base.Initialize();
_contrabandQuery = GetEntityQuery<ContrabandComponent>();

Subs.CVar(_configuration, GoobCVars.ContrabandIconsEnabled, value => _isEnabled = value);

SubscribeLocalEvent<VisibleContrabandComponent, DidEquipEvent>(OnEquip);
SubscribeLocalEvent<VisibleContrabandComponent, DidUnequipEvent>(OnUnequip);

SubscribeLocalEvent<IdCardInsertedEvent>(OnIdCardInserted);
SubscribeLocalEvent<IdCardRemovedEvent>(OnIdCardRemoved);
SubscribeLocalEvent<VisibleContrabandComponent, ComponentStartup>(OnComponentStartup);
}

private void OnEquip(EntityUid uid, VisibleContrabandComponent comp, DidEquipEvent args)
{
if (!_isEnabled)
return;
if (args.SlotFlags == SlotFlags.IDCARD)
{
CheckAllContra(args.Equipee);
return;
}
if (args.SlotFlags == SlotFlags.POCKET)
return;
if (!_contrabandQuery.TryComp(args.Equipment, out var contra))
return;
if (contra.Severity == "Minor")
return;
var hasPermission = _detectorSystem.CheckContrabandPermission(args.Equipment, args.Equipee, contra);
if ((contra.Severity == "Restricted" || contra.Severity == "GrandTheft") && hasPermission)
return;
comp.VisibleItems.Add(args.Equipment);
UpdateStatusIcon(comp, args.Equipee, ContrabandStatus.Contraband);
}

private void OnUnequip(EntityUid uid, VisibleContrabandComponent comp, DidUnequipEvent args)
{
if (args.SlotFlags == SlotFlags.IDCARD)
{
CheckAllContra(args.Equipee);
return;
}
comp.VisibleItems.Remove(args.Equipment);
if (comp.VisibleItems.Count == 0)
UpdateStatusIcon(comp, args.Equipee, ContrabandStatus.None);
}

private void OnIdCardInserted(IdCardInsertedEvent args)
{
CheckAllContra(args.TargetUid);
}

private void OnIdCardRemoved(IdCardRemovedEvent args)
{
CheckAllContra(args.TargetUid);
}
private void OnComponentStartup(EntityUid uid, VisibleContrabandComponent component, ComponentStartup args)
{
CheckAllContra(uid);
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
using Content.Client.Overlays;
using Content.Shared.StatusIcon.Components;
using Robust.Shared.Prototypes;
using ShowContrabandIconsComponent = Content.Goobstation.Shared.Security.ContrabandIcons.Components.ShowContrabandIconsComponent;
using VisibleContrabandComponent = Content.Goobstation.Shared.Security.ContrabandIcons.Components.VisibleContrabandComponent;
using Content.Goobstation.Shared.Security.ContrabandIcons.Components;
using Content.Goobstation.Common.CCVar;
using Robust.Shared.Configuration;

namespace Content.Goobstation.Client.Security.Systems;

public sealed class ShowContrabandIconsSystem : EquipmentHudSystem<ShowContrabandIconsComponent>
{
[Dependency] private readonly IPrototypeManager _prototype = default!;

[Dependency] private readonly IConfigurationManager _configuration = default!;
private bool _isEnabled = true;
public override void Initialize()
{
base.Initialize();

Subs.CVar(_configuration, GoobCVars.ContrabandIconsEnabled, value => _isEnabled = value);
SubscribeLocalEvent<VisibleContrabandComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
}

private void OnGetStatusIconsEvent(EntityUid uid, VisibleContrabandComponent component, ref GetStatusIconsEvent ev)
{
if (!IsActive)
if (!IsActive || !_isEnabled)
return;

if (_prototype.TryIndex(component.StatusIcon, out var iconPrototype))
Expand Down
7 changes: 4 additions & 3 deletions Content.Goobstation.Common/CCVar/CCVars.Goob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -641,10 +641,11 @@ public sealed partial class GoobCVars
public static readonly CVarDef<float> BleedMultiplier =
CVarDef.Create("medical.bloodloss_multiplier", 4.0f, CVar.SERVER);

#endregion

/// <summary>
/// Enables or disables contraband icons.
/// </summary>
public static readonly CVarDef<bool> ContrabandIconsEnabled =
CVarDef.Create("contraband.icons_enabled", false, CVar.SERVER | CVar.REPLICATED);
}
CVarDef.Create("contraband.icons_enabled", true, CVar.SERVER | CVar.REPLICATED);
#endregion
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace Content.Goobstation.Common.Security.ContrabandIcons.Events;



/// <param name="IdCardUid">The entity UID of the ID card that was inserted.</param>
/// <param name="TargetUid">The entity UID of the Pda.</param>
public record struct IdCardInsertedEvent(EntityUid IdCardUid, EntityUid TargetUid);

/// <param name="IdCardUid">The entity UID of the ID card that was removed.</param>
/// <param name="TargetUid">The entity UID of the Pda.</param>
public record struct IdCardRemovedEvent(EntityUid IdCardUid, EntityUid TargetUid);
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
using Content.Goobstation.Shared.Security.ContrabandIcons;
using Content.Goobstation.Shared.Security.ContrabandIcons.Components;
using Content.Shared._Goobstation.Security.ContrabandIcons;
using Content.Shared.Inventory;

namespace Content.Goobstation.Server.Security.ContrabandIcons;

public sealed class ContrabandIconsSystem : SharedContrabandIconsSystem
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<VisibleContrabandComponent, MapInitEvent>(OnMapInit);
}

private void OnMapInit(EntityUid uid, VisibleContrabandComponent component, MapInitEvent args)
{
ContrabandDetect(uid, component, SlotFlags.WITHOUT_POCKET);
}
}
public sealed class ContrabandIconsSystem : SharedContrabandIconsSystem;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Shared._Goobstation.Security.ContrabandIcons.Prototypes;
using Content.Goobstation.Shared.Security.ContrabandIcons.Prototypes;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;

Expand All @@ -12,4 +12,13 @@ public sealed partial class VisibleContrabandComponent : Component
/// </summary>
[DataField, AutoNetworkedField]
public ProtoId<ContrabandIconPrototype> StatusIcon = "ContrabandIconNone";

[DataField]
public HashSet<EntityUid> VisibleItems = new();
}

public enum ContrabandStatus : byte
{
None,
Contraband
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;

namespace Content.Shared._Goobstation.Security.ContrabandIcons.Prototypes;
namespace Content.Goobstation.Shared.Security.ContrabandIcons.Prototypes;

[Prototype("contrabandIcon")]
public sealed partial class ContrabandIconPrototype : StatusIconPrototype, IInheritingPrototype
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,74 +1,61 @@
using Content.Goobstation.Common.CCVar;
using System.Linq;
using Content.Goobstation.Shared.Contraband;
using Content.Goobstation.Shared.Security.ContrabandIcons.Components;
using Content.Goobstation.Shared.Security.ContrabandIcons.Prototypes;
using Content.Shared.Hands;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Content.Shared.Strip.Components;
using Robust.Shared.Configuration;
using Robust.Shared.Network;

namespace Content.Goobstation.Shared.Security.ContrabandIcons;

/// <summary>
/// This handles...
/// </summary>
public abstract class SharedContrabandIconsSystem : EntitySystem
{
[Dependency] private readonly SharedContrabandDetectorSystem _detectorSystem = default!;
[Dependency] private readonly IConfigurationManager _configuration = default!;
private bool _isEnabled = true;
[Dependency] private readonly InventorySystem _inventory = default!;
[Dependency] private readonly INetManager _net = default!;
private EntityQuery<VisibleContrabandComponent> _visibleContrabandQuery;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<VisibleContrabandComponent, DidEquipEvent>(OnEquip);
SubscribeLocalEvent<VisibleContrabandComponent, DidUnequipEvent>(OnUnequip);

SubscribeLocalEvent<VisibleContrabandComponent, DidEquipHandEvent>(OnEquipHands);
SubscribeLocalEvent<VisibleContrabandComponent, DidUnequipHandEvent>(OnUnequipHands);

Subs.CVar(_configuration, GoobCVars.ContrabandIconsEnabled, value => _isEnabled = value);
_visibleContrabandQuery = GetEntityQuery<VisibleContrabandComponent>();
}

protected void ContrabandDetect(EntityUid inventory, VisibleContrabandComponent component, SlotFlags slotFlags = SlotFlags.WITHOUT_POCKET)
{
if (!_isEnabled)
return;
if (HasComp<ThievingComponent>(inventory))
return;
var list = _detectorSystem.FindContraband(inventory, false, slotFlags);
var isDetected = list.Count > 0;
component.StatusIcon = StatusToIcon(isDetected ? ContrabandStatus.Contraband : ContrabandStatus.None);
Dirty(inventory, component);
}

private string StatusToIcon(ContrabandStatus status)
{
return status switch
{
ContrabandStatus.None => "ContrabandIconNone",
ContrabandStatus.Contraband => "ContrabandIconContraband",
_ => "ContrabandIconNone"
};
return status == ContrabandStatus.Contraband ? "ContrabandIconContraband" : "ContrabandIconNone";
}

private void OnEquip(EntityUid uid, VisibleContrabandComponent component, DidEquipEvent args)
protected void CheckAllContra(EntityUid uid)
{
ContrabandDetect(uid, component, args.SlotFlags);
}
uid = GetHighestContainerOwner(uid);

private void OnUnequip(EntityUid uid, VisibleContrabandComponent component, DidUnequipEvent args)
{
ContrabandDetect(uid, component, args.SlotFlags);
if (!_visibleContrabandQuery.TryComp(uid, out var visible))
return;
var contraband = _detectorSystem.FindContraband(uid, false, SlotFlags.WITHOUT_POCKET);
if (contraband == null) // this is stupid but it works
return;

visible.VisibleItems = contraband.ToHashSet();
var status = visible.VisibleItems.Count > 0 ? ContrabandStatus.Contraband : ContrabandStatus.None;
UpdateStatusIcon(visible, uid, status);
}

private void OnUnequipHands(EntityUid uid, VisibleContrabandComponent component, DidUnequipHandEvent args)
protected void UpdateStatusIcon(VisibleContrabandComponent comp, EntityUid uid, ContrabandStatus status)
{
ContrabandDetect(uid, component, SlotFlags.NONE);
var newStatus = StatusToIcon(status);
if (comp.StatusIcon == newStatus)
return;

comp.StatusIcon = newStatus;
if (_net.IsServer)
Dirty(uid, comp);
}
private void OnEquipHands(EntityUid uid, VisibleContrabandComponent component, DidEquipHandEvent args)

private EntityUid GetHighestContainerOwner(EntityUid uid)
{
ContrabandDetect(uid, component, SlotFlags.NONE);
while (_inventory.TryGetContainingEntity(uid, out var containerEntity))
{
uid = containerEntity.Value;
}

return uid;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ namespace Content.Shared.Overlays;
/// This component allows you to see criminal record status of mobs.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class ShowCriminalRecordIconsComponent : Component { }
public sealed partial class ShowCriminalRecordIconsComponent : Component;
5 changes: 3 additions & 2 deletions Content.Shared/PDA/SharedPdaSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//
// SPDX-License-Identifier: MIT

using Content.Goobstation.Common.Security.ContrabandIcons.Events;
using Content.Shared.Access.Components;
using Content.Shared.Containers.ItemSlots;
using Robust.Shared.Containers;
Expand Down Expand Up @@ -57,15 +58,15 @@ protected virtual void OnItemInserted(EntityUid uid, PdaComponent pda, EntInsert
{
if (args.Container.ID == PdaComponent.PdaIdSlotId)
pda.ContainedId = args.Entity;

RaiseLocalEvent(new IdCardInsertedEvent(args.Entity, args.Container.Owner)); //goob event
UpdatePdaAppearance(uid, pda);
}

protected virtual void OnItemRemoved(EntityUid uid, PdaComponent pda, EntRemovedFromContainerMessage args)
{
if (args.Container.ID == pda.IdSlot.ID)
pda.ContainedId = null;

RaiseLocalEvent(new IdCardRemovedEvent(args.Entity, args.Container.Owner)); //goob event
UpdatePdaAppearance(uid, pda);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
sprite: Clothing/Ears/Headsets/cargo.rsi

- type: entity
parent: [ClothingHeadsetAlt, BaseCommandContraband] # Goobstation
parent: [ClothingHeadsetAlt, BaseCentcommCommandContraband] # Goobstation
id: ClothingHeadsetAltCentCom
name: CentComm over-ear headset
components:
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Objects/base_contraband.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
abstract: true
components:
- type: Contraband
allowedDepartments: [ Security, Cargo ]
allowedDepartments: [ Security, Cargo, CentralCommand ] # Goob - blueshield gear

- type: entity
id: BaseMedicalScienceContraband
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
abstract: true
components:
- type: Contraband
allowedDepartments: [ Security, Engineering, Cargo ]
allowedDepartments: [ Security, Engineering, Cargo, CentralCommand ] # stupid fucking BSO

- type: entity
id: BaseSecurityZookeeperContraband # Tranq shells
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
parent: ContrabandIcon
id: ContrabandIconContraband
icon:
sprite: /Textures/_Goobstation/Interface/Misc/security_icons.rsi
sprite: /Textures/_Goobstation/Interface/Misc/contraband_icons.rsi
state: hud_contraband

- type: contrabandIcon
parent: ContrabandIcon
id: ContrabandIconNone
icon:
sprite: /Textures/_Goobstation/Interface/Misc/security_icons.rsi
sprite: /Textures/_Goobstation/Interface/Misc/contraband_icons.rsi
state: hud_none

Loading
Loading